Title: [132542] trunk
Revision
132542
Author
simon.fra...@apple.com
Date
2012-10-25 16:13:25 -0700 (Thu, 25 Oct 2012)

Log Message

Tiled layers are missing content on zooming
https://bugs.webkit.org/show_bug.cgi?id=100422

Reviewed by Beth Dakin.

Source/WebCore:

Tiled layers using TileCaches were missing content after
zooming. TileCache was confused in the presence of scaling;
it unapplies the scale on the layer above the tiles (so the tiles
live in screen space), and computed the tile coverage rect
in these tile coordinates. This worked for the page tile cache,
because its visibleRect was sent in pre-scaled. However, for
tiled layer TileCaches this was wrong.

Fix by scaling the tile coverage rect by m_scale before
using it to compute which tiles to throw away and bring in.

To fix the problem of the visibleRect being pre-scaled
for the page tile cache, remove the setting of the visibleRect
in RenderLayerCompositor::frameViewDidScroll(), and rely on
GraphicsLayerCA::updateVisibleRect() which computes the
visible rect in the correct, layer coordinates.

Test: compositing/tiling/tile-cache-zoomed.html

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::updateVisibleRect): Call setVisibleRect()
for all tile cache layers, not just tiled layer ones, but only do
the visible rect adjustment for those that are not the page tile cache.
* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::revalidateTiles): Use a coverageRectInTileCoords rect,
which is scaled to be in the same coordinate space as the tile grid.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::frameViewDidScroll): Remove the code
that sets the setVisibleRect() on the TiledBacking.

LayoutTests:

New test for zooming with a tiled layer, and adjust an existing result.

* compositing/tiling/tile-cache-zoomed-expected.txt: Added.
* compositing/tiling/tile-cache-zoomed.html: Added.
* platform/mac/tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (132541 => 132542)


--- trunk/LayoutTests/ChangeLog	2012-10-25 22:59:14 UTC (rev 132541)
+++ trunk/LayoutTests/ChangeLog	2012-10-25 23:13:25 UTC (rev 132542)
@@ -1,3 +1,16 @@
+2012-10-25  Simon Fraser  <simon.fra...@apple.com>
+
+        Tiled layers are missing content on zooming
+        https://bugs.webkit.org/show_bug.cgi?id=100422
+
+        Reviewed by Beth Dakin.
+
+        New test for zooming with a tiled layer, and adjust an existing result.
+        
+        * compositing/tiling/tile-cache-zoomed-expected.txt: Added.
+        * compositing/tiling/tile-cache-zoomed.html: Added.
+        * platform/mac/tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt:
+
 2012-10-25  Roger Fong  <roger_f...@apple.com>
 
         Unreviewed. Add results for svg/custom/patter-scaling.svg on Windows after r132026.

Added: trunk/LayoutTests/compositing/tiling/tile-cache-zoomed-expected.txt (0 => 132542)


--- trunk/LayoutTests/compositing/tiling/tile-cache-zoomed-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/tiling/tile-cache-zoomed-expected.txt	2012-10-25 23:13:25 UTC (rev 132542)
@@ -0,0 +1,25 @@
+(GraphicsLayer
+  (bounds 1932.00 4150.00)
+  (visible rect 0.00, 0.00 785.00 x 585.00)
+  (children 1
+    (GraphicsLayer
+      (anchor 0.00 0.00)
+      (bounds 3092.00 6640.00)
+      (transform [1.60 0.00 0.00 0.00] [0.00 1.60 0.00 0.00] [0.00 0.00 1.00 0.00] [0.00 0.00 0.00 1.00])
+      (visible rect 0.00, 0.00 490.63 x 365.63)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 700.00 2500.00)
+          (usingTiledLayer 1)
+          (drawsContent 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] [0.00 0.00 1.00 1.00])
+          (visible rect 0.00, 0.00 482.63 x 357.63)
+          (tile cache coverage 0, 0 640 x 640)
+          (tile size 512 x 512)
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/compositing/tiling/tile-cache-zoomed-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/tiling/tile-cache-zoomed.html (0 => 132542)


--- trunk/LayoutTests/compositing/tiling/tile-cache-zoomed.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/tiling/tile-cache-zoomed.html	2012-10-25 23:13:25 UTC (rev 132542)
@@ -0,0 +1,43 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            width: 1200px;
+            height: 2000px;
+            overflow: hidden;
+        }
+        
+        .box {
+            height: 2500px;
+            width: 700px;
+            -webkit-transform: translateZ(1px);
+            background-color: silver;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+
+        function doTest()
+        {
+            if (window.eventSender)
+                eventSender.scalePageBy(1.6, 1.6);
+
+            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>
+    <div class="box">
+        
+    </div>
+<pre id="layers">Layer tree goes here</p>
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/tiling/tile-cache-zoomed.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/LayoutTests/platform/mac/tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt (132541 => 132542)


--- trunk/LayoutTests/platform/mac/tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt	2012-10-25 22:59:14 UTC (rev 132541)
+++ trunk/LayoutTests/platform/mac/tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt	2012-10-25 23:13:25 UTC (rev 132542)
@@ -7,7 +7,7 @@
       (drawsContent 1)
       (backgroundColor #FFFFFF)
       (visible rect 0.00, 5000.00 785.00 x 21.00)
-      (tile cache coverage 0, 4096 785 x 925)
+      (tile cache coverage 0, 4608 785 x 413)
       (tile size 512 x 512)
       (children 1
         (GraphicsLayer

Modified: trunk/Source/WebCore/ChangeLog (132541 => 132542)


--- trunk/Source/WebCore/ChangeLog	2012-10-25 22:59:14 UTC (rev 132541)
+++ trunk/Source/WebCore/ChangeLog	2012-10-25 23:13:25 UTC (rev 132542)
@@ -1,3 +1,40 @@
+2012-10-25  Simon Fraser  <simon.fra...@apple.com>
+
+        Tiled layers are missing content on zooming
+        https://bugs.webkit.org/show_bug.cgi?id=100422
+
+        Reviewed by Beth Dakin.
+
+        Tiled layers using TileCaches were missing content after
+        zooming. TileCache was confused in the presence of scaling;
+        it unapplies the scale on the layer above the tiles (so the tiles
+        live in screen space), and computed the tile coverage rect
+        in these tile coordinates. This worked for the page tile cache,
+        because its visibleRect was sent in pre-scaled. However, for
+        tiled layer TileCaches this was wrong.
+        
+        Fix by scaling the tile coverage rect by m_scale before
+        using it to compute which tiles to throw away and bring in.
+        
+        To fix the problem of the visibleRect being pre-scaled
+        for the page tile cache, remove the setting of the visibleRect
+        in RenderLayerCompositor::frameViewDidScroll(), and rely on 
+        GraphicsLayerCA::updateVisibleRect() which computes the
+        visible rect in the correct, layer coordinates.
+
+        Test: compositing/tiling/tile-cache-zoomed.html
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::updateVisibleRect): Call setVisibleRect()
+        for all tile cache layers, not just tiled layer ones, but only do
+        the visible rect adjustment for those that are not the page tile cache.
+        * platform/graphics/ca/mac/TileCache.mm:
+        (WebCore::TileCache::revalidateTiles): Use a coverageRectInTileCoords rect,
+        which is scaled to be in the same coordinate space as the tile grid.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::frameViewDidScroll): Remove the code
+        that sets the setVisibleRect() on the TiledBacking.
+
 2012-10-25  Adam Barth  <aba...@webkit.org>
 
         [V8] ActiveDOMNodes no longer require a separate wrapper map

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (132541 => 132542)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-10-25 22:59:14 UTC (rev 132541)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-10-25 23:13:25 UTC (rev 132542)
@@ -1593,10 +1593,13 @@
 
 void GraphicsLayerCA::updateVisibleRect(const FloatRect& oldVisibleRect)
 {
-    if (m_layer->layerType() != PlatformCALayer::LayerTypeTileCacheLayer)
+    if (!m_layer->usesTileCacheLayer())
         return;
 
-    FloatRect tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, m_sizeAtLastVisibleRectUpdate);
+    FloatRect tileArea = m_visibleRect;
+    if (m_layer->layerType() == PlatformCALayer::LayerTypeTileCacheLayer)
+        tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, m_sizeAtLastVisibleRectUpdate);
+
     tiledBacking()->setVisibleRect(enclosingIntRect(tileArea));
 
     m_sizeAtLastVisibleRectUpdate = m_size;

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (132541 => 132542)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-10-25 22:59:14 UTC (rev 132541)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-10-25 23:13:25 UTC (rev 132542)
@@ -392,6 +392,8 @@
         return;
 
     IntRect tileCoverageRect = computeTileCoverageRect();
+    IntRect coverageRectInTileCoords(tileCoverageRect);
+    coverageRectInTileCoords.scale(m_scale);
 
     IntSize oldTileSize = m_tileSize;
     m_tileSize = tileSizeForCoverageRect(tileCoverageRect);
@@ -404,7 +406,7 @@
 
         WebTileLayer* tileLayer = it->value.get();
 
-        if (!rectForTileIndex(tileIndex).intersects(tileCoverageRect) || tileSizeChanged) {
+        if (!rectForTileIndex(tileIndex).intersects(coverageRectInTileCoords) || tileSizeChanged) {
             // Remove this layer.
             [tileLayer removeFromSuperlayer];
             [tileLayer setTileCache:0];
@@ -421,7 +423,7 @@
 
     TileIndex topLeft;
     TileIndex bottomRight;
-    getTileIndexRangeForRect(tileCoverageRect, topLeft, bottomRight);
+    getTileIndexRangeForRect(coverageRectInTileCoords, topLeft, bottomRight);
 
     Vector<FloatRect> dirtyRects;
 

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (132541 => 132542)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-10-25 22:59:14 UTC (rev 132541)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-10-25 23:13:25 UTC (rev 132542)
@@ -1100,12 +1100,6 @@
     FrameView* frameView = m_renderView->frameView();
     IntPoint scrollPosition = frameView->scrollPosition();
 
-    if (TiledBacking* tiledBacking = frameView->tiledBacking()) {
-        IntRect visibleContentRect = frameView->visibleContentRect(false /* exclude scrollbars */);
-        visibleContentRect.move(toSize(frameView->scrollOrigin()));
-        tiledBacking->setVisibleRect(visibleContentRect);
-    }
-
     if (!m_scrollLayer)
         return;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to