Closed Bug 1849167 Opened 1 year ago Closed 1 year ago

[wpt-sync] Sync PR 41511 - [@scope] Save MatchFlags in StyleScopeActivations

Categories

(Core :: CSS Parsing and Computation, task, P4)

task

Tracking

()

RESOLVED FIXED
119 Branch
Tracking Status
firefox119 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Anders Hartvoll Ruud <andruud@chromium.org> wrote:

[@scope] Save MatchFlags in StyleScopeActivations

ComputedStyles that match pseudo-state-dependent selectors get
a flag set for invalidation purposes. For example:

p:hover { ... }

When matching this selector against 'p', the MatchResults will
contain MatchFlags with the kAffectedByHover flag set, regardless
of whether or not 'p' is currently hovered or not. (The flag
ultimately ends up on the ComputedStyle of 'p').

Now consider this @scope rule which selects the same element:

@scope (p:hover) {
:scope { ... }
}

Now we may or may not have a scoping root, depending on whether 'p'
is hovered or not. When matching this selector (:scope) against 'p',
we need to make sure that the kAffectedByHover is set in the returned
MatchFlags, even if 'p' is not currently hovered (in which case
we don't technically have a scoping root at 'p').

This means that we have to store the MatchFlags that was produced for
for the scopes that were attempted activated.

This is done in this CL by storing MatchFlags alongside the
activation vector, and propagating these flags during handling
of kScopeActivation. This may over-invalidate a little, since
we're propagating the flags at the start of the compound that
contains :scope (before actually evaluating :scope), but this is
probably OK.

Fixed: 1451091
Change-Id: Ia48664381766ef44e6ade11457e905f068b6103e
Reviewed-on: https://chromium-review.googlesource.com/4790441
WPT-Export-Revision: e9217780378cf57080af6965c83ce2596865186b

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core
Test result changes from PR not available.
Test result changes from PR not available.
Test result changes from PR not available.
Test result changes from PR not available.
Test result changes from PR not available.
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9d4118f7779b [wpt PR 41511] - [@scope] Save MatchFlags in StyleScopeActivations, a=testonly https://hg.mozilla.org/integration/autoland/rev/828401e37244 [wpt PR 41511] - Update wpt metadata, a=testonly
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 119 Branch
You need to log in before you can comment on or make changes to this bug.