Closed Bug 2078208 Opened 1 month ago Closed 1 month ago

[wpt-sync] Sync PR 63271 - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=325287

Categories

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

task

Tracking

()

RESOLVED FIXED
160 Branch
Tracking Status
firefox160 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Ahmad Saleem <ahmad.saleem792+github@gmail.com> wrote:

WebKit export of https://bugs.webkit.org/show_bug.cgi?id=325287

WebKit export from bug: @scope start (scoping root) selector matching drops style relations, so structural DOM mutations don't invalidate scope membership

<pre>
@scope start (scoping root) selector matching drops style relations, so structural DOM mutations don't invalidate scope membership

ElementRuleCollector::ruleMatches() merges the style relations recorded
during selector matching into m_styleRelations, which are later committed
(commitRelationsToRenderStyle / commitRelations) to set flags such as
childrenAffectedByForwardPositionalRules, styleAffectedByEmpty, and
childIndex on the relevant elements. ChildChangeInvalidation reads those
flags to decide whether a structural DOM mutation (child insertion or
removal) must re-evaluate positional or :empty selectors.

ElementRuleCollector::scopeRulesMatch() matches the @scope prelude
(scoping root) selector against ancestors using a local CheckingContext,
but never merged the style relations it accumulated into m_styleRelations.
As a result, when a scoping root selector used a structural pseudo-class
(:nth-child(), :empty, :first-child, ...), the corresponding affected-by
flags were never set, and a later structural mutation that changed which
element is a scoping root failed to invalidate, leaving stale styles.

Merge the style relations recorded while matching the scoping root
selector into m_styleRelations, mirroring ruleMatches(). Relations are
committed after each match (including non-matches, since those
dependencies still drive future invalidation) and the buffer is cleared
between calls to avoid duplicate accumulation in the reused context.

WebKit-Bug: <a href="https://bugs.webkit.org/show_bug.cgi?id=325287">https://bugs.webkit.org/show_bug.cgi?id=325287</a>
WebKit-Canonical-Link: <a href="https://commits.webkit.org/322680@main">https://commits.webkit.org/322680@main</a>
</pre>

Component: web-platform-tests → CSS Parsing and Computation
Product: Testing → Core

CI Results

Ran 11 Firefox configurations based on mozilla-central, and Firefox, Chrome, and Safari on GitHub CI

Total 159 tests

Status Summary

Firefox

OK : 1[GitHub] 102[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
PASS: 7[Gecko-linux2204-64-wayland-debug, Gecko-linux2204-64-wayland-opt] 31[GitHub] 1587[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 1627[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview] 1634[Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]
FAIL: 17[Gecko-windows11-32-25h2-debug, Gecko-windows11-32-25h2-opt] 20[Gecko-android-em-14-x86_64-debug-geckoview, Gecko-android-em-14-x86_64-lite-opt-geckoview, Gecko-android-em-14-x86_64-opt-geckoview, Gecko-linux2404-64-debug, Gecko-linux2404-64-opt, Gecko-windows11-64-25h2-debug, Gecko-windows11-64-25h2-opt]

Chrome

OK : 1
PASS: 31

Safari

OK : 1
PASS: 29
FAIL: 2

Links

Gecko CI (Treeherder)
GitHub PR Head
GitHub PR Base

Details

New Tests That Don't Pass

Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
You need to log in before you can comment on or make changes to this bug.