Style containment not working well with counters on pseudo-elements
Categories
(Core :: Layout: Generated Content, Lists, and Counters, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox137 | --- | fixed |
People
(Reporter: Oriol, Assigned: emilio)
References
Details
Attachments
(3 files, 1 obsolete file)
Load attached testcase.
Expected:
[::before=0]
1. [::before=1][::after=1]
[::before=0] <-- Here
1. [::before=1][::after=1]
[::after=1]
2. [::before=2][::after=2]
[::after=2]
Actual:
[::before=0]
1. [::before=1][::after=1]
[::before=1] <-- Here
1. [::before=1][::after=1]
[::after=1]
2. [::before=2][::after=2]
[::after=2]
Also, layout is not stable. if then I run
var div = document.querySelector("div");
div.style.display = "none";
div.offsetLeft;
div.style.display = "";
it becomes
[::before=0]
1. [::before=1][::after=1]
[::before=2] <-- Here
1. [::before=1][::after=1]
[::after=1]
2. [::before=2][::after=2]
[::after=2]
| Reporter | ||
Comment 1•3 years ago
|
||
I forgot about https://drafts.csswg.org/css-contain/#containment-style
the counter() and counters() value of the content property is not itself scoped, and can refer to counters established outside of the subtree.
So the initial result is actually good. I'm attaching a better testcase with counters().
[::before=0]
1. [::before=1][::after=1]
[::before=1]
1. [::before=1.1][::after=1.1]
[::after=1.1]
2. [::before=2][::after=2]
[::after=2]
But when I run the JS, it wrongly becomes
[::before=0]
1. [::before=1][::after=1]
[::before=2]
1. [::before=2.1][::after=2.1]
[::after=2.1]
2. [::before=2][::after=2]
[::after=2]
Updated•3 years ago
|
| Assignee | ||
Comment 3•3 years ago
|
||
Martin, do you have cycles to take a look at this? No big deal if not but it seems it might not be too hard to address.
Comment 5•2 years ago
|
||
Please accept my apologies for dropping the ball on this issue. I think that I may not have time to tackle it in the short term. :(
Comment 7•1 year ago
|
||
emilio, maybe you can pick this up if/when you have cycles? Sounded like in comment 3 like it might be a relatively straightforward fix. (We just got what-seems-to-be-a-dupe filed in bug 1934755, so it seems to be something that folks have stumbled over in the wild in at least that one instance.)
| Assignee | ||
Comment 8•1 year ago
|
||
The binary search gives us the first node after the insertion point.
We want the preceding one.
Updated•1 year ago
|
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 9•1 year ago
|
||
This was useful for debugging.
Comment 11•1 year ago
|
||
Comment 12•1 year ago
|
||
Comment 13•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/8bca57a930cc
https://hg.mozilla.org/mozilla-central/rev/453067fa6fa0
Description
•