[wpt-sync] Sync PR 31504 - Support style invalidation of ':has()' in rightmost compound
Categories
(Core :: CSS Parsing and Computation, task, P4)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox96 | --- | fixed |
People
(Reporter: wpt-sync, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 31504 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/31504
Details from upstream follow.
Byungwoo Lee <blee@igalia.com> wrote:
Support style invalidation of ':has()' in rightmost compound
This is the initial CL of supporting style invalidation with ':has()'.
To minimize complexity, we will focus on the following limited usage.
- Supports ':has()' in a rightmost, top-level compound
- Supports ':has()' argument starts with child or descendant combinator
- Only allow attribute or elemental selectors in argument
So the following will be ignored for now.
- Ignore ':has()' in a non-rightmost compound
- Ignore ':has()' in a logical combinations
- Ignore ':has()' argument starts with '~' or '+'
- Ignore all pseudos in ':has()' argument
To support this case, for a change on an element, we need to invalidate
ancestors.Invalidate every ancestors for every mutations on every element is very
bad for performance.So we need a way to skip these.
- irrelevant element
- irrelevant ancestor
- irrelevant mutation
To skip the 'irrelevant element' and 'irrelevant ancestor', this CL
introduces two flags in the ComputedStyle.
- AffectingHas : Indicate that a mutation on the element can affect
':has()' state.- AffectedByHas : Indicate that the element can be affected by ':has()'
state changeDuring style recalculation, 'AffectedByHas' flag will be set when
SelectorChecker tries to match any ':has()' selector on an element.
For every descendants of the element, the 'AffectedByHas' flag will
be changed to 'AffectingHas' flag and stored.\<style> .a:has(.b) { color: red }\</style>
\<div>
\<div class="a"> \<!-- AffectedByHas -->
\<div> \<!-- AffectingHas -->
\<div> \<!-- AffectingHas -->
\</div>
\</div>
\</div>
\<div>
\<div>
\</div>
\</div>
\</div>Only for a mutation on the element with 'AffectingHas', style engine
will walk up ancestors. And it invalidate style only when an ancestor
has 'AffectedByHas'Still we have invalidation for irrelevant mutation and invalidation on
irrelevant ancestors. We will handle those by separate CLs.Bug: 669058
Change-Id: Ia7e607e01f9a070c0d69d89679b99efa0a104797
Reviewed-on: https://chromium-review.googlesource.com/3260677
WPT-Export-Revision: e86db0a1e7cb2bec18776d2cbb123cdc2253af88
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Comment 1•4 years ago
|
||
| Assignee | ||
Comment 2•4 years ago
|
||
CI Results
Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI
Total 1 tests and 19 subtests
Status Summary
Firefox
OK : 1
PASS: 12
FAIL: 7
Chrome
OK : 1
PASS: 12
FAIL: 7
Safari
OK : 1
PASS: 12
FAIL: 7
Links
Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base
Details
New Tests That Don't Pass
/css/selectors/invalidation/attribute-or-elemental-selectors-in-has.html
add .child to #div_child: div#div_subject.color: FAIL (Chrome: FAIL, Safari: FAIL)
add .descendant to #div_child: div#div_subject.color: FAIL (Chrome: FAIL, Safari: FAIL)
add .descendant to #div_grandchild: div#div_subject.color: FAIL (Chrome: FAIL, Safari: FAIL)
set descendant to #div_grandchild[attrname]: div#div_subject.color: FAIL (Chrome: FAIL, Safari: FAIL)
change #div_grandchild to #div_descendant: div#div_subject.color: FAIL (Chrome: FAIL, Safari: FAIL)
add descendant to #div_subject: div#div_subject.color: FAIL (Chrome: FAIL, Safari: FAIL)
add "div > descendant" to #div_subject: div#div_subject.color: FAIL (Chrome: FAIL, Safari: FAIL)
Comment 4•4 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/20439ad7dd9d
https://hg.mozilla.org/mozilla-central/rev/532ddd3c5b9c
Description
•