Closed Bug 1964745 Opened 6 months ago Closed 5 months ago

:not(:has(~ .item > :nth-child(2)) not getting invalidated correctly (was: CSS not applying correctly when element added/removed)

Categories

(Core :: CSS Parsing and Computation, defect, P3)

Firefox 140
defect

Tracking

()

RESOLVED FIXED
140 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr128 --- wontfix
firefox138 --- wontfix
firefox139 --- wontfix
firefox140 --- wontfix
firefox141 --- fixed

People

(Reporter: ben.ashton, Assigned: dshin)

References

(Blocks 1 open bug, Regression, )

Details

(Keywords: regression)

Attachments

(2 files)

Attached file firefox-bug.html

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0

Steps to reproduce:

  1. Use the following CSS to give an "item" a blue background whenever it is not followed by another item that has at least two children:

.item:not(:has(~ .item > :nth-child(2))) {
background: blue;
}

  1. Add/remove items with two children

Actual results:

When adding/removing items, the styling of dependent items does not update until some other change is made. Various actions can cause the styling to update like inspecting the element, resizing the browser window (only works sometimes), or adding/removing stylesheets.

Please see the attached minimal reproduction which includes buttons to add/remove an element, and refresh the styles.

Expected results:

When adding/removing items, the styling of dependent items should update immediately

Forgot to mention, if you uncomment the empty CSS rule in the attached file, that magically fixes the problem.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Blocks: has-issues
URL: :dshin
Severity: -- → S3
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Summary: CSS not applying correctly when element added/removed → :not(:has(~ .item > :nth-child(2)) not getting invalidated correctly (was: CSS not applying correctly when element added/removed)

Set release status flags based on info from the regressing bug 1853258

:dshin, since you are the author of the regressor, bug 1853258, could you take a look?

For more information, please visit BugBot documentation.

Ah, the :has optimization path should not be taken if we find any unknown match.

Flags: needinfo?(dshin)

Previous behaviour where we did not do compound matching is incorrect, but the
order invalidations are added bailed us out (Which makes it fragile).
Add a way to skip this "pull-up" behaviour for indexing selectors, since
element's poisition matters.

Assignee: nobody → dshin
Status: NEW → ASSIGNED
Pushed by dshin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9a06e070b01f Tighten down when relative selector invalidation is "pulled up" for optimization. r=firefox-style-system-reviewers,emilio
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/52558 for changes under testing/web-platform/tests
Status: ASSIGNED → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → 140 Branch
Upstream PR merged by moz-wptsync-bot

Perfherder has detected the following talos performance change. Do you think push 9a06e070b01f1b1f12a028220a940563efb6de75 could have caused it? At the moment some jobs are failing to run and it looks like either this bug or Bug 1966190 could have caused these regressions:

Regressions:

Ratio Test Platform Options Absolute values (old vs new)
28% perf_reftest_singletons append-nth-edge-has-pseudo.html windows11-64-24h2-shippable e10s fission stylo webrender 4.41 -> 5.63
27% perf_reftest_singletons append-nth-edge-has-pseudo.html linux1804-64-shippable-qr e10s fission stylo webrender 15.14 -> 19.24
27% perf_reftest_singletons append-nth-edge-has-pseudo.html linux1804-64-shippable-qr e10s fission stylo webrender 14.93 -> 18.91
25% perf_reftest_singletons append-nth-edge-has-pseudo.html macosx1470-64-shippable e10s fission stylo webrender 8.40 -> 10.53
22% perf_reftest_singletons remove-front-has-pseudo.html linux1804-64-shippable-qr e10s fission stylo webrender 1.51 -> 1.84
22% perf_reftest_singletons remove-front-has-pseudo.html macosx1470-64-shippable e10s fission stylo webrender 1.12 -> 1.37
18% perf_reftest_singletons remove-front-has-pseudo.html windows11-64-24h2-shippable e10s fission stylo webrender 0.56 -> 0.66

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

Flags: needinfo?(dshin)

Hmm. I'll have to investigate.

That said, this was an issue of correctness, so it may be something we have to take as a loss.
Further, bug 1875081 and bug 1874066 added these tests as part of bugs that caused delays in orders of seconds - I don't see such delay on today's Nightly, so I don't think it'll be a huge issue.

QA Whiteboard: [qa-triage-done-c141/b140]
Regressions: 1969476
Flags: needinfo?(dshin)
Regressions: 1971486
Pushed by dmeehan@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c23d3bffa761 https://hg.mozilla.org/releases/mozilla-beta/rev/7b3263ac6138 Revert "Bug 1964745: Tighten down when relative selector invalidation is "pulled up" for optimization. r=firefox-style-system-reviewers,emilio" for causing Bug 1971486
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: