Changeset 132542 in webkit


Ignore:
Timestamp:
Oct 25, 2012 4:13:25 PM (12 years ago)
Author:
Simon Fraser
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:
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r132541 r132542  
     12012-10-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Tiled layers are missing content on zooming
     4        https://bugs.webkit.org/show_bug.cgi?id=100422
     5
     6        Reviewed by Beth Dakin.
     7
     8        New test for zooming with a tiled layer, and adjust an existing result.
     9       
     10        * compositing/tiling/tile-cache-zoomed-expected.txt: Added.
     11        * compositing/tiling/tile-cache-zoomed.html: Added.
     12        * platform/mac/tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt:
     13
    1142012-10-25  Roger Fong  <roger_fong@apple.com>
    215
  • trunk/LayoutTests/platform/mac/tiled-drawing/tile-coverage-scroll-to-bottom-expected.txt

    r132524 r132542  
    88      (backgroundColor #FFFFFF)
    99      (visible rect 0.00, 5000.00 785.00 x 21.00)
    10       (tile cache coverage 0, 4096 785 x 925)
     10      (tile cache coverage 0, 4608 785 x 413)
    1111      (tile size 512 x 512)
    1212      (children 1
  • trunk/Source/WebCore/ChangeLog

    r132540 r132542  
     12012-10-25  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Tiled layers are missing content on zooming
     4        https://bugs.webkit.org/show_bug.cgi?id=100422
     5
     6        Reviewed by Beth Dakin.
     7
     8        Tiled layers using TileCaches were missing content after
     9        zooming. TileCache was confused in the presence of scaling;
     10        it unapplies the scale on the layer above the tiles (so the tiles
     11        live in screen space), and computed the tile coverage rect
     12        in these tile coordinates. This worked for the page tile cache,
     13        because its visibleRect was sent in pre-scaled. However, for
     14        tiled layer TileCaches this was wrong.
     15       
     16        Fix by scaling the tile coverage rect by m_scale before
     17        using it to compute which tiles to throw away and bring in.
     18       
     19        To fix the problem of the visibleRect being pre-scaled
     20        for the page tile cache, remove the setting of the visibleRect
     21        in RenderLayerCompositor::frameViewDidScroll(), and rely on
     22        GraphicsLayerCA::updateVisibleRect() which computes the
     23        visible rect in the correct, layer coordinates.
     24
     25        Test: compositing/tiling/tile-cache-zoomed.html
     26
     27        * platform/graphics/ca/GraphicsLayerCA.cpp:
     28        (WebCore::GraphicsLayerCA::updateVisibleRect): Call setVisibleRect()
     29        for all tile cache layers, not just tiled layer ones, but only do
     30        the visible rect adjustment for those that are not the page tile cache.
     31        * platform/graphics/ca/mac/TileCache.mm:
     32        (WebCore::TileCache::revalidateTiles): Use a coverageRectInTileCoords rect,
     33        which is scaled to be in the same coordinate space as the tile grid.
     34        * rendering/RenderLayerCompositor.cpp:
     35        (WebCore::RenderLayerCompositor::frameViewDidScroll): Remove the code
     36        that sets the setVisibleRect() on the TiledBacking.
     37
    1382012-10-25  Adam Barth  <abarth@webkit.org>
    239
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r132524 r132542  
    15941594void GraphicsLayerCA::updateVisibleRect(const FloatRect& oldVisibleRect)
    15951595{
    1596     if (m_layer->layerType() != PlatformCALayer::LayerTypeTileCacheLayer)
    1597         return;
    1598 
    1599     FloatRect tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, m_sizeAtLastVisibleRectUpdate);
     1596    if (!m_layer->usesTileCacheLayer())
     1597        return;
     1598
     1599    FloatRect tileArea = m_visibleRect;
     1600    if (m_layer->layerType() == PlatformCALayer::LayerTypeTileCacheLayer)
     1601        tileArea = adjustTiledLayerVisibleRect(tiledBacking(), oldVisibleRect, m_sizeAtLastVisibleRectUpdate);
     1602
    16001603    tiledBacking()->setVisibleRect(enclosingIntRect(tileArea));
    16011604
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm

    r132537 r132542  
    393393
    394394    IntRect tileCoverageRect = computeTileCoverageRect();
     395    IntRect coverageRectInTileCoords(tileCoverageRect);
     396    coverageRectInTileCoords.scale(m_scale);
    395397
    396398    IntSize oldTileSize = m_tileSize;
     
    405407        WebTileLayer* tileLayer = it->value.get();
    406408
    407         if (!rectForTileIndex(tileIndex).intersects(tileCoverageRect) || tileSizeChanged) {
     409        if (!rectForTileIndex(tileIndex).intersects(coverageRectInTileCoords) || tileSizeChanged) {
    408410            // Remove this layer.
    409411            [tileLayer removeFromSuperlayer];
     
    422424    TileIndex topLeft;
    423425    TileIndex bottomRight;
    424     getTileIndexRangeForRect(tileCoverageRect, topLeft, bottomRight);
     426    getTileIndexRangeForRect(coverageRectInTileCoords, topLeft, bottomRight);
    425427
    426428    Vector<FloatRect> dirtyRects;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r132504 r132542  
    11011101    IntPoint scrollPosition = frameView->scrollPosition();
    11021102
    1103     if (TiledBacking* tiledBacking = frameView->tiledBacking()) {
    1104         IntRect visibleContentRect = frameView->visibleContentRect(false /* exclude scrollbars */);
    1105         visibleContentRect.move(toSize(frameView->scrollOrigin()));
    1106         tiledBacking->setVisibleRect(visibleContentRect);
    1107     }
    1108 
    11091103    if (!m_scrollLayer)
    11101104        return;
Note: See TracChangeset for help on using the changeset viewer.