Diff
Modified: trunk/Source/WebCore/ChangeLog (109787 => 109788)
--- trunk/Source/WebCore/ChangeLog 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/ChangeLog 2012-03-05 21:10:23 UTC (rev 109788)
@@ -1,3 +1,38 @@
+2012-03-05 Anders Carlsson <ander...@apple.com>
+
+ 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):
+
2012-03-05 Kangil Han <kangil....@samsung.com>
[CMake][DRT] Add WebCoreTestSupport.
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (109787 => 109788)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2012-03-05 21:10:23 UTC (rev 109788)
@@ -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: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (109787 => 109788)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2012-03-05 21:10:23 UTC (rev 109788)
@@ -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: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (109787 => 109788)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h 2012-03-05 21:10:23 UTC (rev 109788)
@@ -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: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (109787 => 109788)
--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h 2012-03-05 21:10:23 UTC (rev 109788)
@@ -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: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (109787 => 109788)
--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm 2012-03-05 21:10:23 UTC (rev 109788)
@@ -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: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h (109787 => 109788)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h 2012-03-05 21:10:23 UTC (rev 109788)
@@ -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: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (109787 => 109788)
--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm 2012-03-05 21:10:23 UTC (rev 109788)
@@ -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: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h (109787 => 109788)
--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h 2012-03-05 21:10:23 UTC (rev 109788)
@@ -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: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm (109787 => 109788)
--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm 2012-03-05 21:10:23 UTC (rev 109788)
@@ -120,9 +120,9 @@
return _tileCache->tileContainerLayer();
}
-- (void)visibleRectChanged
+- (void)visibleRectChanged:(const IntRect&)visibleRect
{
- _tileCache->visibleRectChanged();
+ _tileCache->visibleRectChanged(visibleRect);
}
- (CGColorRef)borderColor
Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (109787 => 109788)
--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp 2012-03-05 21:10:23 UTC (rev 109788)
@@ -633,7 +633,7 @@
{
}
-void PlatformCALayer::visibleRectChanged()
+void PlatformCALayer::visibleRectChanged(const IntRect&)
{
}
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (109787 => 109788)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-03-05 21:02:31 UTC (rev 109787)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-03-05 21:10:23 UTC (rev 109788)
@@ -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;