Load SVG (and other) UA StyleSheets dynamically when needed Hyatt would like to see a solution like this land before landing MathML support.
Created attachment 17645 [details] First attempt This patch implements the lazy loading of the svg sheet. I think it is the only UA sheet yet which can be treated that way. Note that the const MediaQueryEvaluator stuff is not essential, just seems clearer to me. Cheers, Rob.
Comment on attachment 17645 [details] First attempt +static const MediaQueryEvaluator screenEval("screen"); +static const MediaQueryEvaluator printEval("print"); We can't have global objects with constructors like these in WebKit -- causes a performance problem, especially on Mac OS X. You can instead put create functions that return the objects. +#if ENABLE(SVG) + if (e->isSVGElement() && !svgSheet) { + // SVG rules. + svgSheet = parseUASheet(svgUserAgentStyleSheet); + defaultStyle->addRulesFromSheet(svgSheet, &screenEval); + defaultPrintStyle->addRulesFromSheet(svgSheet, &printEval); + } +#endif int firstUARule = -1, lastUARule = -1; I think you need a blank line after the #endif review- because of the global initializers
Created attachment 17652 [details] Fixing the global ctor problem This should fix the global ctor efficiency problem. Cheers, Rob.
Comment on attachment 17652 [details] Fixing the global ctor problem How does this fix the global constructor problem? I don't see any change in that part of the patch. Maybe you accidentally re-posted the same patch?
Hi Darin, (In reply to comment #4) > (From update of attachment 17652 [details] [edit]) > How does this fix the global constructor problem? I don't see any change in > that part of the patch. Maybe you accidentally re-posted the same patch? Oops, you are right :( Will put up the one I intended. Cheers, Rob.
Created attachment 17653 [details] Really fix the global ctor problem This is the patch I meant to address Darins issues with my first attempt, ignore the previous attachment. Cheers, Rob.
Comment on attachment 17653 [details] Really fix the global ctor problem Looks fine, but I'm not happy with the trailing underscore naming scheme. In the past we've used the word static, like: static const MediaQueryEvaluator staticPrintEval("print"); Looks good. r=me
Landed in r28321.