Title: [109853] tags/Safari-536.2.1/Source/WebCore

Diff

Modified: tags/Safari-536.2.1/Source/WebCore/ChangeLog (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/ChangeLog	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/ChangeLog	2012-03-06 05:19:00 UTC (rev 109853)
@@ -1,5 +1,44 @@
 2011-03-05  Lucas Forschler  <[email protected]>
 
+    Merge 109788
+
+    2012-03-05  Anders Carlsson  <[email protected]>
+
+            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):
+
+2011-03-05  Lucas Forschler  <[email protected]>
+
     Merge 109594
 
     2012-03-02  Maciej Stachowiak  <[email protected]>

Modified: tags/Safari-536.2.1/Source/WebCore/platform/graphics/GraphicsLayer.h (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-03-06 05:19:00 UTC (rev 109853)
@@ -428,7 +428,7 @@
     bool usingTiledLayer() const { return m_usingTiledLayer; }
 
     // Called whenever the visible rect of the given GraphicsLayer changed.
-    virtual void visibleRectChanged() { }
+    virtual void visibleRectChanged(const IntRect&) { }
 
 #if PLATFORM(QT) || PLATFORM(GTK)
     // This allows several alternative GraphicsLayer implementations in the same port,

Modified: tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-03-06 05:19:00 UTC (rev 109853)
@@ -859,9 +859,9 @@
     commitLayerChangesAfterSublayers();
 }
 
-void GraphicsLayerCA::visibleRectChanged()
+void GraphicsLayerCA::visibleRectChanged(const IntRect& visibleRect)
 {
-    m_layer->visibleRectChanged();
+    m_layer->visibleRectChanged(visibleRect);
 }
 
 void GraphicsLayerCA::recursiveCommitChanges(const TransformState& state, float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool affectedByPageScale)

Modified: tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2012-03-06 05:19:00 UTC (rev 109853)
@@ -134,7 +134,7 @@
     virtual void syncCompositingState(const FloatRect&);
     virtual void syncCompositingStateForThisLayerOnly();
 
-    virtual void visibleRectChanged() OVERRIDE;
+    virtual void visibleRectChanged(const IntRect&) OVERRIDE;
 
     bool allowTiledLayer() const { return m_allowTiledLayer; }
     virtual void setAllowTiledLayer(bool b);

Modified: tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2012-03-06 05:19:00 UTC (rev 109853)
@@ -203,7 +203,7 @@
     float contentsScale() const;
     void setContentsScale(float);
 
-    void visibleRectChanged();
+    void visibleRectChanged(const IntRect&);
 
 #if PLATFORM(WIN)
     HashMap<String, RefPtr<PlatformCAAnimation> >& animations() { return m_animations; }

Modified: tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2012-03-06 05:19:00 UTC (rev 109853)
@@ -956,13 +956,13 @@
 #endif
 }
 
-void PlatformCALayer::visibleRectChanged()
+void PlatformCALayer::visibleRectChanged(const IntRect& visibleRect)
 {
     if (m_layerType != LayerTypeTileCacheLayer)
         return;
 
     WebTileCacheLayer *tileCacheLayer = static_cast<WebTileCacheLayer *>(m_layer.get());
-    [tileCacheLayer visibleRectChanged];
+    [tileCacheLayer visibleRectChanged:visibleRect];
 }
 
 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)

Modified: tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/TileCache.h (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2012-03-06 05:19:00 UTC (rev 109853)
@@ -62,7 +62,7 @@
     void setAcceleratesDrawing(bool);
 
     CALayer *tileContainerLayer() const { return m_tileContainerLayer.get(); }
-    void visibleRectChanged();
+    void visibleRectChanged(const IntRect&);
 
     float tileDebugBorderWidth() const { return m_tileDebugBorderWidth; }
     void setTileDebugBorderWidth(float);
@@ -75,7 +75,6 @@
 
     TileCache(WebTileCacheLayer*, const IntSize& tileSize);
 
-    FloatRect visibleRect() const;
     IntRect bounds() const;
 
     IntRect rectForTileIndex(const TileIndex&) const;
@@ -93,6 +92,7 @@
     WebTileCacheLayer* m_tileCacheLayer;
     RetainPtr<CALayer> m_tileContainerLayer;
     const IntSize m_tileSize;
+    IntRect m_visibleRect;
 
     typedef HashMap<TileIndex, RetainPtr<WebTileLayer> > TileMap;
     TileMap m_tiles;

Modified: tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-03-06 05:19:00 UTC (rev 109853)
@@ -193,9 +193,13 @@
 #endif
 }
 
-void TileCache::visibleRectChanged()
+void TileCache::visibleRectChanged(const IntRect& visibleRect)
 {
-    scheduleTileRevalidation();
+    if (m_visibleRect == visibleRect)
+        return;
+
+    m_visibleRect = visibleRect;
+    revalidateTiles();
 }
 
 void TileCache::setTileDebugBorderWidth(float borderWidth)
@@ -218,28 +222,6 @@
         [it->second.get() setBorderColor:m_tileDebugBorderColor.get()];
 }
 
-FloatRect TileCache::visibleRect() const
-{
-    CGRect rect = [m_tileCacheLayer bounds];
-
-    CALayer *layer = m_tileCacheLayer;
-    CALayer *superlayer = [layer superlayer];
-
-    while (superlayer) {
-        CGRect rectInSuperlayerCoordinates = [superlayer convertRect:rect fromLayer:layer];
-
-        if ([superlayer masksToBounds])
-            rect = CGRectIntersection([superlayer bounds], rectInSuperlayerCoordinates);
-        else
-            rect = rectInSuperlayerCoordinates;
-
-        layer = superlayer;
-        superlayer = [layer superlayer];
-    }
-
-    return [m_tileCacheLayer convertRect:rect fromLayer:layer];
-}
-
 IntRect TileCache::bounds() const
 {
     return IntRect(IntPoint(), IntSize([m_tileCacheLayer bounds].size));
@@ -281,10 +263,11 @@
     if (!platformLayer)
         return;
 
-    IntRect tileCoverageRect = enclosingIntRect(visibleRect());
-    if (tileCoverageRect.isEmpty())
+    if (m_visibleRect.isEmpty())
         return;
 
+    IntRect tileCoverageRect = m_visibleRect;
+
     // Inflate the coverage rect so that it covers 2x of the visible width and 3x of the visible height.
     // These values were chosen because it's more common to have tall pages and to scroll vertically,
     // so we keep more tiles above and below the current area.

Modified: tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h	2012-03-06 05:19:00 UTC (rev 109853)
@@ -27,6 +27,7 @@
 #import <wtf/OwnPtr.h>
 
 namespace WebCore {
+    class IntRect;
     class TileCache;
 }
 
@@ -35,6 +36,6 @@
 }
 
 - (CALayer *)tileContainerLayer;
-- (void)visibleRectChanged;
+- (void)visibleRectChanged:(const WebCore::IntRect&)visibleRect;
 
 @end

Modified: tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm	2012-03-06 05:19:00 UTC (rev 109853)
@@ -120,9 +120,9 @@
     return _tileCache->tileContainerLayer();
 }
 
-- (void)visibleRectChanged
+- (void)visibleRectChanged:(const IntRect&)visibleRect
 {
-    _tileCache->visibleRectChanged();
+    _tileCache->visibleRectChanged(visibleRect);
 }
 
 - (CGColorRef)borderColor

Modified: tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2012-03-06 05:19:00 UTC (rev 109853)
@@ -633,7 +633,7 @@
 {
 }
 
-void PlatformCALayer::visibleRectChanged()
+void PlatformCALayer::visibleRectChanged(const IntRect&)
 {
 }
 

Modified: tags/Safari-536.2.1/Source/WebCore/rendering/RenderLayerCompositor.cpp (109852 => 109853)


--- tags/Safari-536.2.1/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-03-06 05:15:47 UTC (rev 109852)
+++ tags/Safari-536.2.1/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-03-06 05:19:00 UTC (rev 109853)
@@ -978,7 +978,7 @@
     IntPoint scrollPosition = frameView->scrollPosition();
 
     if (RenderLayerBacking* backing = rootRenderLayer()->backing())
-        backing->graphicsLayer()->visibleRectChanged();
+        backing->graphicsLayer()->visibleRectChanged(frameView->visibleContentRect(false /* exclude scrollbars */));
 
     if (!m_scrollLayer)
         return;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to