Diff
Modified: trunk/Source/WebCore/ChangeLog (106384 => 106385)
--- trunk/Source/WebCore/ChangeLog 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/ChangeLog 2012-01-31 21:31:17 UTC (rev 106385)
@@ -1,3 +1,43 @@
+2012-01-31 Anders Carlsson <[email protected]>
+
+ Inform the tile cache whenever the visible rect changes
+ https://bugs.webkit.org/show_bug.cgi?id=77470
+
+ Reviewed by Andreas Kling.
+
+ * platform/graphics/GraphicsLayer.h:
+ (WebCore::GraphicsLayer::visibleRectChanged):
+ Add empty function.
+
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::visibleRectChanged):
+ Call through to the PlatformCALayer.
+
+ * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+ (PlatformCALayer::visibleRectChanged):
+ Call through to the underlying WebTileCacheLayer.
+
+ * platform/graphics/ca/mac/TileCache.mm:
+ (WebCore::TileCache::visibleRectChanged):
+ Add empty stub.
+
+ (WebCore::TileCache::visibleRect):
+ Add new (currently unused) helper function that returns the visible rect of the
+ tile cache layer.
+
+ * platform/graphics/ca/mac/WebTileCacheLayer.h:
+ * platform/graphics/ca/mac/WebTileCacheLayer.mm:
+ (-[WebTileCacheLayer visibleRectChanged]):
+ Call through to the TielCache object.
+
+ * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+ (PlatformCALayer::visibleRectChanged):
+ Add stub.
+
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::frameViewDidScroll):
+ Call GraphicsLayer::visibleRectChanged.
+
2012-01-31 Antti Koivisto <[email protected]>
Remove CSSStyleDeclaration isElementStyleDeclaration bit
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (106384 => 106385)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2012-01-31 21:31:17 UTC (rev 106385)
@@ -408,6 +408,9 @@
bool usingTiledLayer() const { return m_usingTiledLayer; }
+ // Called whenever the visible rect of the given GraphicsLayer changed.
+ virtual void visibleRectChanged() { }
+
#if PLATFORM(QT) || PLATFORM(GTK)
// This allows several alternative GraphicsLayer implementations in the same port,
// e.g. if a different GraphicsLayer implementation is needed in WebKit1 vs. WebKit2.
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (106384 => 106385)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2012-01-31 21:31:17 UTC (rev 106385)
@@ -843,6 +843,11 @@
commitLayerChangesAfterSublayers();
}
+void GraphicsLayerCA::visibleRectChanged()
+{
+ m_layer->visibleRectChanged();
+}
+
void GraphicsLayerCA::recursiveCommitChanges(const TransformState& state, float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool affectedByPageScale)
{
// Save the state before sending down to kids and restore it after
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (106384 => 106385)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2012-01-31 21:31:17 UTC (rev 106385)
@@ -134,6 +134,8 @@
virtual void syncCompositingState(const FloatRect&);
virtual void syncCompositingStateForThisLayerOnly();
+ virtual void visibleRectChanged() OVERRIDE;
+
bool allowTiledLayer() const { return m_allowTiledLayer; }
virtual void setAllowTiledLayer(bool b);
Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (106384 => 106385)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2012-01-31 21:31:17 UTC (rev 106385)
@@ -203,6 +203,8 @@
float contentsScale() const;
void setContentsScale(float);
+ void visibleRectChanged();
+
#if PLATFORM(WIN)
HashMap<String, RefPtr<PlatformCAAnimation> >& animations() { return m_animations; }
#endif
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (106384 => 106385)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2012-01-31 21:31:17 UTC (rev 106385)
@@ -956,6 +956,15 @@
#endif
}
+void PlatformCALayer::visibleRectChanged()
+{
+ if (m_layerType != LayerTypeTileCacheLayer)
+ return;
+
+ WebTileCacheLayer *tileCacheLayer = static_cast<WebTileCacheLayer *>(m_layer.get());
+ [tileCacheLayer visibleRectChanged];
+}
+
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
void PlatformCALayer::synchronouslyDisplayTilesInRect(const FloatRect& rect)
{
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h (106384 => 106385)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h 2012-01-31 21:31:17 UTC (rev 106385)
@@ -37,6 +37,7 @@
namespace WebCore {
+class FloatRect;
class IntPoint;
class IntRect;
@@ -56,6 +57,7 @@
void setAcceleratesDrawing(bool);
CALayer *tileContainerLayer() const { return m_tileContainerLayer.get(); }
+ void visibleRectChanged();
float tileDebugBorderWidth() const { return m_tileDebugBorderWidth; }
void setTileDebugBorderWidth(float);
@@ -66,6 +68,8 @@
private:
TileCache(WebTileCacheLayer*, const IntSize& tileSize);
+ FloatRect visibleRect() const;
+
IntRect bounds() const;
void getTileRangeForRect(const IntRect&, IntPoint& topLeft, IntPoint& bottomRight);
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (106384 => 106385)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm 2012-01-31 21:31:17 UTC (rev 106385)
@@ -165,6 +165,11 @@
#endif
}
+void TileCache::visibleRectChanged()
+{
+ // FIXME: Implement.
+}
+
void TileCache::setTileDebugBorderWidth(float borderWidth)
{
if (m_tileDebugBorderWidth == borderWidth)
@@ -185,6 +190,28 @@
[tileLayer 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));
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h (106384 => 106385)
--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h 2012-01-31 21:31:17 UTC (rev 106385)
@@ -35,5 +35,6 @@
}
- (CALayer *)tileContainerLayer;
+- (void)visibleRectChanged;
@end
Modified: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm (106384 => 106385)
--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm 2012-01-31 21:31:17 UTC (rev 106385)
@@ -77,6 +77,11 @@
return _tileCache->tileContainerLayer();
}
+- (void)visibleRectChanged
+{
+ _tileCache->visibleRectChanged();
+}
+
- (CGColorRef)borderColor
{
return _tileCache->tileDebugBorderColor();
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (106384 => 106385)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp 2012-01-31 21:31:17 UTC (rev 106385)
@@ -620,6 +620,10 @@
{
}
+void PlatformCALayer::visibleRectChanged()
+{
+}
+
#ifndef NDEBUG
static void printIndent(int indent)
{
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (106384 => 106385)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-01-31 21:24:12 UTC (rev 106384)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-01-31 21:31:17 UTC (rev 106385)
@@ -984,6 +984,9 @@
FrameView* frameView = m_renderView->frameView();
LayoutPoint scrollPosition = frameView->scrollPosition();
+ if (RenderLayerBacking* backing = rootRenderLayer()->backing())
+ backing->graphicsLayer()->visibleRectChanged();
+
if (m_scrollLayer)
m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
}