Tiles on bottom of screen are not always allocated when necessary
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Jun 2014 01:25:23 +0000 (01:25 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 Jun 2014 01:25:23 +0000 (01:25 +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.

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

LayoutTests/ChangeLog
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 757c9bf..f563158 100644 (file)
@@ -1,3 +1,15 @@
+2014-06-24  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.
+
 2014-06-24  Samuel White  <samuel_white@apple.com>
 
         AX: Remove tight platform expectation coupling form roles-exposed layout test.
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 a0b1a23..55373f2 100644 (file)
@@ -1,5 +1,29 @@
 2014-06-24  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-24  Myles C. Maxfield  <mmaxfield@apple.com>
+
         InlineTextBox's m_len can be an unsigned (rather than an unsigned short)
         https://bugs.webkit.org/show_bug.cgi?id=134173
 
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 2d96796..95d402e 100644 (file)
@@ -461,7 +461,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);