Open Bug 1869540 Opened 1 year ago Updated 6 months ago

Elements inside a container are rendered on top of the positioned element with the higher z-index

Categories

(Core :: Web Painting, defect, P1)

Firefox 120
Unspecified
All
defect

Tracking

()

ASSIGNED
Tracking Status
firefox-esr115 --- fix-optional
firefox120 --- wontfix
firefox121 --- wontfix
firefox122 --- wontfix
firefox123 --- wontfix
firefox124 --- wontfix
firefox125 --- wontfix

People

(Reporter: yuzvik.oleg, Assigned: tnikkel, NeedInfo)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(2 files, 1 obsolete file)

Attached file firefox-bug-reduced-demo.html (obsolete) —

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Steps to reproduce:

Tried to open a modal dialog (with overlay) by clicking on a button in a web app I am working on

Actual results:

The dialog and overlay were shown but some elements on the page were painted on top of the overlay even though the overlay is positioned and has high z-index set

Expected results:

elements that were painted on top of the overlay should have been painted under the overlay instead

Attachment #9368175 - Attachment is obsolete: true
OS: Unspecified → macOS
Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
Keywords: regression
OS: macOS → All
Regressed by: 1801123

:emilio, since you are the author of the regressor, bug 1801123, could you take a look? Also, could you set the severity field?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)

This reproduces also just with contain: paint, not container-type in particular.

With a bit more reduced / backward-compatible test-case, I got to this regression range: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=4a692c812a3fe2f893d2a6e25b9490b38415c907&tochange=0969fd6383cea58141d70fbb2d0895ccb476af6c

Unfortunately builds are too old to bisect further and there are a couple suspects (bug 1535507, bug 205202). If I had to guess it'd be the first of those two.

Alice, by any chance, wouldn't you have builds for that range?

Thanks in any case for doing the initial bisection!

Status: UNCONFIRMED → NEW
Component: CSS Parsing and Computation → Web Painting
Ever confirmed: true
Flags: needinfo?(emilio) → needinfo?(alice0775)
No longer regressed by: 1801123

Ah, bug 1535507 most definitely. Specially given this also reproduces with things like will-change: perspective and so.

Regressed by: 1535507

Tim do you know who might be familiar with RDL nowadays?

Flags: needinfo?(tnikkel)

Thanks Alice!

As a workaround, adding a no-op transform like scale: 1 or so fixes it (though that's of course not amazing).

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

Severity: -- → S3

(In reply to Emilio Cobos Álvarez (:emilio) from comment #9)

Thanks Alice!

As a workaround, adding a no-op transform like scale: 1 or so fixes it (though that's of course not amazing).

Thanks for the workaround, Emilio! I added transform: scale(1,1) (not scale: 1 because it doesn't seem to work in JSX's style property) to the container (outermost element with container-type property set) and the problem is gone.

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

I think I know what the problem is, from the commit of the regressing patch:

"If the frame supports it (stacking context + containing block for fixed), and a descendant was
modified, we would have created an override dirty region with just the area of that descendant.
In the case where no descendants are modified, we should use an empty rect, rather than
the area inherited from our parent.

This fixes the case where we forcibly build position:fixed frames (since they might async
scroll differently to the rest of the page), but we only need to build the container item,
not the whole frame subtree within it."

The nsDisplayContainer that contains the contain: paint div here is getting this optimization, it is getting an empty dirty rect on a partial update, which causes us to not build any of its children. The optimization works for fixed pos because we always create a fixed container item in BuildDisplayListForStackingContext. For non-fixed pos we don't always build a nsDisplayContainer, that decision is made here

https://searchfox.org/mozilla-central/rev/5d6e8d45a5cf4bdfa02b6187bde53f2d42f40be2/layout/generic/nsIFrame.cpp#4322

In this case the list is empty so we don't build anything. Forcing us to build an empty nsDisplayContainer there if we hit the "empty dirty rect" optimization fixes the bug. But I'm not sure if that alone is a landable fix because the logic in WrapInWrapList tries to avoid creating container items if it can, so that might change the display item we get there without marking it modified in a partial update, which we cannot do. I'll think more on this.

@tnikkel:

  1. How hard is this to fix?
  2. Can you prioritize fixing it?
Severity: S3 → S2

Keeping this on Tim's radar while he's addressing higher-priority issues.

(In reply to Kelsey Gilbert [:jgilbert] from comment #14)

@tnikkel:

  1. How hard is this to fix?

Probably not that hard, the next step is in comment 13, I just need to spend some time reading the code and thinking through it.

  1. Can you prioritize fixing it?

Yes, I definitely want to come back to this and finish it up. I've been treating this as an S3 since this issue was discovered over 4 years after the regressing bug landed, so it's probably not a very common issue. Is the S2 bump coming from bug 1865374 (which this bug blocks)? I'm not sure that bug qualifies for S2.

Flags: needinfo?(jgilbert)

Well there is a workaround in comments 9 and 11, so it's probably not dire, but this is still pretty clear-cut rendering correctness issue.
Up to you, but if you're happy with S3 that's fine too.

Flags: needinfo?(jgilbert)
Assignee: nobody → tnikkel
Severity: S2 → S3
Status: NEW → ASSIGNED
Priority: -- → P1

Tim, let's evaluate the P1 priority for this one at our next Priority review.

See Also: → 1811099
Duplicate of this bug: 1811099
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: