Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix negative z-index layers from triggering unnecessary compositing o…
…f foreground layers. https://bugs.webkit.org/show_bug.cgi?id=244543 <rdar://99335877> Reviewed by Simon Fraser. We currently push a speculative compositing container onto the overlap stack when processing negative z-index children, in case any of them require compositing. We then pop it off it it doesn't get used. Unfortunately other mutations can happen to the overlap stack while it's pushed, and just popping the unused container isn't sufficient to restore this. This instead duplicates the overlap stack when we push a speculative compositing container, and makes any changes to both of them. Once we know which path is correct, we select the correct stack and throw away the duplicate. This fixes cases where negative z-index children weren't composited, but they ended up affecting overlaps of positive z-index children and making them composited unnecessarily. * LayoutTests/compositing/layer-creation/no-compositing-for-negative-z-sibling-expected.txt: Added. * LayoutTests/compositing/layer-creation/no-compositing-for-negative-z-sibling.html: Added. * Source/WebCore/rendering/LayerOverlapMap.cpp: (WebCore::OverlapMapContainer::isEmpty const): (WebCore::LayerOverlapMap::add): (WebCore::LayerOverlapMap::overlapsLayers const): (WebCore::LayerOverlapMap::pushCompositingContainer): (WebCore::LayerOverlapMap::pushSpeculativeCompositingContainer): (WebCore::LayerOverlapMap::confirmSpeculativeCompositingContainer): (WebCore::LayerOverlapMap::maybePopSpeculativeCompositingContainer): * Source/WebCore/rendering/LayerOverlapMap.h: * Source/WebCore/rendering/RenderLayerCompositor.cpp: (WebCore::RenderLayerCompositor::computeCompositingRequirements): Canonical link: https://commits.webkit.org/254746@main
- Loading branch information
Showing
9 changed files
with
244 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 8.00 8.00) | ||
(preserves3D 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 792.00 540.00) | ||
(drawsContent 1) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 8.00 8.00) | ||
(preserves3D 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 204.00 121.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 204.00 108.00) | ||
(drawsContent 1) | ||
(transform [5.00 0.00 0.00 0.00] [0.00 5.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00]) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>test</title> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
testRunner.dumpAsText(); | ||
} | ||
|
||
function doTest() | ||
{ | ||
document.getElementById('results').innerText = window.internals.layerTreeAsText(document); | ||
if (window.testRunner) { | ||
testRunner.notifyDone(); | ||
} | ||
} | ||
|
||
window.addEventListener('load', doTest, false); | ||
</script> | ||
</head> | ||
|
||
<body style="position:fixed"> | ||
<div id="container" style="transform-origin: left top; transform: scale(5); "> | ||
<div id="negative" style="position: relative; z-index: -1;"> | ||
<div style="position: relative; z-index:-1"></div> | ||
</div> | ||
<div id="positive" style="position: relative"> | ||
<iframe srcdoc="Hello, world" style="width: 200px; height: 100px;"></iframe> | ||
</div> | ||
</div> | ||
<pre id="results"></pre> | ||
</body> | ||
|
||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>test</title> | ||
<script> | ||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
testRunner.dumpAsText(); | ||
} | ||
|
||
function doTest() | ||
{ | ||
document.getElementById('results').innerText = window.internals.layerTreeAsText(document); | ||
if (window.testRunner) { | ||
testRunner.notifyDone(); | ||
} | ||
} | ||
|
||
window.addEventListener('load', doTest, false); | ||
</script> | ||
</head> | ||
|
||
<body style="position:fixed"> | ||
<div id="container" style="transform-origin: left top; transform: scale(5); "> | ||
<div id="negative" style="position: relative; z-index: -1;"></div> | ||
<div id="positive" style="position: relative"> | ||
<iframe srcdoc="Hello, world" style="width: 200px; height: 100px;"></iframe> | ||
</div> | ||
</div> | ||
<pre id="results"></pre> | ||
</body> | ||
|
||
</html> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 8.00 8.00) | ||
(preserves3D 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 792.00 545.00) | ||
(drawsContent 1) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
|
||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 800.00 600.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 800.00 600.00) | ||
(contentsOpaque 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(position 8.00 8.00) | ||
(preserves3D 1) | ||
(children 1 | ||
(GraphicsLayer | ||
(bounds 204.00 122.00) | ||
(children 1 | ||
(GraphicsLayer | ||
(anchor 0.00 0.00) | ||
(bounds 204.00 109.00) | ||
(drawsContent 1) | ||
(transform [5.00 0.00 0.00 0.00] [0.00 5.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00]) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters