Title: [212153] trunk
Revision
212153
Author
simon.fra...@apple.com
Date
2017-02-10 15:02:36 -0800 (Fri, 10 Feb 2017)

Log Message

Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
https://bugs.webkit.org/show_bug.cgi?id=168127
rdar://problem/30467120

Reviewed by Tim Horton.
Source/WebCore:

Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
which forgot to hit masks and replica layers with a generic traverse() function, which
is then used for setting 'inWindow' as well as resetting tracked repaints.

Tests: compositing/tiling/tiled-mask-inwindow.html
       compositing/tiling/tiled-reflection-inwindow.html

* page/PageOverlayController.cpp:
(WebCore::PageOverlayController::layerWithDocumentOverlays):
(WebCore::PageOverlayController::layerWithViewOverlays):
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::setIsInWindow):
(WebCore::GraphicsLayer::setReplicatedByLayer):
(WebCore::GraphicsLayer::traverse):
(WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.
* platform/graphics/GraphicsLayer.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::setIsInWindow):
(WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
(WebCore::resetTrackedRepaintRectsRecursive): Deleted.

Tools:

Reparent the web view before we try to fetch it via:
    [[[window contentView] subviews] objectAtIndex:0];
which would throw an exception if the test unparented it.

* DumpRenderTree/mac/DumpRenderTree.mm:
(resetWebViewToConsistentStateBeforeTesting):
(runTest):

LayoutTests:

* compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
* compositing/tiling/tiled-mask-inwindow.html: Added.
* compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
* compositing/tiling/tiled-reflection-inwindow.html: Added.
* platform/ios-simulator-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
* platform/ios-simulator-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
* platform/ios-simulator-wk2/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
* platform/ios-simulator-wk2/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
* platform/mac-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
* platform/mac-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (212152 => 212153)


--- trunk/LayoutTests/ChangeLog	2017-02-10 22:40:18 UTC (rev 212152)
+++ trunk/LayoutTests/ChangeLog	2017-02-10 23:02:36 UTC (rev 212153)
@@ -1,3 +1,22 @@
+2017-02-10  Simon Fraser  <simon.fra...@apple.com>
+
+        Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
+        https://bugs.webkit.org/show_bug.cgi?id=168127
+        rdar://problem/30467120
+
+        Reviewed by Tim Horton.
+
+        * compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
+        * compositing/tiling/tiled-mask-inwindow.html: Added.
+        * compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
+        * compositing/tiling/tiled-reflection-inwindow.html: Added.
+        * platform/ios-simulator-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
+        * platform/ios-simulator-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
+        * platform/ios-simulator-wk2/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
+        * platform/ios-simulator-wk2/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
+        * platform/mac-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt: Added.
+        * platform/mac-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt: Added.
+
 2017-02-09  Simon Fraser  <simon.fra...@apple.com>
 
         Tiled layers are sometimes left with some tiles when outside the viewport

Added: trunk/LayoutTests/compositing/tiling/tiled-mask-inwindow-expected.txt (0 => 212153)


--- trunk/LayoutTests/compositing/tiling/tiled-mask-inwindow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/tiling/tiled-mask-inwindow-expected.txt	2017-02-10 23:02:36 UTC (rev 212153)
@@ -0,0 +1,99 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 1101.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 1101.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 785 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 0)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 0)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 0)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/tiling/tiled-mask-inwindow.html (0 => 212153)


--- trunk/LayoutTests/compositing/tiling/tiled-mask-inwindow.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/tiling/tiled-mask-inwindow.html	2017-02-10 23:02:36 UTC (rev 212153)
@@ -0,0 +1,74 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .container {
+            height: 300px;
+            width: 400px;
+            border: 2px solid black;
+            overflow: hidden;
+        }
+
+        .box {
+            height: 300px;
+            width: 2800px;
+            border: 1px solid black;
+            background-color: gray;
+        }
+
+        .composited {
+            transform: translateZ(0);
+        }
+
+        .masked {
+            -webkit-mask-image: url(../resources/alpha-gradient.png);
+            -webkit-mask-repeat: repeat-x;
+        }
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+        
+        function getUIScript()
+        {
+            return `
+            (function() {
+                uiController.removeViewFromWindow(function() {
+                    uiController.uiScriptComplete('');
+                });
+            })();`
+        }
+
+        function dumpTiles(outputId)
+        {
+            if (window.internals)
+                document.getElementById(outputId).innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+        }
+        function doTest()
+        {
+            if (!testRunner.runUIScript)
+                return;
+
+            dumpTiles('before-layers');
+
+            testRunner.runUIScript(getUIScript(), function(result) {
+                dumpTiles('after-layers');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            });
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div class="composited container">
+        <div class="composited masked box"></div> 
+    </div>
+
+<pre id="before-layers">Layer tree goes here</pre>
+<pre id="after-layers">Layer tree goes here</pre>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/tiling/tiled-reflection-inwindow-expected.txt (0 => 212153)


--- trunk/LayoutTests/compositing/tiling/tiled-reflection-inwindow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/tiling/tiled-reflection-inwindow-expected.txt	2017-02-10 23:02:36 UTC (rev 212153)
@@ -0,0 +1,113 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (replica layer)
+            (GraphicsLayer
+              (position -2.00 -2.00)
+              (bounds 404.00 304.00)
+              (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 314.00 0.00 1.00])
+              (replicated layer)
+            )
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 913.00 1206.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 913.00 1206.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 0)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (replica layer)
+            (GraphicsLayer
+              (position -2.00 -2.00)
+              (bounds 404.00 304.00)
+              (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 314.00 0.00 1.00])
+              (replicated layer)
+            )
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 0)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 0)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/tiling/tiled-reflection-inwindow.html (0 => 212153)


--- trunk/LayoutTests/compositing/tiling/tiled-reflection-inwindow.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/tiling/tiled-reflection-inwindow.html	2017-02-10 23:02:36 UTC (rev 212153)
@@ -0,0 +1,75 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        .container {
+            height: 300px;
+            width: 400px;
+            border: 2px solid black;
+            overflow: hidden;
+            -webkit-box-reflect: below 10px;
+        }
+
+        .box {
+            height: 300px;
+            width: 2800px;
+            border: 1px solid black;
+            background-color: gray;
+        }
+
+        .composited {
+            transform: translateZ(0);
+        }
+
+        .masked {
+            -webkit-mask-image: url(../resources/alpha-gradient.png);
+            -webkit-mask-repeat: repeat-x;
+        }
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+        
+        function getUIScript()
+        {
+            return `
+            (function() {
+                uiController.removeViewFromWindow(function() {
+                    uiController.uiScriptComplete('');
+                });
+            })();`
+        }
+
+        function dumpTiles(outputId)
+        {
+            if (window.internals)
+                document.getElementById(outputId).innerText = internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+        }
+        function doTest()
+        {
+            if (!testRunner.runUIScript)
+                return;
+
+            dumpTiles('before-layers');
+
+            testRunner.runUIScript(getUIScript(), function(result) {
+                dumpTiles('after-layers');
+                if (window.testRunner)
+                    testRunner.notifyDone();
+            });
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+    <div class="composited container">
+        <div class="composited masked box"></div> 
+    </div>
+
+<pre id="before-layers">Layer tree goes here</pre>
+<pre id="after-layers">Layer tree goes here</pre>
+</body>
+</html>

Added: trunk/LayoutTests/platform/ios-simulator-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt (0 => 212153)


--- trunk/LayoutTests/platform/ios-simulator-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt	2017-02-10 23:02:36 UTC (rev 212153)
@@ -0,0 +1,91 @@
+(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)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 995.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 995.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/platform/ios-simulator-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt (0 => 212153)


--- trunk/LayoutTests/platform/ios-simulator-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt	2017-02-10 23:02:36 UTC (rev 212153)
@@ -0,0 +1,105 @@
+(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)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (replica layer)
+            (GraphicsLayer
+              (position -2.00 -2.00)
+              (bounds 404.00 304.00)
+              (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 314.00 0.00 1.00])
+              (replicated layer)
+            )
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 913.00 1093.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 913.00 1093.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (replica layer)
+            (GraphicsLayer
+              (position -2.00 -2.00)
+              (bounds 404.00 304.00)
+              (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 314.00 0.00 1.00])
+              (replicated layer)
+            )
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/tiled-mask-inwindow-expected.txt (0 => 212153)


--- trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/tiled-mask-inwindow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/tiled-mask-inwindow-expected.txt	2017-02-10 23:02:36 UTC (rev 212153)
@@ -0,0 +1,99 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 1051.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 1051.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/tiled-reflection-inwindow-expected.txt (0 => 212153)


--- trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/tiled-reflection-inwindow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/tiled-reflection-inwindow-expected.txt	2017-02-10 23:02:36 UTC (rev 212153)
@@ -0,0 +1,113 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (replica layer)
+            (GraphicsLayer
+              (position -2.00 -2.00)
+              (bounds 404.00 304.00)
+              (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 314.00 0.00 1.00])
+              (replicated layer)
+            )
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 913.00 1149.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 913.00 1149.00)
+      (contentsOpaque 1)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (replica layer)
+            (GraphicsLayer
+              (position -2.00 -2.00)
+              (bounds 404.00 304.00)
+              (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 314.00 0.00 1.00])
+              (replicated layer)
+            )
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/platform/mac-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt (0 => 212153)


--- trunk/LayoutTests/platform/mac-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/tiling/tiled-mask-inwindow-expected.txt	2017-02-10 23:02:36 UTC (rev 212153)
@@ -0,0 +1,91 @@
+(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)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 1041.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 1041.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 0)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 0)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/platform/mac-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt (0 => 212153)


--- trunk/LayoutTests/platform/mac-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/tiling/tiled-reflection-inwindow-expected.txt	2017-02-10 23:02:36 UTC (rev 212153)
@@ -0,0 +1,105 @@
+(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)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (replica layer)
+            (GraphicsLayer
+              (position -2.00 -2.00)
+              (bounds 404.00 304.00)
+              (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 314.00 0.00 1.00])
+              (replicated layer)
+            )
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 1)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 913.00 1146.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 913.00 1146.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 404.00 304.00)
+          (drawsContent 1)
+          (replica layer)
+            (GraphicsLayer
+              (position -2.00 -2.00)
+              (bounds 404.00 304.00)
+              (transform [1.00 0.00 0.00 0.00] [0.00 -1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 314.00 0.00 1.00])
+              (replicated layer)
+            )
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 400.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 2802.00 302.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (mask layer)
+                    (GraphicsLayer
+                      (bounds 2802.00 302.00)
+                      (usingTiledLayer 1)
+                      (drawsContent 1)
+                      (tile cache coverage 0, 0 512 x 302)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 1 x 1)
+                      (in window 0)
+                    )
+                  (tile cache coverage 0, 0 512 x 302)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 1 x 1)
+                  (in window 0)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Modified: trunk/Source/WebCore/ChangeLog (212152 => 212153)


--- trunk/Source/WebCore/ChangeLog	2017-02-10 22:40:18 UTC (rev 212152)
+++ trunk/Source/WebCore/ChangeLog	2017-02-10 23:02:36 UTC (rev 212153)
@@ -1,3 +1,32 @@
+2017-02-10  Simon Fraser  <simon.fra...@apple.com>
+
+        Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
+        https://bugs.webkit.org/show_bug.cgi?id=168127
+        rdar://problem/30467120
+
+        Reviewed by Tim Horton.
+        
+        Replace the special-case, but wrong, GraphicsLayer traversal in setIsInWindowIncludingDescendants()
+        which forgot to hit masks and replica layers with a generic traverse() function, which
+        is then used for setting 'inWindow' as well as resetting tracked repaints.
+
+        Tests: compositing/tiling/tiled-mask-inwindow.html
+               compositing/tiling/tiled-reflection-inwindow.html
+
+        * page/PageOverlayController.cpp:
+        (WebCore::PageOverlayController::layerWithDocumentOverlays):
+        (WebCore::PageOverlayController::layerWithViewOverlays):
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::setIsInWindow):
+        (WebCore::GraphicsLayer::setReplicatedByLayer):
+        (WebCore::GraphicsLayer::traverse):
+        (WebCore::GraphicsLayer::setIsInWindowIncludingDescendants): Deleted.
+        * platform/graphics/GraphicsLayer.h:
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::setIsInWindow):
+        (WebCore::RenderLayerCompositor::resetTrackedRepaintRects):
+        (WebCore::resetTrackedRepaintRectsRecursive): Deleted.
+
 2017-02-09  Simon Fraser  <simon.fra...@apple.com>
 
         Tiled layers are sometimes left with some tiles when outside the viewport

Modified: trunk/Source/WebCore/page/PageOverlayController.cpp (212152 => 212153)


--- trunk/Source/WebCore/page/PageOverlayController.cpp	2017-02-10 22:40:18 UTC (rev 212152)
+++ trunk/Source/WebCore/page/PageOverlayController.cpp	2017-02-10 23:02:36 UTC (rev 212153)
@@ -103,7 +103,9 @@
             continue;
 
         GraphicsLayer& layer = *overlayAndLayer.value;
-        layer.setIsInWindowIncludingDescendants(inWindow);
+        GraphicsLayer::traverse(layer, [inWindow](GraphicsLayer& layer) {
+            layer.setIsInWindow(inWindow);
+        });
         updateOverlayGeometry(overlay, layer);
         
         if (!layer.parent())
@@ -125,7 +127,9 @@
             continue;
 
         GraphicsLayer& layer = *overlayAndLayer.value;
-        layer.setIsInWindowIncludingDescendants(inWindow);
+        GraphicsLayer::traverse(layer, [inWindow](GraphicsLayer& layer) {
+            layer.setIsInWindow(inWindow);
+        });
         updateOverlayGeometry(overlay, layer);
         
         if (!layer.parent())

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (212152 => 212153)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2017-02-10 22:40:18 UTC (rev 212152)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2017-02-10 23:02:36 UTC (rev 212153)
@@ -363,13 +363,10 @@
         childLayers[i]->noteDeviceOrPageScaleFactorChangedIncludingDescendants();
 }
 
-void GraphicsLayer::setIsInWindowIncludingDescendants(bool inWindow)
+void GraphicsLayer::setIsInWindow(bool inWindow)
 {
     if (TiledBacking* tiledBacking = this->tiledBacking())
         tiledBacking->setIsInWindow(inWindow);
-
-    for (auto* childLayer : children())
-        childLayer->setIsInWindowIncludingDescendants(inWindow);
 }
 
 void GraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer)
@@ -378,7 +375,7 @@
         return;
 
     if (m_replicaLayer)
-        m_replicaLayer->setReplicatedLayer(0);
+        m_replicaLayer->setReplicatedLayer(nullptr);
 
     if (layer)
         layer->setReplicatedLayer(this);
@@ -668,6 +665,20 @@
     }
 }
 
+void GraphicsLayer::traverse(GraphicsLayer& layer, std::function<void (GraphicsLayer&)> traversalFunc)
+{
+    traversalFunc(layer);
+
+    for (auto* childLayer : layer.children())
+        traverse(*childLayer, traversalFunc);
+
+    if (auto* replicaLayer = layer.replicaLayer())
+        traverse(*replicaLayer, traversalFunc);
+
+    if (auto* maskLayer = layer.maskLayer())
+        traverse(*maskLayer, traversalFunc);
+}
+
 void GraphicsLayer::dumpLayer(TextStream& ts, int indent, LayerTreeAsTextBehavior behavior) const
 {
     writeIndent(ts, indent);

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (212152 => 212153)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2017-02-10 22:40:18 UTC (rev 212152)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2017-02-10 23:02:36 UTC (rev 212153)
@@ -517,7 +517,7 @@
     virtual void deviceOrPageScaleFactorChanged() { }
     WEBCORE_EXPORT void noteDeviceOrPageScaleFactorChangedIncludingDescendants();
 
-    void setIsInWindowIncludingDescendants(bool);
+    void setIsInWindow(bool);
 
     // Some compositing systems may do internal batching to synchronize compositing updates
     // with updates drawn into the window. These methods flush internal batched state on this layer
@@ -561,6 +561,8 @@
     virtual bool isGraphicsLayerTextureMapper() const { return false; }
     virtual bool isCoordinatedGraphicsLayer() const { return false; }
 
+    static void traverse(GraphicsLayer&, std::function<void (GraphicsLayer&)>);
+
 protected:
     WEBCORE_EXPORT explicit GraphicsLayer(Type, GraphicsLayerClient&);
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (212152 => 212153)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2017-02-10 22:40:18 UTC (rev 212152)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2017-02-10 23:02:36 UTC (rev 212153)
@@ -2034,8 +2034,11 @@
     if (!inCompositingMode())
         return;
 
-    if (GraphicsLayer* rootLayer = rootGraphicsLayer())
-        rootLayer->setIsInWindowIncludingDescendants(isInWindow);
+    if (GraphicsLayer* rootLayer = rootGraphicsLayer()) {
+        GraphicsLayer::traverse(*rootLayer, [isInWindow](GraphicsLayer& layer) {
+            layer.setIsInWindow(isInWindow);
+        });
+    }
 
     if (isInWindow) {
         if (m_rootLayerAttachment != RootLayerUnattached)
@@ -2862,24 +2865,13 @@
     return nullptr;
 }
 
-static void resetTrackedRepaintRectsRecursive(GraphicsLayer& graphicsLayer)
-{
-    graphicsLayer.resetTrackedRepaints();
-
-    for (auto* childLayer : graphicsLayer.children())
-        resetTrackedRepaintRectsRecursive(*childLayer);
-
-    if (GraphicsLayer* replicaLayer = graphicsLayer.replicaLayer())
-        resetTrackedRepaintRectsRecursive(*replicaLayer);
-
-    if (GraphicsLayer* maskLayer = graphicsLayer.maskLayer())
-        resetTrackedRepaintRectsRecursive(*maskLayer);
-}
-
 void RenderLayerCompositor::resetTrackedRepaintRects()
 {
-    if (GraphicsLayer* rootLayer = rootGraphicsLayer())
-        resetTrackedRepaintRectsRecursive(*rootLayer);
+    if (GraphicsLayer* rootLayer = rootGraphicsLayer()) {
+        GraphicsLayer::traverse(*rootLayer, [](GraphicsLayer& layer) {
+            layer.resetTrackedRepaints();
+        });
+    }
 }
 
 void RenderLayerCompositor::setTracksRepaints(bool tracksRepaints)

Modified: trunk/Tools/ChangeLog (212152 => 212153)


--- trunk/Tools/ChangeLog	2017-02-10 22:40:18 UTC (rev 212152)
+++ trunk/Tools/ChangeLog	2017-02-10 23:02:36 UTC (rev 212153)
@@ -1,3 +1,19 @@
+2017-02-10  Simon Fraser  <simon.fra...@apple.com>
+
+        Make sure the "inwindow" flag propagates to TiledBackings for masks and reflections
+        https://bugs.webkit.org/show_bug.cgi?id=168127
+        rdar://problem/30467120
+
+        Reviewed by Tim Horton.
+
+        Reparent the web view before we try to fetch it via:
+            [[[window contentView] subviews] objectAtIndex:0];
+        which would throw an exception if the test unparented it.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (resetWebViewToConsistentStateBeforeTesting):
+        (runTest):
+
 2017-02-10  Joseph Pecoraro  <pecor...@apple.com>
 
         [Resource Timing] Enable Resource Timing by default in Tests

Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (212152 => 212153)


--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2017-02-10 22:40:18 UTC (rev 212152)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm	2017-02-10 23:02:36 UTC (rev 212153)
@@ -1848,11 +1848,6 @@
 {
     WebView *webView = [mainFrame webView];
 
-#if PLATFORM(MAC)
-    if (![webView superview])
-        [[mainWindow contentView] addSubview:webView];
-#endif
-
 #if PLATFORM(IOS)
     adjustWebDocumentForStandardViewport(gWebBrowserView, gWebScrollView);
     [webView _setAllowsMessaging:YES];
@@ -2111,6 +2106,13 @@
         gTestRunner->setDeveloperExtrasEnabled(false);
     }
 
+#if PLATFORM(MAC)
+    // Make sure the WebView is parented, since the test may have unparented it.
+    WebView *webView = [mainFrame webView];
+    if (![webView superview])
+        [[mainWindow contentView] addSubview:webView];
+#endif
+
     if (gTestRunner->closeRemainingWindowsWhenComplete()) {
         NSArray* array = [DumpRenderTreeWindow openWindows];
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to