Boris Zbarsky wrote:
Myk Melez wrote:
Some settings will get applied by rules in a user stylesheet
We already have a mechanism for this, right?
We have nsIStylesheetService for adding a user stylesheet, and we also
have a CSS extension providing URL-based selectors, so we could just
load a single user stylesheet with rules for every site and page being
styled.
But then the stylesheet will get applied to every page the user loads,
even though most pages won't be styled by it.
Another option is for the style context to query the settings object for
a page-specific stylesheet on page load.
In that case we would need to modify the style context to do the query
and apply the result (if any). And, if we wanted to implement this as a
JS component, we'd also have to expose a way to instantiate a stylesheet
from script (unless there's such a way already; I haven't found one).
Depends on how you use it. If it's queried once per pageload to get
some data that core layout then uses, it can probably be a JS
component. If it's going to be hooked into something that happens
often, then performance could be a problem with the JS component approach.
In general, the settings object will get queried once per page load (or
perhaps a handful of times per page load, if different parts of layout
do their own queries). We'll also need to apply the changes users make
to their settings, but those will happen much less frequently than once
per page load.
-myk
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout