Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1f4a1bf5458ebec31d9a3fb2f67504f9c4d92513
https://github.com/WebKit/WebKit/commit/1f4a1bf5458ebec31d9a3fb2f67504f9c4d92513
Author: Ahmad Saleem <[email protected]>
Date: 2026-09-03 (Thu, 03 Sep 2026)
Changed paths:
A
LayoutTests/compositing/layer-creation/no-compositing-for-overlapping-negative-z-siblings-expected.txt
A
LayoutTests/compositing/layer-creation/no-compositing-for-overlapping-negative-z-siblings.html
A
LayoutTests/compositing/z-order/multiple-negative-z-in-stacking-context-above-composited-expected.html
A
LayoutTests/compositing/z-order/multiple-negative-z-in-stacking-context-above-composited.html
A
LayoutTests/compositing/z-order/negative-z-in-stacking-context-above-composited-expected.html
A
LayoutTests/compositing/z-order/negative-z-in-stacking-context-above-composited.html
A
LayoutTests/compositing/z-order/negative-z-overlap-and-non-overlap-with-composited-expected.html
A
LayoutTests/compositing/z-order/negative-z-overlap-and-non-overlap-with-composited.html
M Source/WebCore/rendering/LayerOverlapMap.cpp
Log Message:
-----------
Negative z-index layer inside stacking context fails to composite when
overlapping external composited layer
https://bugs.webkit.org/show_bug.cgi?id=272318
rdar://130595406
Reviewed by Matt Woodrow.
REGRESSION (249828@main, 254746@main).
When a layer has negative z-order children and isn't yet composited, we push a
speculative
compositing container onto the overlap map (254746@main, bug 244543), which
keeps those children
from polluting the overlap map and causing unnecessary compositing of later
siblings. However,
overlapsLayers() then returned false unconditionally while the speculative
stack was live, which
prevents negative z-index children from detecting genuine overlap with layers
that were already
composited earlier in paint order.
This means a negative z-index child inside a z-index: 1 stacking context that
geometrically
overlaps a composited layer (z-index: auto/0) outside the stacking context
never gets
composited for overlap, so it paints into the root backing store behind the
composited
layer's GraphicsLayer - wrong stacking order.
The fix is to test against m_overlapStack.last() instead of returning false.
While a speculative
container is live, m_overlapStack.last() holds exactly the overlap state as of
the speculative
push: add() only ever writes to m_overlapStack[size - 2], and no container can
be pushed or popped
without first confirming or discarding the speculative stack. Negative z-order
children therefore
see the bounds of already-composited layers, but nothing contributed by the
speculative traversal
itself, so they still don't force each other to composite and the fix for bug
244543 is preserved.
no-compositing-for-overlapping-negative-z-siblings.html covers that half of the
behavior, which a
reference test cannot: two overlapping negative z-order children inside a
composited (non-root)
ancestor, overlapping nothing composited, must not create any layers.
Note the composited box in the reference tests is offset horizontally from the
stacking context:
the stacking contexts in these tests have no in-flow content, so their overlap
rect is an empty
rect inflated to 1x1 at their origin, and a composited box covering that point
would promote the
stacking context itself for overlap before its negative z-order children are
visited, making the
tests pass with or without this change.
* Source/WebCore/rendering/LayerOverlapMap.cpp:
(WebCore::LayerOverlapMap::overlapsLayers const):
*
LayoutTests/compositing/layer-creation/no-compositing-for-overlapping-negative-z-siblings-expected.txt:
Added.
*
LayoutTests/compositing/layer-creation/no-compositing-for-overlapping-negative-z-siblings.html:
Added.
*
LayoutTests/compositing/z-order/multiple-negative-z-in-stacking-context-above-composited-expected.html:
Added.
*
LayoutTests/compositing/z-order/multiple-negative-z-in-stacking-context-above-composited.html:
Added.
*
LayoutTests/compositing/z-order/negative-z-in-stacking-context-above-composited-expected.html:
Added.
*
LayoutTests/compositing/z-order/negative-z-in-stacking-context-above-composited.html:
Added.
*
LayoutTests/compositing/z-order/negative-z-overlap-and-non-overlap-with-composited-expected.html:
Added.
*
LayoutTests/compositing/z-order/negative-z-overlap-and-non-overlap-with-composited.html:
Added.
Canonical link: https://commits.webkit.org/320473@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications