Tiles on bottom of screen are not always allocated when necessary
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jun 2014 21:21:29 +0000 (21:21 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 30 Jun 2014 21:21:29 +0000 (21:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134272

Reviewed by Simon Fraser.

Source/WebCore:
The initial visibleRect is in the coordinate of the root layer, so its origin
is at the top left of the view. The initial rect we were using doesn't
include the contents inset, so it was too short, which was causing tiles near
the bottom of the screen to not always be allocated if the tile threshold was
close to the bottom of the view. Instead, we want to include the contents
inset size so the visible rect includes the entire view.
GraphicsLayerCA::recursiveCommitChanges() takes care of mapping and cropping
the visible rect into the tiled layer's coordinate system, at which point it
is used for visible tile logic.

Test: platform/mac-wk2/tiled-drawing/visible-rect-content-inset.html

* platform/graphics/ca/TileCoverageMap.cpp:
(WebCore::TileCoverageMap::update):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::flushPendingLayerChanges):

LayoutTests:
Apply a content inset, then dump visible rects.

* platform/mac-wk2/tiled-drawing/visible-rect-content-inset-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/visible-rect-content-inset.html: Added.
* compositing/visible-rect/iframe-no-layers.html: For WK2, the size of the visibleRect
includes the size of the border of the iframe. In order to elliminate platform
differences, set this border to 0.

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

LayoutTests/ChangeLog
LayoutTests/compositing/visible-rect/iframe-no-layers.html
LayoutTests/platform/mac-wk2/tiled-drawing/visible-rect-content-inset-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-wk2/tiled-drawing/visible-rect-content-inset.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/TileCoverageMap.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp

index e183a4c..aa6bc75 100644 (file)
@@ -1,3 +1,18 @@
+2014-06-30  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Tiles on bottom of screen are not always allocated when necessary
+        https://bugs.webkit.org/show_bug.cgi?id=134272
+
+        Reviewed by Simon Fraser.
+
+        Apply a content inset, then dump visible rects.
+
+        * platform/mac-wk2/tiled-drawing/visible-rect-content-inset-expected.txt: Added.
+        * platform/mac-wk2/tiled-drawing/visible-rect-content-inset.html: Added.
+        * compositing/visible-rect/iframe-no-layers.html: For WK2, the size of the visibleRect
+        includes the size of the border of the iframe. In order to elliminate platform
+        differences, set this border to 0. 
+
 2014-06-30  Michael Saboff  <msaboff@apple.com>
 
         Reduce memory required for js/typedarray-zero-size.js
index 6492a97..685130b 100644 (file)
@@ -9,6 +9,7 @@
         
         iframe {
             margin: 10px;
+            border: 0px solid black;
         }
     </style>
     <script>
diff --git a/LayoutTests/platform/mac-wk2/tiled-drawing/visible-rect-content-inset-expected.txt b/LayoutTests/platform/mac-wk2/tiled-drawing/visible-rect-content-inset-expected.txt
new file mode 100644 (file)
index 0000000..95ef9ae
--- /dev/null
@@ -0,0 +1,19 @@
+This test applies a content inset and then dumps the layer tree including visible rects. The visible rects should match the expected rects.
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 500.00)
+  (visible rect 0.00, 0.00 800.00 x 500.00)
+  (contentsScale 1.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 500.00)
+      (contentsOpaque 1)
+      (visible rect 0.00, 0.00 800.00 x 500.00)
+      (contentsScale 1.00)
+      (tile cache coverage 0, 0 800 x 500)
+      (tile size 512 x 512)
+      (top left tile 0, 0 tiles grid 2 x 1)
+    )
+  )
+)
+
diff --git a/LayoutTests/platform/mac-wk2/tiled-drawing/visible-rect-content-inset.html b/LayoutTests/platform/mac-wk2/tiled-drawing/visible-rect-content-inset.html
new file mode 100644 (file)
index 0000000..ae3de3b
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+        if (window.internals)
+            window.internals.setTopContentInset(100);
+
+        function doTest()
+        {
+            if (window.internals) {
+                document.getElementById('layers').innerText = internals.layerTreeAsText(document,
+                    internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+            }
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+This test applies a content inset and then dumps the layer tree including visible rects. The visible rects should match the expected rects.
+<pre id="layers">Layer tree goes here</p>
+</body>
+</html>
index 3e3dfa7..33650c0 100644 (file)
@@ -1,3 +1,27 @@
+2014-06-30  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Tiles on bottom of screen are not always allocated when necessary
+        https://bugs.webkit.org/show_bug.cgi?id=134272
+
+        Reviewed by Simon Fraser.
+
+        The initial visibleRect is in the coordinate of the root layer, so its origin
+        is at the top left of the view. The initial rect we were using doesn't
+        include the contents inset, so it was too short, which was causing tiles near
+        the bottom of the screen to not always be allocated if the tile threshold was
+        close to the bottom of the view. Instead, we want to include the contents
+        inset size so the visible rect includes the entire view.
+        GraphicsLayerCA::recursiveCommitChanges() takes care of mapping and cropping
+        the visible rect into the tiled layer's coordinate system, at which point it
+        is used for visible tile logic.
+
+        Test: platform/mac-wk2/tiled-drawing/visible-rect-content-inset.html
+
+        * platform/graphics/ca/TileCoverageMap.cpp:
+        (WebCore::TileCoverageMap::update):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::flushPendingLayerChanges):
+
 2014-06-30  Brent Fulgham  <bfulgham@apple.com>
 
         [Win] Unreviewed project gardening.
index d776947..dce15e6 100644 (file)
@@ -63,7 +63,6 @@ void TileCoverageMap::update()
     FloatRect containerBounds = m_controller.bounds();
     FloatRect visibleRect = m_controller.visibleRect();
     visibleRect.contract(4, 4); // Layer is positioned 2px from top and left edges.
-    visibleRect.setHeight(visibleRect.height() - m_controller.topContentInset());
 
     float widthScale = 1;
     float scale = 1;
index dc127d8..de32fd2 100644 (file)
@@ -460,7 +460,7 @@ void RenderLayerCompositor::flushPendingLayerChanges(bool isFlushRoot)
         rootLayer->flushCompositingState(visibleRect);
 #else
         // Having a m_clipLayer indicates that we're doing scrolling via GraphicsLayers.
-        IntRect visibleRect = m_clipLayer ? IntRect(IntPoint(), frameView.contentsSize()) : frameView.visibleContentRect();
+        IntRect visibleRect = m_clipLayer ? IntRect(IntPoint(), frameView.unscaledTotalVisibleContentSize()) : frameView.visibleContentRect();
         if (!frameView.exposedRect().isInfinite())
             visibleRect.intersect(IntRect(frameView.exposedRect()));
         rootLayer->flushCompositingState(visibleRect);