REGRESSION (r245974): Missing content on habitburger.com, amazon.com
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Aug 2019 04:03:56 +0000 (04:03 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Aug 2019 04:03:56 +0000 (04:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=200618
rdar://problem/53920224

Reviewed by Zalan Bujtas.

Source/WebCore:

In r245974 TileController::adjustTileCoverageRect() started to intersect the coverage
rect with the bounds of the layer, which is wrong because this coverage rect is passed down
to descendant layers, and they may project outside the bounds of this tiled layer.

This caused missing dropdowns on amazon.com, and a missing menu on habitburger.com on iPhone.

The fix is to just not do the intersection with the bounds. TileGrid::getTileIndexRangeForRect()
already ensures that we never make tiles outside the bounds of a TileController.

Test: compositing/backing/layer-outside-tiled-parent.html

* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::adjustTileCoverageRect):
* platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::ensureTilesForRect):

LayoutTests:

* compositing/backing/layer-outside-tiled-parent-expected.txt: Added.
* compositing/backing/layer-outside-tiled-parent.html: Added.
* platform/ios-wk2/compositing/backing/layer-outside-tiled-parent-expected.txt: Added.
* tiled-drawing/tile-coverage-iframe-to-zero-coverage-expected.txt:
* tiled-drawing/tiled-backing-in-window-expected.txt:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@248514 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/compositing/backing/layer-outside-tiled-parent-expected.txt [new file with mode: 0644]
LayoutTests/compositing/backing/layer-outside-tiled-parent.html [new file with mode: 0644]
LayoutTests/platform/ios-wk2/compositing/backing/layer-outside-tiled-parent-expected.txt [new file with mode: 0644]
LayoutTests/tiled-drawing/tile-coverage-iframe-to-zero-coverage-expected.txt
LayoutTests/tiled-drawing/tiled-backing-in-window-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/TileController.cpp
Source/WebCore/platform/graphics/ca/TileGrid.cpp

index a3d4c61..d5dde11 100644 (file)
@@ -1,3 +1,17 @@
+2019-08-10  Simon Fraser  <simon.fraser@apple.com>
+
+        REGRESSION (r245974): Missing content on habitburger.com, amazon.com
+        https://bugs.webkit.org/show_bug.cgi?id=200618
+        rdar://problem/53920224
+
+        Reviewed by Zalan Bujtas.
+
+        * compositing/backing/layer-outside-tiled-parent-expected.txt: Added.
+        * compositing/backing/layer-outside-tiled-parent.html: Added.
+        * platform/ios-wk2/compositing/backing/layer-outside-tiled-parent-expected.txt: Added.
+        * tiled-drawing/tile-coverage-iframe-to-zero-coverage-expected.txt:
+        * tiled-drawing/tiled-backing-in-window-expected.txt:
+
 2019-08-10  Andres Gonzalez  <andresg_22@apple.com>
 
         Accessibility client cannot navigate to internal links targets on iOS.
diff --git a/LayoutTests/compositing/backing/layer-outside-tiled-parent-expected.txt b/LayoutTests/compositing/backing/layer-outside-tiled-parent-expected.txt
new file mode 100644 (file)
index 0000000..40ffdde
--- /dev/null
@@ -0,0 +1,44 @@
+trigger This should be visible This should be visible
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 2628.00)
+  (backingStoreAttached 1)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 2628.00)
+      (contentsOpaque 1)
+      (backingStoreAttached 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (anchor 0.50 0.06)
+          (bounds 200.00 2620.00)
+          (usingTiledLayer 1)
+          (drawsContent 1)
+          (backingStoreAttached 1)
+          (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] [200.00 0.00 0.00 1.00])
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 200.00 296.00)
+              (contentsOpaque 1)
+              (drawsContent 1)
+              (backingStoreAttached 1)
+              (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] [-204.00 0.00 0.00 1.00])
+              (children 1
+                (GraphicsLayer
+                  (bounds 200.00 296.00)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (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] [404.00 0.00 0.00 1.00])
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/compositing/backing/layer-outside-tiled-parent.html b/LayoutTests/compositing/backing/layer-outside-tiled-parent.html
new file mode 100644 (file)
index 0000000..07190a9
--- /dev/null
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        * {
+            box-sizing: border-box;
+        }
+        
+        .container {
+            transform: translate3d(200px, 0px, 0px);
+            border: 2px solid black;
+            width: 200px;
+            height: 300px;
+        }
+
+        .projecting {
+            position: absolute;
+            top: 0;
+            left: 0;
+            width: 200px;
+            height: 100%;
+            background-color: silver;
+        }
+        
+        .projecting.left {
+            transform: translate3d(-102%, 0, 0);
+        }
+
+        .projecting.right {
+            transform: translate3d(202%, 0, 0);
+        }
+        
+        .tiling-trigger {
+            position: absolute;
+            left: 0;
+            top: 2600px;
+        }
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        window.addEventListener('load', () => {
+            setTimeout(() => {
+                document.getElementById('layers').innerText = "Testing..."; // Trigger a first flush.
+                setTimeout(() => {
+                    if (window.internals)
+                        document.getElementById('layers').innerText = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_BACKING_STORE_ATTACHED);
+                    if (window.testRunner)
+                        testRunner.notifyDone();
+                }, 0);
+            }, 0);
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="container">
+        <div class="tiling-trigger">trigger</div>
+        <div class="projecting left">
+           This should be visible
+        </nav>
+        <div class="projecting right">
+           This should be visible
+        </nav>
+    </div>
+</div>
+<pre id="layers"></pre>
+</body>
+</html>
diff --git a/LayoutTests/platform/ios-wk2/compositing/backing/layer-outside-tiled-parent-expected.txt b/LayoutTests/platform/ios-wk2/compositing/backing/layer-outside-tiled-parent-expected.txt
new file mode 100644 (file)
index 0000000..844ce8c
--- /dev/null
@@ -0,0 +1,44 @@
+trigger This should be visible This should be visible
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 2630.00)
+  (backingStoreAttached 1)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 2630.00)
+      (contentsOpaque 1)
+      (backingStoreAttached 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (anchor 0.50 0.06)
+          (bounds 200.00 2622.00)
+          (usingTiledLayer 1)
+          (drawsContent 1)
+          (backingStoreAttached 1)
+          (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] [200.00 0.00 0.00 1.00])
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (bounds 200.00 296.00)
+              (contentsOpaque 1)
+              (drawsContent 1)
+              (backingStoreAttached 1)
+              (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] [-204.00 0.00 0.00 1.00])
+              (children 1
+                (GraphicsLayer
+                  (bounds 200.00 296.00)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (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] [404.00 0.00 0.00 1.00])
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
index e265eb0..252b030 100644 (file)
@@ -79,7 +79,7 @@
                                   (contentsOpaque 1)
                                   (drawsContent 1)
                                   (visible rect 0.00, 0.00 0.00 x 0.00)
-                                  (coverage rect 0.00, 0.00 0.00 x 0.00)
+                                  (coverage rect -8.00, -8.00 0.00 x 0.00)
                                   (intersects coverage rect 0)
                                   (contentsScale 1.00)
                                   (tile cache coverage 0, 0 0 x 0)
index e70ad4c..d5cd7fb 100644 (file)
@@ -63,7 +63,7 @@ Tiled box
           (usingTiledLayer 1)
           (drawsContent 1)
           (visible rect 0.00, 0.00 777.00 x 200.00)
-          (coverage rect 0.00, 0.00 777.00 x 200.00)
+          (coverage rect -8.00, -8.00 785.00 x 585.00)
           (intersects coverage rect 1)
           (contentsScale 1.00)
           (tile cache coverage 0, 0 1024 x 200)
index d2b8026..a2bb888 100644 (file)
@@ -1,3 +1,27 @@
+2019-08-10  Simon Fraser  <simon.fraser@apple.com>
+
+        REGRESSION (r245974): Missing content on habitburger.com, amazon.com
+        https://bugs.webkit.org/show_bug.cgi?id=200618
+        rdar://problem/53920224
+
+        Reviewed by Zalan Bujtas.
+
+        In r245974 TileController::adjustTileCoverageRect() started to intersect the coverage
+        rect with the bounds of the layer, which is wrong because this coverage rect is passed down
+        to descendant layers, and they may project outside the bounds of this tiled layer.
+        
+        This caused missing dropdowns on amazon.com, and a missing menu on habitburger.com on iPhone.
+
+        The fix is to just not do the intersection with the bounds. TileGrid::getTileIndexRangeForRect()
+        already ensures that we never make tiles outside the bounds of a TileController.
+
+        Test: compositing/backing/layer-outside-tiled-parent.html
+
+        * platform/graphics/ca/TileController.cpp:
+        (WebCore::TileController::adjustTileCoverageRect):
+        * platform/graphics/ca/TileGrid.cpp:
+        (WebCore::TileGrid::ensureTilesForRect):
+
 2019-08-10  Andres Gonzalez  <andresg_22@apple.com>
 
         Accessibility client cannot navigate to internal links targets on iOS.
index 262de8b..4d64c2c 100644 (file)
@@ -368,8 +368,7 @@ FloatRect TileController::adjustTileCoverageRect(const FloatRect& coverageRect,
     if (sizeChanged || MemoryPressureHandler::singleton().isUnderMemoryPressure())
         return unionRect(coverageRect, currentVisibleRect);
 
-    auto expandedCoverageRect = GraphicsLayer::adjustCoverageRectForMovement(coverageRect, previousVisibleRect, currentVisibleRect);
-    return intersection(expandedCoverageRect, boundsWithoutMargin());
+    return GraphicsLayer::adjustCoverageRectForMovement(coverageRect, previousVisibleRect, currentVisibleRect);
 }
 
 #if !PLATFORM(IOS_FAMILY)
index 6851cc3..496a32d 100644 (file)
@@ -557,8 +557,6 @@ IntRect TileGrid::ensureTilesForRect(const FloatRect& rect, CoverageType newTile
     if (!m_controller.isInWindow())
         return IntRect();
 
-    LOG_WITH_STREAM(Tiling, stream << "TileGrid " << this << " ensureTilesForRect: " << rect);
-
     FloatRect scaledRect(rect);
     scaledRect.scale(m_scale);
     IntRect rectInTileCoords(enclosingIntRect(scaledRect));
@@ -608,10 +606,12 @@ IntRect TileGrid::ensureTilesForRect(const FloatRect& rect, CoverageType newTile
                 m_containerLayer.get().appendSublayer(*tileInfo.layer);
         }
     }
-    
+
     if (tilesInCohort)
         startedNewCohort(currCohort);
 
+    LOG_WITH_STREAM(Tiling, stream << "TileGrid " << this << " (bounds " << m_controller.bounds() << ") ensureTilesForRect: " << rect << " covered " << coverageRect);
+
     return coverageRect;
 }