Title: [281913] trunk
Revision
281913
Author
[email protected]
Date
2021-09-02 02:11:58 -0700 (Thu, 02 Sep 2021)

Log Message

Absolutely positioned and negative z-index div with canvas child gets drawn with wrong stacking order
https://bugs.webkit.org/show_bug.cgi?id=217154

Patch by Rob Buis <[email protected]> on 2021-09-02
Reviewed by Simon Fraser.

Source/WebCore:

Keep overlap map accurate.

Test: compositing/subtree-div-overlaps-multiple-negative-z-divs.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::computeCompositingRequirements):

LayoutTests:

Add test based on bug report test case.

* compositing/subtree-div-overlaps-multiple-negative-z-divs-expected.html: Added.
* compositing/subtree-div-overlaps-multiple-negative-z-divs.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (281912 => 281913)


--- trunk/LayoutTests/ChangeLog	2021-09-02 08:52:06 UTC (rev 281912)
+++ trunk/LayoutTests/ChangeLog	2021-09-02 09:11:58 UTC (rev 281913)
@@ -1,3 +1,15 @@
+2021-09-02  Rob Buis  <[email protected]>
+
+        Absolutely positioned and negative z-index div with canvas child gets drawn with wrong stacking order
+        https://bugs.webkit.org/show_bug.cgi?id=217154
+
+        Reviewed by Simon Fraser.
+
+        Add test based on bug report test case.
+
+        * compositing/subtree-div-overlaps-multiple-negative-z-divs-expected.html: Added.
+        * compositing/subtree-div-overlaps-multiple-negative-z-divs.html: Added.
+
 2021-09-01  Sonia Singla  <[email protected]>
 
         Replace webkit- prefix logical properties with Standard Properties in LayoutTests/

Added: trunk/LayoutTests/compositing/subtree-div-overlaps-multiple-negative-z-divs-expected.html (0 => 281913)


--- trunk/LayoutTests/compositing/subtree-div-overlaps-multiple-negative-z-divs-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/subtree-div-overlaps-multiple-negative-z-divs-expected.html	2021-09-02 09:11:58 UTC (rev 281913)
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div style="background:green;width:100px;height:100px"></div>

Added: trunk/LayoutTests/compositing/subtree-div-overlaps-multiple-negative-z-divs.html (0 => 281913)


--- trunk/LayoutTests/compositing/subtree-div-overlaps-multiple-negative-z-divs.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/subtree-div-overlaps-multiple-negative-z-divs.html	2021-09-02 09:11:58 UTC (rev 281913)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<style>
+.negative {
+  z-index: -1;
+}
+.abs {
+  position: absolute;
+}
+.green {
+  width: 100px;
+  height: 100px;
+  background-color: green;
+}
+
+.red {
+  width: 100px;
+  height: 100px;
+  background-color: red;
+  will-change: transform;
+}
+</style>
+<body>
+<div class="negative abs">
+  <div class="red"></div>
+</div>
+<div class="negative abs green"></div>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (281912 => 281913)


--- trunk/Source/WebCore/ChangeLog	2021-09-02 08:52:06 UTC (rev 281912)
+++ trunk/Source/WebCore/ChangeLog	2021-09-02 09:11:58 UTC (rev 281913)
@@ -1,3 +1,17 @@
+2021-09-02  Rob Buis  <[email protected]>
+
+        Absolutely positioned and negative z-index div with canvas child gets drawn with wrong stacking order
+        https://bugs.webkit.org/show_bug.cgi?id=217154
+
+        Reviewed by Simon Fraser.
+
+        Keep overlap map accurate.
+
+        Test: compositing/subtree-div-overlaps-multiple-negative-z-divs.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
+
 2021-09-02  Mark Lam  <[email protected]>
 
         Add more support for JIT operation validation testing.

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (281912 => 281913)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2021-09-02 08:52:06 UTC (rev 281912)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2021-09-02 09:11:58 UTC (rev 281913)
@@ -1098,16 +1098,19 @@
     bool anyDescendantHas3DTransform = false;
     bool descendantsAddedToOverlap = currentState.hasNonRootCompositedAncestor();
 
+    unsigned newlyCompositedChildLayerCount = 0;
     for (auto* childLayer : layer.negativeZOrderLayers()) {
         computeCompositingRequirements(&layer, *childLayer, overlapMap, currentState, backingSharingState, anyDescendantHas3DTransform);
 
         // If we have to make a layer for this child, make one now so we can have a contents layer
         // (since we need to ensure that the -ve z-order child renders underneath our contents).
-        if (!willBeComposited && currentState.subtreeIsCompositing) {
-            layer.setIndirectCompositingReason(IndirectCompositingReason::BackgroundLayer);
-            layerWillComposite();
-        }
+        if (!willBeComposited && currentState.subtreeIsCompositing)
+            ++newlyCompositedChildLayerCount;
     }
+    while (newlyCompositedChildLayerCount--) {
+        layer.setIndirectCompositingReason(IndirectCompositingReason::BackgroundLayer);
+        layerWillComposite();
+    }
 
     for (auto* childLayer : layer.normalFlowLayers())
         computeCompositingRequirements(&layer, *childLayer, overlapMap, currentState, backingSharingState, anyDescendantHas3DTransform);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to