Diff
Modified: trunk/Source/WebCore/ChangeLog (127479 => 127480)
--- trunk/Source/WebCore/ChangeLog 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/ChangeLog 2012-09-04 18:54:00 UTC (rev 127480)
@@ -1,3 +1,50 @@
+2012-09-04 Sami Kyostila <[email protected]>
+
+ Register scrolling layers with ScrollingCoordinator
+ https://bugs.webkit.org/show_bug.cgi?id=78862
+
+ Reviewed by James Robinson.
+
+ In order to allow scrollable child layers to be scrolled off the main
+ thread, register them with the ScrollingCoordinator. These layers are
+ also removed from the non-fast scrollable region.
+
+ Whenever the scroll offset or other scroll geometry related attribute of
+ a compositor scrolled layer changes, the ScrollingCoordinator is
+ informed to allow it to update its internal representation of the
+ scrollable layer.
+
+ No tests because the ScrollingCoordinator is currently not testable.
+
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::computeNonFastScrollableRegion): Composited scrolling layers
+ can be scrolled off the main thread.
+ (WebCore):
+ (WebCore::ScrollingCoordinator::scrollableAreaScrollLayerDidChange):
+ Callback to ScrollingCoordinator about changes the composited scrolling layers.
+ * page/scrolling/ScrollingCoordinator.h:
+ (WebCore):
+ (ScrollingCoordinator):
+ * page/scrolling/ScrollingCoordinatorNone.cpp:
+ (WebCore):
+ (WebCore::ScrollingCoordinator::scrollableAreaScrollLayerDidChange):
+ * platform/ScrollableArea.h:
+ (WebCore::ScrollableArea::usesCompositedScrolling):
+ * rendering/RenderLayer.cpp:
+ (WebCore):
+ (WebCore::RenderLayer::usesCompositedScrolling):
+ * rendering/RenderLayer.h:
+ (RenderLayer):
+ (WebCore::RenderLayer::usesCompositedScrolling):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+ (WebCore::RenderLayerBacking::updateScrollingLayers):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::scrollingLayerDidChange):
+ (WebCore):
+ * rendering/RenderLayerCompositor.h:
+ (RenderLayerCompositor):
+
2012-09-04 Brian Anderson <[email protected]>
[chromium] Do not allow infinite pending frames in CCFrameRateController
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (127479 => 127480)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp 2012-09-04 18:54:00 UTC (rev 127480)
@@ -118,6 +118,11 @@
if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
for (FrameView::ScrollableAreaSet::const_iterator it = scrollableAreas->begin(), end = scrollableAreas->end(); it != end; ++it) {
ScrollableArea* scrollableArea = *it;
+#if USE(ACCELERATED_COMPOSITING)
+ // Composited scrollable areas can be scrolled off the main thread.
+ if (scrollableArea->usesCompositedScrolling())
+ continue;
+#endif
IntRect box = scrollableArea->scrollableAreaBoundingBox();
box.moveBy(offset);
nonFastScrollableRegion.unite(box);
@@ -488,6 +493,11 @@
{
// FIXME: Implement!
}
+
+void ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea*, GraphicsLayer*)
+{
+ // FIXME: Implement.
+}
#endif // !ENABLE(THREADED_SCROLLING)
} // namespace WebCore
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (127479 => 127480)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2012-09-04 18:54:00 UTC (rev 127480)
@@ -48,6 +48,7 @@
class GraphicsLayer;
class Page;
class Region;
+class ScrollableArea;
class ScrollingCoordinatorPrivate;
class ScrollingTreeState;
@@ -92,6 +93,9 @@
// Should be called whenever the vertical scrollbar layer for the given frame view changes.
void frameViewVerticalScrollbarLayerDidChange(FrameView*, GraphicsLayer* verticalScrollbarLayer);
+ // Should be called whenever the scrollable layer for the given scroll area changes.
+ void scrollableAreaScrollLayerDidChange(ScrollableArea*, GraphicsLayer*);
+
// Requests that the scrolling coordinator updates the scroll position of the given frame view. If this function returns true, it means that the
// position will be updated asynchronously. If it returns false, the caller should update the scrolling position itself.
bool requestScrollPositionUpdate(FrameView*, const IntPoint&);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorNone.cpp (127479 => 127480)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorNone.cpp 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinatorNone.cpp 2012-09-04 18:54:00 UTC (rev 127480)
@@ -83,6 +83,10 @@
void ScrollingCoordinator::setLayerIsFixedToContainerLayer(GraphicsLayer*, bool)
{
}
+
+void ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea*, GraphicsLayer*)
+{
+}
#endif // !ENABLE(THREADED_SCROLLING)
}
Modified: trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp (127479 => 127480)
--- trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/page/scrolling/chromium/ScrollingCoordinatorChromium.cpp 2012-09-04 18:54:00 UTC (rev 127480)
@@ -246,4 +246,9 @@
scrollableLayer->setFixedToContainerLayer(enable);
}
+void ScrollingCoordinator::scrollableAreaScrollLayerDidChange(ScrollableArea*, GraphicsLayer*)
+{
+ // FIXME: Implement.
}
+
+}
Modified: trunk/Source/WebCore/platform/ScrollableArea.h (127479 => 127480)
--- trunk/Source/WebCore/platform/ScrollableArea.h 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/platform/ScrollableArea.h 2012-09-04 18:54:00 UTC (rev 127480)
@@ -169,6 +169,7 @@
#if USE(ACCELERATED_COMPOSITING)
virtual TiledBacking* tiledBacking() { return 0; }
+ virtual bool usesCompositedScrolling() const { return false; }
#endif
protected:
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (127479 => 127480)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2012-09-04 18:54:00 UTC (rev 127480)
@@ -1567,9 +1567,9 @@
rect.move(-delta.x(), -delta.y());
}
+#if USE(ACCELERATED_COMPOSITING)
bool RenderLayer::usesCompositedScrolling() const
{
-#if USE(ACCELERATED_COMPOSITING)
if (!scrollsOverflow() || !allowsScrolling())
return false;
@@ -1578,10 +1578,8 @@
#else
return false;
#endif
-#else
- return false;
-#endif
}
+#endif
static inline int adjustedScrollDelta(int beginningDelta) {
// This implemention matches Firefox's.
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (127479 => 127480)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2012-09-04 18:54:00 UTC (rev 127480)
@@ -363,7 +363,6 @@
void paintResizer(GraphicsContext*, const IntPoint&, const IntRect& damageRect);
void updateScrollInfoAfterLayout();
- bool usesCompositedScrolling() const;
bool scroll(ScrollDirection, ScrollGranularity, float multiplier = 1);
void autoscroll();
@@ -635,9 +634,11 @@
virtual GraphicsLayer* layerForHorizontalScrollbar() const;
virtual GraphicsLayer* layerForVerticalScrollbar() const;
virtual GraphicsLayer* layerForScrollCorner() const;
+ virtual bool usesCompositedScrolling() const OVERRIDE;
#else
bool isComposited() const { return false; }
bool hasCompositedMask() const { return false; }
+ bool usesCompositedScrolling() const { return false; }
#endif
bool paintsWithTransparency(PaintBehavior paintBehavior) const
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (127479 => 127480)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-09-04 18:54:00 UTC (rev 127480)
@@ -671,10 +671,14 @@
if (scrollSize != m_scrollingContentsLayer->size() || paddingBoxOffsetChanged)
m_scrollingContentsLayer->setNeedsDisplay();
+ IntSize scrollingContentsOffset = paddingBox.location() - IntPoint() - scrollOffset;
+ if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer() || scrollSize != m_scrollingContentsLayer->size())
+ compositor()->scrollingLayerDidChange(m_owningLayer);
+
m_scrollingContentsLayer->setSize(scrollSize);
// FIXME: Scrolling the content layer does not need to trigger a repaint. The offset will be compensated away during painting.
// FIXME: The paint offset and the scroll offset should really be separate concepts.
- m_scrollingContentsLayer->setOffsetFromRenderer(paddingBox.location() - IntPoint() - scrollOffset);
+ m_scrollingContentsLayer->setOffsetFromRenderer(scrollingContentsOffset);
}
m_graphicsLayer->setContentsRect(contentsBox());
@@ -917,6 +921,8 @@
updateInternalHierarchy();
m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
m_graphicsLayer->setNeedsDisplay();
+ if (renderer()->view())
+ compositor()->scrollingLayerDidChange(m_owningLayer);
}
return layerChanged;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (127479 => 127480)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2012-09-04 18:54:00 UTC (rev 127480)
@@ -1092,6 +1092,13 @@
m_scrollLayer->setPosition(FloatPoint(-scrollPosition.x(), -scrollPosition.y()));
}
+void RenderLayerCompositor::scrollingLayerDidChange(RenderLayer* layer)
+{
+ RenderLayerBacking* backing = layer->backing();
+ if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+ scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer, backing ? backing->scrollingContentsLayer() : 0);
+}
+
String RenderLayerCompositor::layerTreeAsText(bool showDebugInfo)
{
updateCompositingLayers(CompositingUpdateAfterLayout);
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (127479 => 127480)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2012-09-04 18:46:21 UTC (rev 127479)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2012-09-04 18:54:00 UTC (rev 127480)
@@ -192,6 +192,8 @@
void frameViewDidChangeSize();
void frameViewDidScroll();
+ void scrollingLayerDidChange(RenderLayer*);
+
String layerTreeAsText(bool showDebugInfo = false);
// These are named to avoid conflicts with the functions in GraphicsLayerClient