Changeset 109788 in webkit


Ignore:
Timestamp:
Mar 5, 2012 1:10:23 PM (12 years ago)
Author:
andersca@apple.com
Message:

Let RenderLayerCompositor set the tile cache visible rect
https://bugs.webkit.org/show_bug.cgi?id=80317

Reviewed by Simon Fraser.

We can't compute the visible rect from CALayers, because that breaks when we're updating
the scroll layer position on the main thread (since by the time visibleRectChanged() is called,
the CALayers won't yet have been updated).

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::visibleRectChanged):

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::visibleRectChanged):

  • platform/graphics/ca/GraphicsLayerCA.h:

(GraphicsLayerCA):

  • platform/graphics/ca/PlatformCALayer.h:

(PlatformCALayer):

  • platform/graphics/ca/mac/PlatformCALayerMac.mm:

(PlatformCALayer::visibleRectChanged):

  • platform/graphics/ca/mac/TileCache.h:

(TileCache):

  • platform/graphics/ca/mac/TileCache.mm:

(WebCore::TileCache::visibleRectChanged):
(WebCore::TileCache::revalidateTiles):

  • platform/graphics/ca/mac/WebTileCacheLayer.h:

(WebCore):

  • platform/graphics/ca/mac/WebTileCacheLayer.mm:

(-[WebTileCacheLayer visibleRectChanged:]):

  • platform/graphics/ca/win/PlatformCALayerWin.cpp:

(PlatformCALayer::visibleRectChanged):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::frameViewDidScroll):

Location:
trunk/Source/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r109787 r109788  
     12012-03-05  Anders Carlsson  <andersca@apple.com>
     2
     3        Let RenderLayerCompositor set the tile cache visible rect
     4        https://bugs.webkit.org/show_bug.cgi?id=80317
     5
     6        Reviewed by Simon Fraser.
     7
     8        We can't compute the visible rect from CALayers, because that breaks when we're updating
     9        the scroll layer position on the main thread (since by the time visibleRectChanged() is called,
     10        the CALayers won't yet have been updated).
     11
     12        * platform/graphics/GraphicsLayer.h:
     13        (WebCore::GraphicsLayer::visibleRectChanged):
     14        * platform/graphics/ca/GraphicsLayerCA.cpp:
     15        (WebCore::GraphicsLayerCA::visibleRectChanged):
     16        * platform/graphics/ca/GraphicsLayerCA.h:
     17        (GraphicsLayerCA):
     18        * platform/graphics/ca/PlatformCALayer.h:
     19        (PlatformCALayer):
     20        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
     21        (PlatformCALayer::visibleRectChanged):
     22        * platform/graphics/ca/mac/TileCache.h:
     23        (TileCache):
     24        * platform/graphics/ca/mac/TileCache.mm:
     25        (WebCore::TileCache::visibleRectChanged):
     26        (WebCore::TileCache::revalidateTiles):
     27        * platform/graphics/ca/mac/WebTileCacheLayer.h:
     28        (WebCore):
     29        * platform/graphics/ca/mac/WebTileCacheLayer.mm:
     30        (-[WebTileCacheLayer visibleRectChanged:]):
     31        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
     32        (PlatformCALayer::visibleRectChanged):
     33        * rendering/RenderLayerCompositor.cpp:
     34        (WebCore::RenderLayerCompositor::frameViewDidScroll):
     35
    1362012-03-05  Kangil Han  <kangil.han@samsung.com>
    237
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r107422 r109788  
    429429
    430430    // Called whenever the visible rect of the given GraphicsLayer changed.
    431     virtual void visibleRectChanged() { }
     431    virtual void visibleRectChanged(const IntRect&) { }
    432432
    433433#if PLATFORM(QT) || PLATFORM(GTK)
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r107657 r109788  
    860860}
    861861
    862 void GraphicsLayerCA::visibleRectChanged()
    863 {
    864     m_layer->visibleRectChanged();
     862void GraphicsLayerCA::visibleRectChanged(const IntRect& visibleRect)
     863{
     864    m_layer->visibleRectChanged(visibleRect);
    865865}
    866866
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r107422 r109788  
    135135    virtual void syncCompositingStateForThisLayerOnly();
    136136
    137     virtual void visibleRectChanged() OVERRIDE;
     137    virtual void visibleRectChanged(const IntRect&) OVERRIDE;
    138138
    139139    bool allowTiledLayer() const { return m_allowTiledLayer; }
  • trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h

    r106385 r109788  
    204204    void setContentsScale(float);
    205205
    206     void visibleRectChanged();
     206    void visibleRectChanged(const IntRect&);
    207207
    208208#if PLATFORM(WIN)
  • trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm

    r106385 r109788  
    957957}
    958958
    959 void PlatformCALayer::visibleRectChanged()
     959void PlatformCALayer::visibleRectChanged(const IntRect& visibleRect)
    960960{
    961961    if (m_layerType != LayerTypeTileCacheLayer)
     
    963963
    964964    WebTileCacheLayer *tileCacheLayer = static_cast<WebTileCacheLayer *>(m_layer.get());
    965     [tileCacheLayer visibleRectChanged];
     965    [tileCacheLayer visibleRectChanged:visibleRect];
    966966}
    967967
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h

    r108397 r109788  
    6363
    6464    CALayer *tileContainerLayer() const { return m_tileContainerLayer.get(); }
    65     void visibleRectChanged();
     65    void visibleRectChanged(const IntRect&);
    6666
    6767    float tileDebugBorderWidth() const { return m_tileDebugBorderWidth; }
     
    7676    TileCache(WebTileCacheLayer*, const IntSize& tileSize);
    7777
    78     FloatRect visibleRect() const;
    7978    IntRect bounds() const;
    8079
     
    9493    RetainPtr<CALayer> m_tileContainerLayer;
    9594    const IntSize m_tileSize;
     95    IntRect m_visibleRect;
    9696
    9797    typedef HashMap<TileIndex, RetainPtr<WebTileLayer> > TileMap;
  • trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm

    r108825 r109788  
    194194}
    195195
    196 void TileCache::visibleRectChanged()
    197 {
    198     scheduleTileRevalidation();
     196void TileCache::visibleRectChanged(const IntRect& visibleRect)
     197{
     198    if (m_visibleRect == visibleRect)
     199        return;
     200
     201    m_visibleRect = visibleRect;
     202    revalidateTiles();
    199203}
    200204
     
    217221    for (TileMap::const_iterator it = m_tiles.begin(), end = m_tiles.end(); it != end; ++it)
    218222        [it->second.get() setBorderColor:m_tileDebugBorderColor.get()];
    219 }
    220 
    221 FloatRect TileCache::visibleRect() const
    222 {
    223     CGRect rect = [m_tileCacheLayer bounds];
    224 
    225     CALayer *layer = m_tileCacheLayer;
    226     CALayer *superlayer = [layer superlayer];
    227 
    228     while (superlayer) {
    229         CGRect rectInSuperlayerCoordinates = [superlayer convertRect:rect fromLayer:layer];
    230 
    231         if ([superlayer masksToBounds])
    232             rect = CGRectIntersection([superlayer bounds], rectInSuperlayerCoordinates);
    233         else
    234             rect = rectInSuperlayerCoordinates;
    235 
    236         layer = superlayer;
    237         superlayer = [layer superlayer];
    238     }
    239 
    240     return [m_tileCacheLayer convertRect:rect fromLayer:layer];
    241223}
    242224
     
    282264        return;
    283265
    284     IntRect tileCoverageRect = enclosingIntRect(visibleRect());
    285     if (tileCoverageRect.isEmpty())
    286         return;
     266    if (m_visibleRect.isEmpty())
     267        return;
     268
     269    IntRect tileCoverageRect = m_visibleRect;
    287270
    288271    // Inflate the coverage rect so that it covers 2x of the visible width and 3x of the visible height.
  • trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h

    r106385 r109788  
    2828
    2929namespace WebCore {
     30    class IntRect;
    3031    class TileCache;
    3132}
     
    3637
    3738- (CALayer *)tileContainerLayer;
    38 - (void)visibleRectChanged;
     39- (void)visibleRectChanged:(const WebCore::IntRect&)visibleRect;
    3940
    4041@end
  • trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm

    r109486 r109788  
    121121}
    122122
    123 - (void)visibleRectChanged
     123- (void)visibleRectChanged:(const IntRect&)visibleRect
    124124{
    125     _tileCache->visibleRectChanged();
     125    _tileCache->visibleRectChanged(visibleRect);
    126126}
    127127
  • trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp

    r107900 r109788  
    634634}
    635635
    636 void PlatformCALayer::visibleRectChanged()
     636void PlatformCALayer::visibleRectChanged(const IntRect&)
    637637{
    638638}
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r108422 r109788  
    979979
    980980    if (RenderLayerBacking* backing = rootRenderLayer()->backing())
    981         backing->graphicsLayer()->visibleRectChanged();
     981        backing->graphicsLayer()->visibleRectChanged(frameView->visibleContentRect(false /* exclude scrollbars */));
    982982
    983983    if (!m_scrollLayer)
Note: See TracChangeset for help on using the changeset viewer.