Closed Bug 1764769 Opened 3 years ago Closed 3 years ago

[wpt-sync] Sync PR 33641 - CSS highlight inheritance: optimise content with universal rules

Categories

(Core :: Layout: Generated Content, Lists, and Counters, task, P4)

task

Tracking

()

RESOLVED FIXED
102 Branch
Tracking Status
firefox102 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream error])

Sync web-platform-tests PR 33641 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/33641
Details from upstream follow.

Delan Azabani <dazabani@igalia.com> wrote:

CSS highlight inheritance: optimise content with universal rules

Virtually all existing content uses only universal highlight rules
such as *::selection. Like all universal rules, this is inefficient
because any savings from copy-on-write field inheritance get blown
away when we reapply the same property values over and over.

This wasn’t so bad prior to HighlightInheritance, because highlight
styles were computed (a) lazily, and (b) only in “leaf” elements that
directly contain highlighted text nodes. On a release build, adding
a *::selection rule to a deeply nested test page used no more memory
if nothing was selected, and ~79 MiB more if everything was selected.

But with highlight inheritance, adding the same rule used ~132 MiB
more memory at all times, even if nothing was selected [1].

This patch adds DidMatchNonUniversalHighlights, a ComputedStyle extra
field that indicates whether any non-universal highlight rules matched
while resolving the current highlight styles. The flag is inherently
per-highlight-pseudo, because it’s set in the highlight ComputedStyle.
If both parent and child match only universal highlight rules, then we
skip reapplying the matched properties.

[1] https://crbug.com/1024156#c16

Bug: 1024156
Change-Id: I65ece030140648f9e86d3c409251e13b3f111039

Reviewed-on: https://chromium-review.googlesource.com/3581515
WPT-Export-Revision: 89389e72467d9b505b3561723a8b530bfe923ee2

Component: web-platform-tests → Layout: Generated Content, Lists, and Counters
Product: Testing → Core
Whiteboard: [wptsync downstream] → [wptsync downstream error]
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b5922fed403e [wpt PR 33641] - CSS highlight inheritance: optimise content with universal rules, a=testonly
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 102 Branch
You need to log in before you can comment on or make changes to this bug.