Title: [239146] trunk
Revision
239146
Author
simon.fra...@apple.com
Date
2018-12-12 18:35:10 -0800 (Wed, 12 Dec 2018)

Log Message

REGRESSION (r238357): Pins on Yelp map disappear
https://bugs.webkit.org/show_bug.cgi?id=192597
rdar://problem/46578285

Reviewed by Zalan Bujtas.
Source/WebCore:

RenderLayerCompositor::updateBackingAndHierarchy() had a bug where if a RenderLayer gained
a negative z-order child (triggering creation of a foreground layer), we'd fail to
call the "setChildren()" with the vector containing that foreground layer.

When updateBackingAndHierarchy() stops visiting descendants because none are composited,
it may still have to update the child list with the foreground layer, so make sure
the code handles this case.

Tests: compositing/z-order/add-negative-z-child.html
       compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer.html

* rendering/RenderLayer.cpp:
(WebCore::outputPaintOrderTreeRecursive):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateBackingAndHierarchy):

LayoutTests:

Add tests that toggle negative z-index on a child, with and without sibling compositing layers.

* compositing/z-order/add-negative-z-child-expected.html: Added.
* compositing/z-order/add-negative-z-child.html: Added.
* compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer-expected.html: Added.
* compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (239145 => 239146)


--- trunk/LayoutTests/ChangeLog	2018-12-13 02:34:19 UTC (rev 239145)
+++ trunk/LayoutTests/ChangeLog	2018-12-13 02:35:10 UTC (rev 239146)
@@ -1,3 +1,18 @@
+2018-12-12  Simon Fraser  <simon.fra...@apple.com>
+
+        REGRESSION (r238357): Pins on Yelp map disappear
+        https://bugs.webkit.org/show_bug.cgi?id=192597
+        rdar://problem/46578285
+
+        Reviewed by Zalan Bujtas.
+        
+        Add tests that toggle negative z-index on a child, with and without sibling compositing layers.
+
+        * compositing/z-order/add-negative-z-child-expected.html: Added.
+        * compositing/z-order/add-negative-z-child.html: Added.
+        * compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer-expected.html: Added.
+        * compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer.html: Added.
+
 2018-12-12  YUHAN WU  <yuhan...@apple.com>
 
         Implement non-timeslice mode encoding for MediaRecorder

Added: trunk/LayoutTests/compositing/z-order/add-negative-z-child-expected.html (0 => 239146)


--- trunk/LayoutTests/compositing/z-order/add-negative-z-child-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/z-order/add-negative-z-child-expected.html	2018-12-13 02:35:10 UTC (rev 239146)
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .box {
+            position: absolute;
+            width: 200px;
+            height: 200px;
+            background-color: red;
+        }
+        
+        .composited {
+            transform: translateZ(1px);
+        }
+        
+        .negative {
+            z-index: -1;
+        }
+
+        .positive {
+            z-index: 1;
+            background-color: green;
+        }
+    </style>
+</head>
+<body>
+    <p>You should see a green box below.</p>
+    <div class="composited box">
+        <div class="negative box"></div>
+        <div class="positive box"></div>
+    </div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/z-order/add-negative-z-child.html (0 => 239146)


--- trunk/LayoutTests/compositing/z-order/add-negative-z-child.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/z-order/add-negative-z-child.html	2018-12-13 02:35:10 UTC (rev 239146)
@@ -0,0 +1,48 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <meta charset="utf-8">
+    <style>
+        
+        .box {
+            position: absolute;
+            width: 200px;
+            height: 200px;
+            background-color: red;
+        }
+        
+        .composited {
+            transform: translateZ(1px);
+        }
+        
+        .negative {
+            z-index: -1;
+        }
+
+        .positive {
+            z-index: 1;
+            background-color: green;
+        }
+    </style>
+    
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        window.addEventListener('load', () => {
+            requestAnimationFrame(() => {
+                document.getElementById('target').classList.add('negative');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            });
+        }, false);
+    </script>
+</head>
+<body>
+    <p>You should see a green box below.</p>
+    <div class="composited box">
+        <div id="target" class="box"></div>
+        <div class="positive box"></div>
+    </div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer-expected.html (0 => 239146)


--- trunk/LayoutTests/compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer-expected.html	2018-12-13 02:35:10 UTC (rev 239146)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .container {
+            position: relative;
+            margin: 20px;
+        }
+        .box {
+            position: absolute;
+            top: 0;
+            left: 0;
+            width: 200px;
+            height: 200px;
+            background-color: silver;
+        }
+        .composited {
+            transform: translateZ(1px);
+        }
+        .sibling {
+            top: 300px;
+            background-color: gray;
+        }
+        .negative {
+            z-index: -1;
+            background-color: red;
+        }
+        .positive {
+            z-index: 1;
+            background-color: green;
+        }
+    </style>
+</head>
+<body>
+    <div class="container">
+        <div class="composited child box">
+            <div class="negative box"></div>
+            <div class="composited positive box"></div>
+        </div>
+        <div id="target" class="composited sibling box"></div>
+    </div>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer.html (0 => 239146)


--- trunk/LayoutTests/compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer.html	2018-12-13 02:35:10 UTC (rev 239146)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        .container {
+            position: relative;
+            margin: 20px;
+        }
+        .box {
+            position: absolute;
+            top: 0;
+            left: 0;
+            width: 200px;
+            height: 200px;
+            background-color: silver;
+        }
+        .composited {
+            transform: translateZ(1px);
+        }
+        .sibling {
+            top: 300px;
+            background-color: gray;
+        }
+        .negative {
+            z-index: -1;
+            background-color: red;
+        }
+        .positive {
+            z-index: 1;
+            background-color: green;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        window.addEventListener('load', () => {
+            setTimeout(() => {
+                document.getElementById('target').classList.add('composited');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            }, 1000);
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="container">
+        <div class="composited child box">
+            <div class="negative box"></div>
+            <div class="composited positive box"></div>
+        </div>
+        <div id="target" class="sibling box"></div>
+    </div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (239145 => 239146)


--- trunk/Source/WebCore/ChangeLog	2018-12-13 02:34:19 UTC (rev 239145)
+++ trunk/Source/WebCore/ChangeLog	2018-12-13 02:35:10 UTC (rev 239146)
@@ -1,3 +1,27 @@
+2018-12-12  Simon Fraser  <simon.fra...@apple.com>
+
+        REGRESSION (r238357): Pins on Yelp map disappear
+        https://bugs.webkit.org/show_bug.cgi?id=192597
+        rdar://problem/46578285
+
+        Reviewed by Zalan Bujtas.
+
+        RenderLayerCompositor::updateBackingAndHierarchy() had a bug where if a RenderLayer gained
+        a negative z-order child (triggering creation of a foreground layer), we'd fail to 
+        call the "setChildren()" with the vector containing that foreground layer.
+        
+        When updateBackingAndHierarchy() stops visiting descendants because none are composited,
+        it may still have to update the child list with the foreground layer, so make sure
+        the code handles this case.
+
+        Tests: compositing/z-order/add-negative-z-child.html
+               compositing/z-order/rebuild-sibling-of-layer-with-foreground-layer.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::outputPaintOrderTreeRecursive):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateBackingAndHierarchy):
+
 2018-12-12  YUHAN WU  <yuhan...@apple.com>
 
         Implement non-timeslice mode encoding for MediaRecorder

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (239145 => 239146)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-12-13 02:34:19 UTC (rev 239145)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-12-13 02:35:10 UTC (rev 239146)
@@ -6702,7 +6702,10 @@
 
     auto layerRect = layer.rect();
 
-    stream << &layer << " " << layerRect << " " << layer.name();
+    stream << &layer << " " << layerRect;
+    if (layer.isComposited())
+        stream << " (layerID " << layer.backing()->graphicsLayer()->primaryLayerID() << ")";
+    stream << " " << layer.name();
     stream.nextLine();
 
     const_cast<WebCore::RenderLayer&>(layer).updateLayerListsIfNeeded();

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (239145 => 239146)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-12-13 02:34:19 UTC (rev 239145)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-12-13 02:35:10 UTC (rev 239146)
@@ -1184,6 +1184,8 @@
 
     bool requireDescendantTraversal = layer.hasDescendantNeedingUpdateBackingOrHierarchyTraversal()
         || (layer.hasCompositingDescendant() && (!layerBacking || layer.needsCompositingLayerConnection() || !updateLevel.isEmpty()));
+    
+    bool requiresChildRebuild = layerBacking && layer.needsCompositingLayerConnection() && !layer.hasCompositingDescendant();
 
 #if !ASSERT_DISABLED
     LayerListMutationDetector mutationChecker(layer);
@@ -1208,11 +1210,11 @@
         
         for (auto* renderLayer : layer.positiveZOrderLayers())
             updateBackingAndHierarchy(*renderLayer, childList, updateLevel, depth + 1);
-    } else
+    } else if (requiresChildRebuild)
         appendForegroundLayerIfNecessary();
 
     if (layerBacking) {
-        if (requireDescendantTraversal) {
+        if (requireDescendantTraversal || requiresChildRebuild) {
             bool parented = false;
             if (is<RenderWidget>(layer.renderer()))
                 parented = parentFrameContentLayers(&downcast<RenderWidget>(layer.renderer()));
@@ -1236,7 +1238,7 @@
 
         childLayersOfEnclosingLayer.append(*layerBacking->childForSuperlayers());
 
-        layerBacking->updateAfterDescendants(); // FIXME: validate.
+        layerBacking->updateAfterDescendants();
     }
     
     layer.clearUpdateBackingOrHierarchyTraversalState();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to