Closed Bug 1290224 Opened 8 years ago Closed 8 years ago

stylo: Support nsStyleSheetService

Categories

(Core :: CSS Parsing and Computation, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bholley, Assigned: heycam)

References

Details

AFAICT this is used only by XPCOM addons [1], as well as Firefox Hello [2]. Cameron, can you confirm that there's no other reason we'd need to support this? Presumably not super high priority, but probably not hard either. [1] https://dxr.mozilla.org/addons/search?q=loadAndRegisterSheet&redirect=true [2] https://dxr.mozilla.org/mozilla-central/source/browser/extensions/loop/bootstrap.js#1432
Flags: needinfo?(cam)
(In reply to Bobby Holley (:bholley) (busy with Stylo) from comment #0) > AFAICT this is used only by XPCOM addons [1], as well as Firefox Hello [2]. > Cameron, can you confirm that there's no other reason we'd need to support > this? Yes I think that's right. (There are a couple of mochitests that use the interface too, e.g. to check that we correctly parse certain constructs in UA sheets and not in content sheets.)
Flags: needinfo?(cam)
Blocks: 1324683
Blocks: 1324689
Blocks: 1324694
Blocks: 1324699
At least style system mochitest "test_addSheet.html" relies on nsStyleSheetService::PreloadSheet being able to create ServoStyleSheet. I think making it create the correct object is probably not hard, but the tricky part is how can we know whether we should create CSSStyleSheet or ServoStyleSheet. Probably always create ServoStyleSheet when stylo is enabled?
As far as I can see, preloadSheet is basically designed to be used just with nsIDOMWindowUtils.addSheet. We could do something like this: have a new concrete class PreloadedSheet that implements nsIDOMStyleSheet, which can own a Gecko CSSStyleSheet and a ServoStyleSheet. PreloadedSheet could default to creating a ServoStyleSheet is the pref is set, but if later we pass a PreloadedSheet to nsIDOMWindowUtils.addSheet, we can just create the CSSStyleSheet at that point. We might be lucky enough not to need to implement any of the nsIDOM(CSS)StyleSheet accessors. Actually, looking at DXR, there are surprisingly few uses of preloadSheet in extensions. I think we could just change the API not to return an nsIDOMStyleSheet, but something more opaque, which all you can usefully do with is pass to addSheet.
I'll try that approach.
Assignee: nobody → cam
Also layout/style/chrome/test_moz_document_rules.html layout/style/browser_newtab_share_rule_processors.js
Depends on: 1328546
Depends on: 1337258
Blocks: 1337599
No longer blocks: stylo-style-mochitest
This is done now I think.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.