Open Bug 1809505 Opened 2 years ago Updated 1 year ago

Style containment not working well with counters on pseudo-elements

Categories

(Core :: Layout: Generated Content, Lists, and Counters, defect)

defect

Tracking

()

People

(Reporter: Oriol, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

Attached file style-containment.html (obsolete) —

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]
Attached file style-containment.html

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]
Attachment #9311606 - Attachment is obsolete: true

Reproduced on nightly 110

Severity: -- → S2
Severity: S2 → S3

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.

Flags: needinfo?(mrobinson)

Sure. I can take a look at this failure.

Flags: needinfo?(mrobinson)

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. :(

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: