CSS styles under :not(:not(:x-of-type)) does not apply unless "flushed"
Categories
(Core :: CSS Parsing and Computation, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr115 | --- | unaffected |
| firefox-esr128 | --- | fixed |
| firefox131 | --- | wontfix |
| firefox132 | --- | wontfix |
| firefox133 | --- | fixed |
People
(Reporter: ed7-aspire4925, Assigned: zrhoffman)
References
(Regression)
Details
(Keywords: regression)
Attachments
(3 files, 1 obsolete file)
|
749 bytes,
text/html
|
Details | |
|
348 bytes,
text/html
|
Details | |
|
48 bytes,
text/x-phabricator-request
|
RyanVM
:
approval-mozilla-esr128+
|
Details | Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0
Firefox for Android
Steps to reproduce:
- On a fresh instance, open: https://ed7n.github.io/net-viewer
- Toggle the menu item: View -> Controls
- Resize the viewport to toggle between desktop and mobile modes.
Actual results:
- The control panel does not disappear on startup.
- Toggling said menu item does not affect the visibility of the panel.
- Resizing the viewport fixes the issue, and it persists when resizing back.
Expected results:
- The control panel should disappear on startup.
- Toggling said menu item should affect the visibility of the panel.
The CSS definition of interest:
article.no-panels
> section:not(:first-of-type):not(:last-of-type)
> section:not(:not(:first-of-type):not(:last-of-type)) {
display: none;
}
The Controls menu item toggles the .no-panels class in the article element.
In addition to resizing the viewport to toggle the CSS media rules,
if one were to duplicate the above definition with the Style Editor, then the style applies as it should.
It seems that the style is applied only if some sort of style cache is rebuilt.
For reference, the behavior is correct as of Chromium, Version 129.0.6668.100 (Official Build, ungoogled-chromium) (64-bit).
For reference:
- The behavior is likewise incorrect on Fennec F-Droid, 129.0.2 (Built #1290220).
- The behavior is correct on Chromium, Version 129.0.6668.100 (Official Build, ungoogled-chromium) (64-bit).
- The behavior is correct on Android System WebView, 129.0.6668.100.
Comment 4•1 year ago
|
||
Comment 5•1 year ago
|
||
Set release status flags based on info from the regressing bug 1837351
:zrhoffman, since you are the author of the regressor, bug 1837351, could you take a look?
For more information, please visit BugBot documentation.
| Assignee | ||
Comment 6•1 year ago
|
||
Thanks for pointing to the problematic CSS selector, it made coming up with a reduced testcase much easier!
Confirmed that commenting out the if statement that skips positional pseudo-class matching during invalidation (https://searchfox.org/mozilla-central/rev/faa7b1b2a7b5/servo/components/selectors/matching.rs#1311-1318) makes the testcase work as expected (with a significant performance cost).
David has significantly improved positional pseudo-class invalidation and expanded on that check more recently than bug 1837351. David, do you know what's making invalidation fail in bug 1926164? :)
| Assignee | ||
Comment 7•1 year ago
|
||
Added a testcase with more delay to keep the testcase from being intermittent.
Updated•1 year ago
|
Comment 8•1 year ago
•
|
||
Hrm, that's unfortunate.
In the context of invalidation, we pretend these indexed selectors always match, so that the invalidation machinery just marks them for invalidation without doing expensive indexing math (At the cost of over-invalidation).
We account for :not by flipping the result so that it returns True in the context outside of that negation. The problem is of course there being another negation, which flips the result to False and we skip invalidating it.
For these selectors, we need :not(:not(<...>:first-of-type<..>)) to return matching regardless of the depth of nesting.
This sliped through because we only do matching with potential unknown results when we move on invalidating from an inner selector to an outer selector e.g. In .foo :is(.bar .baz) .baa:first-of-type, we invalidate on .bar class change down to .baz, then check to see if the outer selector's matching result changes.
EDIT: Whoops, I put one too many :not there to make it work. Basically, nesting odd numbers of :not will make it work, even numbers will not.
Updated•1 year ago
|
| Assignee | ||
Comment 9•1 year ago
•
|
||
(In reply to David Shin[:dshin] from comment #8)
Basically, nesting odd numbers of
:notwill make it work, even numbers will not.
Yep you are right, hard-coding in_negation as true was breaking invalidation. https://searchfox.org/mozilla-central/rev/6ec81d7b1d2f/servo/components/selectors/context.rs#365
Patch incoming...
| Assignee | ||
Comment 10•1 year ago
|
||
in_negation was true in cases where it should be false, like
:not(:not(...)).
Updated•1 year ago
|
Comment 11•1 year ago
|
||
Comment 13•1 year ago
|
||
| bugherder | ||
Updated•1 year ago
|
Comment 16•1 year ago
|
||
Is this worth an ESR128 uplift? Not sure how common this is in the wild.
| Assignee | ||
Comment 17•1 year ago
|
||
(In reply to Ryan VanderMeulen [:RyanVM] from comment #16)
Is this worth an ESR128 uplift? Not sure how common this is in the wild.
Not sure how common it is in the wild, but because the fix is so trivial, it wouldn't hurt.
| Assignee | ||
Comment 18•1 year ago
|
||
Comment on attachment 9432720 [details]
Bug 1926164 - Negate in_negation when nesting r=dshin,#style
ESR Uplift Approval Request
- If this is not a sec:{high,crit} bug, please state case for ESR consideration: One-liner fix.
- User impact if declined: comment 0
- Fix Landed on Version: 133
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Trivial fix.
Comment 19•1 year ago
|
||
Comment on attachment 9432720 [details]
Bug 1926164 - Negate in_negation when nesting r=dshin,#style
Approved for 128.6esr.
Updated•1 year ago
|
Comment 20•1 year ago
|
||
| uplift | ||
Description
•