Closed
Bug 1468133
Opened 7 years ago
Closed 7 years ago
EnsureNonSVGUserAgentStyleSheetsLoaded looks pretty bogus and slow for the IsBeingUsedAsImage() case.
Categories
(Core :: CSS Parsing and Computation, enhancement, P3)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla62
Tracking | Status | |
---|---|---|
firefox62 | --- | fixed |
People
(Reporter: emilio, Assigned: emilio)
References
(Depends on 1 open bug, Blocks 2 open bugs)
Details
Attachments
(3 files)
59 bytes,
text/x-review-board-request
|
heycam
:
review+
|
Details |
806 bytes,
patch
|
heycam
:
review+
|
Details | Diff | Splinter Review |
1.54 KB,
patch
|
heycam
:
review+
|
Details | Diff | Splinter Review |
In the IsBeingUsedAsImage case, we pull from the category manager service and such, and start loading and parsing those as builtin "on-demand" UA sheets.
This has problems. As noted that needs to "append" to the UA sheet list. But right now we prepend and rely on loading it before other sheets.
However, nothing guarantees that we haven't loaded svg.css before (indeed we probably have), or any other sheet for that matter, so we're prepending those before the already-loaded ones. That looks bad.
Also, we're re-loading and reparsing the sheets even though nsStyleSheetService has a cached already-parsed copy of those. That's unnecessary work, cpu usage, and memory usage...
Assignee | ||
Comment 1•7 years ago
|
||
Actually, I wonder if that optimization is relevant anymore... This was done as part of bug 1008455 and similar followups. But that predates bug 77999, and the relevant UA stylesheet cache that we have:
https://searchfox.org/mozilla-central/rev/e6a0a192ea8691f7eb466506301da73fabe8fd23/servo/components/style/stylist.rs#65
I think we should try to remove it, that would fix, e.g., text-selection on Android, due to the accessible caret stuff...
Assignee | ||
Comment 2•7 years ago
|
||
I pushed the removal to awsy and talos: https://treeherder.mozilla.org/#/jobs?repo=try&revision=3cbd16216273eb9b2e48a250a98d8b02cf1613e8
So ni? myself to check it.
Flags: needinfo?(emilio)
Comment hidden (mozreview-request) |
Assignee | ||
Comment 4•7 years ago
|
||
Talos shows mostly noise on windows, nothing relevant otherwise. AWSY similarly nothing terrible, though it doesn't seem like the "image" test-cases were run, which are probably the interesting ones.
I forgot to repeat the talos runs, thus the noise, I'll try to push a better run, but I'm almost sure this is ok to remove nowadays :)
Flags: needinfo?(emilio)
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → emilio
Assignee | ||
Comment 5•7 years ago
|
||
Talos looks fine:
https://treeherder.mozilla.org/perf.html#/compare?originalProject=mozilla-central&newProject=try&newRevision=66314a598d526a27e88d442d8c949ee761e764f2&framework=1&showOnlyConfident=1&selectedTimeRange=172800
And no memory regression either:
https://treeherder.mozilla.org/perf.html#/compare?originalProject=mozilla-central&newProject=try&newRevision=66314a598d526a27e88d442d8c949ee761e764f2&framework=4&selectedTimeRange=172800
Updated•7 years ago
|
Priority: -- → P3
Comment 6•7 years ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #4)
> Talos shows mostly noise on windows, nothing relevant otherwise. AWSY
> similarly nothing terrible, though it doesn't seem like the "image"
> test-cases were run, which are probably the interesting ones.
Doesn't like in what way? Was there a regression? As you say, tests involving SVG images are probably relevant here...
Flags: needinfo?(emilio)
Assignee | ||
Comment 7•7 years ago
|
||
I didn't mention "doesn't like". I mentioned that there doesn't seem like they ran on the first place, but they did run on the push in comment 5, which shows no regression.
Flags: needinfo?(emilio)
Comment 8•7 years ago
|
||
Sorry, for some reason my brain skipped over the "seem" in your sentence, so I though I read that it doesn't like the tests!
Comment 9•7 years ago
|
||
mozreview-review |
Comment on attachment 8984799 [details]
Bug 1468133: Remove the optimization to lazily load non-SVG styles since it's not relevant anymore.
https://reviewboard.mozilla.org/r/250600/#review258064
Just to confirm, SVG as images will now load with a set of style sheets that will definitely use the same cached UA CasacadeData entry that we would get for a regular HTML document? r=me if so.
::: commit-message-af2b3:14
(Diff revision 1)
> +This makes me wonder whether we could remove the whole concept of on-demand UA
> +sheets, since they've caused pain, for example, when the frontend people try
> +loading <svg>s from NAC (since that triggers sheet loading from frame
> +construction, which is not good). I'm not concerned about loading mathml.css and
> +svg.css everywhere, though xul.css may not be as doable since it adds a bunch of
> +attribute-dependent selectors. Though on the other hand I asserted in the
> +xul.css code and we don't load it in content with <video> / <input
> +type="date/time/etc"> and such, afaict, so maybe now that legacy addons are gone
> +we can remove that sheet from content processes altogether. Maybe worth at least
> +filing a followup?
Filing a followup with the contents of this paragraph sounds good.
::: dom/svg/SVGDocument.cpp
(Diff revision 1)
> - EnsureOnDemandBuiltInUASheet(cache->NoFramesSheet());
> - }
> - if (nsLayoutUtils::ShouldUseNoScriptSheet(this)) {
> - EnsureOnDemandBuiltInUASheet(cache->NoScriptSheet());
> - }
> - EnsureOnDemandBuiltInUASheet(cache->UASheet());
There is a comment in ua.css "SVG documents don't always load this file [...]". Can you remove that?
And there are some rules that are duplicated from ua.css in svg.css. Can you remove those?
Attachment #8984799 -
Flags: review?(cam) → review+
Assignee | ||
Comment 10•7 years ago
|
||
(In reply to Cameron McCormack (:heycam) from comment #9)
> Comment on attachment 8984799 [details]
> Bug 1468133: Remove the optimization to lazily load non-SVG styles since
> it's not relevant anymore.
>
> https://reviewboard.mozilla.org/r/250600/#review258064
>
> Just to confirm, SVG as images will now load with a set of style sheets that
> will definitely use the same cached UA CasacadeData entry that we would get
> for a regular HTML document? r=me if so.
I think that's right as of this patch, but I don't think that's absolutely guaranteed right now given media queries in svg.css. Though right now we don't load svg.css upfront anywhere, that's about to change because it blocks the frontend team (see bug 1469176).
Still I think this patch is worth taking as-is. I can analyze the UA cache in the content process and try to optimize for it (in particular, it's not clear to me that the media-query introduced in bug 686581 is terribly useful, see Dao's and Roc's discussion at the end), but I don't think it should block this. wdyt?
Flags: needinfo?(cam)
Comment 11•7 years ago
|
||
Verifying that this is all sharing properly sounds fine to me, thanks!
Flags: needinfo?(cam)
Assignee | ||
Comment 12•7 years ago
|
||
I filed bug 1470143 for the sharing stuff.
Comment hidden (mozreview-request) |
Assignee | ||
Comment 14•7 years ago
|
||
Had to do this as well to avoid calling nsPermissionManager early on when loading SVG images, since it was hitting some assertions. It effectively preserves the existing behavior, though I can also change AllowXULXBL if you prefer.
Attachment #8986774 -
Flags: review?(cam)
Assignee | ||
Comment 15•7 years ago
|
||
Just to avoid a few assertions for AllowXULXBL now returning true, but LoadsXULStyleSheetUpFront being false. No behavior change. Before this bug the elements would be equally unstyled.
I can also just annotate the assertions if preferred, they're quite niche:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=e8ddcc193db19d06aa0ab7c0e7027cb16a98be6b&selectedJob=184185578
Attachment #8986832 -
Flags: review?(cam)
Updated•7 years ago
|
Attachment #8986774 -
Flags: review?(cam) → review+
Updated•7 years ago
|
Attachment #8986832 -
Flags: review?(cam) → review+
Comment 16•7 years ago
|
||
Pushed by emilio@crisal.io:
https://hg.mozilla.org/integration/mozilla-inbound/rev/4c8f6b544de1
Remove the optimization to lazily load non-SVG styles since it's not relevant anymore. r=heycam
![]() |
||
Comment 17•7 years ago
|
||
From the commit message:
> The performance impact of having to lookup through more rules should
> be minimal given the bloom filter and the rule hash optimizations.
Fingers crossed. :)
> I asserted in the xul.css code and
> we don't load it in content with <video> /
> <input type="date/time/etc"> and such, afaict, so maybe now that
> legacy addons are gone we can remove that sheet from content processes
> altogether.
The purpose of minimal-xul.css is to have all the rules that HTML/SVG needs in order to function correctly (scrollbars, form controls, etc.). So we shouldn't need xul.css in the content process other than to continue supporting the pref dom.allow_XUL_XBL_for_file.
Comment 18•7 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox62:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in
before you can comment on or make changes to this bug.
Description
•