I'm looking into fixing bug 443978 (allow general mutation of
@font-face rules from JavaScript).  This involves being able to call
back into the CSS parser, and to do that you have to have a whole bunch
of document state.  All of that state is reachable from the stylesheet
object - but it takes 40 lines of code to dig it all out. There is a
helper method nsDOMCSSDeclaration::GetCSSParsingEnvironment
which does just that, but it's only available as a concrete method if
you are a DOMCSSDeclarationImpl or a nsDOMCSSAttributeDeclaration -
approximately, if you are a regular style declaration (specified in CSS
or poked in from JS, respectively, I think).  There is also similar
logic embedded in nsCSSStyleSheet methods but not where one can get at
it.

I would like to generalize this logic so it is available to all
non-style rules - if you look through nsCSSRules.cpp you will see that
many of them do not implement SetCssText, and this looks like the major
obstacle to me (we would also need to expose more CSSParserImpl methods,
but that's easy).  The most straightforward way to do that seems to be
to add GetCSSParsingEnvironment methods to nsCSSStyleSheet and
nsCSSRule - these could replace some of the existing code, at least for
DOMCSSDeclarationImpl.  Does anyone have a better idea?

I'm also not sure how to notify the world that the rule has changed.
There are nsCSSStyleSheet methods for that, but they're internal and
appear to be valid only for plain old style rules (I could be wrong).
Any help there would be appreciated.

Thanks,
zw
_______________________________________________
dev-tech-layout mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-layout

Reply via email to