Diff
Modified: trunk/Source/WebCore/ChangeLog (166530 => 166531)
--- trunk/Source/WebCore/ChangeLog 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/ChangeLog 2014-03-31 21:23:27 UTC (rev 166531)
@@ -1,3 +1,49 @@
+2014-03-31 Simon Fraser <[email protected]>
+
+ [iOS WK2] Hook up scroll events for accelerated overflow:scroll
+ https://bugs.webkit.org/show_bug.cgi?id=130976
+
+ Reviewed by Tim Horton.
+
+ When an accelerated overflow:scroll is scrolled in the UI process,
+ tell the WebProcess that the scroll happened to update RenderLayer
+ state and fire events.
+
+ In the WebProcess, RemoteScrollingCoordinator gets a message from the
+ UI process and calls AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll().
+ Fixed that function to handle scrolling nodes other than the root, which
+ required storing a map of ScrollingNodeID->RenderLayer* on RenderLayerCompositor,
+ accessible through FrameView::scrollableAreaForScrollLayerID().
+
+ * WebCore.exp.in:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scrollableAreaForScrollLayerID):
+ * page/FrameView.h:
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll): Handle
+ overflow as well as main frame scrolling nodes.
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Use isScrollingNode().
+ (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling): When an overflow
+ scroll node was scrolled externally, we have to update layers in decendant nodes,
+ and then call scrollingTreeNodeDidScroll() which tells the ScrollingCoordinator that
+ we scrolled.
+ * page/scrolling/ScrollingTree.h: Try to reduce confusion between the roles played
+ by these various functions, some of which happen in the UI process with UI-side
+ compositing.
+ * page/scrolling/ScrollingTreeScrollingNode.h:
+ * page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h: Need some functions to be
+ callable by subclasses.
+ * page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm:
+ (WebCore::ScrollingTreeScrollingNodeIOS::updateLayersAfterDelegatedScroll):
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Add
+ scrolling layers to the m_scrollingNodeToLayerMap
+ (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer): Remove
+ layer from the m_scrollingNodeToLayerMap.
+ (WebCore::RenderLayerCompositor::scrollableAreaForScrollLayerID):
+ * rendering/RenderLayerCompositor.h:
+
2014-03-31 Antti Koivisto <[email protected]>
Rename TileCache to LegacyTileCache
Modified: trunk/Source/WebCore/WebCore.exp.in (166530 => 166531)
--- trunk/Source/WebCore/WebCore.exp.in 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-03-31 21:23:27 UTC (rev 166531)
@@ -2738,6 +2738,7 @@
__ZN7WebCore13ScrollingTree35shouldHandleWheelEventSynchronouslyERKNS_18PlatformWheelEventE
__ZN7WebCore13ScrollingTree36viewportChangedViaDelegatedScrollingEyRKNS_9FloatRectEd
__ZN7WebCore13ScrollingTree37setScrollingPerformanceLoggingEnabledEb
+__ZN7WebCore13ScrollingTree42scrollPositionChangedViaDelegatedScrollingEyRKNS_10FloatPointE
__ZN7WebCore13ScrollingTreeC2Ev
__ZN7WebCore13ScrollingTreeD1Ev
__ZN7WebCore13ScrollingTreeD2Ev
@@ -2801,6 +2802,7 @@
__ZN7WebCore29ScrollingTreeScrollingNodeIOS19updateAfterChildrenERKNS_18ScrollingStateNodeE
__ZN7WebCore29ScrollingTreeScrollingNodeIOS20updateBeforeChildrenERKNS_18ScrollingStateNodeE
__ZN7WebCore29ScrollingTreeScrollingNodeIOS31updateLayersAfterViewportChangeERKNS_9FloatRectEd
+__ZN7WebCore29ScrollingTreeScrollingNodeIOS32updateLayersAfterDelegatedScrollERKNS_10FloatPointE
__ZN7WebCore29ScrollingTreeScrollingNodeIOS46setScrollPositionWithoutContentEdgeConstraintsERKNS_10FloatPointE
__ZN7WebCore29ScrollingTreeScrollingNodeIOS6createERNS_13ScrollingTreeENS_17ScrollingNodeTypeEy
__ZN7WebCore29ScrollingTreeScrollingNodeIOSC2ERNS_13ScrollingTreeENS_17ScrollingNodeTypeEy
Modified: trunk/Source/WebCore/page/FrameView.cpp (166530 => 166531)
--- trunk/Source/WebCore/page/FrameView.cpp 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/page/FrameView.cpp 2014-03-31 21:23:27 UTC (rev 166531)
@@ -817,6 +817,15 @@
return backing->scrollingNodeID();
}
+ScrollableArea* FrameView::scrollableAreaForScrollLayerID(uint64_t nodeID) const
+{
+ RenderView* renderView = this->renderView();
+ if (!renderView)
+ return nullptr;
+
+ return renderView->compositor().scrollableAreaForScrollLayerID(nodeID);
+}
+
#if ENABLE(RUBBER_BANDING)
GraphicsLayer* FrameView::layerForOverhangAreas() const
{
Modified: trunk/Source/WebCore/page/FrameView.h (166530 => 166531)
--- trunk/Source/WebCore/page/FrameView.h 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/page/FrameView.h 2014-03-31 21:23:27 UTC (rev 166531)
@@ -156,6 +156,7 @@
// In the future when any ScrollableArea can have a node in th ScrollingTree, this should
// become a virtual function on ScrollableArea.
uint64_t scrollLayerID() const;
+ ScrollableArea* scrollableAreaForScrollLayerID(uint64_t) const;
bool hasCompositedContent() const;
bool hasCompositedContentIncludingDescendants() const;
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (166530 => 166531)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp 2014-03-31 21:23:27 UTC (rev 166531)
@@ -194,16 +194,17 @@
if (!frameView)
return;
- bool oldProgrammaticScroll = frameView->inProgrammaticScroll();
- frameView->setInProgrammaticScroll(programmaticScroll);
+ // Main frame.
+ if (scrollingNodeID == frameView->scrollLayerID()) {
+ bool oldProgrammaticScroll = frameView->inProgrammaticScroll();
+ frameView->setInProgrammaticScroll(programmaticScroll);
- frameView->setConstrainsScrollingToContentEdge(false);
- frameView->notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
- frameView->setConstrainsScrollingToContentEdge(true);
+ frameView->setConstrainsScrollingToContentEdge(false);
+ frameView->notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
+ frameView->setConstrainsScrollingToContentEdge(true);
- frameView->setInProgrammaticScroll(oldProgrammaticScroll);
+ frameView->setInProgrammaticScroll(oldProgrammaticScroll);
- if (scrollingNodeID == frameView->scrollLayerID()) {
if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
@@ -231,8 +232,13 @@
syncChildPositions(viewportRect);
}
}
+
+ return;
}
- // FIXME: handle non-main scrolling nodes.
+
+ // Overflow-scroll area.
+ if (ScrollableArea* scrollableArea = frameView->scrollableAreaForScrollLayerID(scrollingNodeID))
+ scrollableArea->scrollToOffsetWithoutAnimation(scrollPosition);
}
void AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea* scrollableArea, ScrollbarOrientation orientation)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (166530 => 166531)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2014-03-31 21:23:27 UTC (rev 166531)
@@ -104,12 +104,28 @@
if (!node)
return;
- if (node->nodeType() != FrameScrollingNode && node->nodeType() != OverflowScrollingNode)
+ if (!node->isScrollingNode())
return;
toScrollingTreeScrollingNode(node)->updateLayersAfterViewportChange(viewportRect, scale);
}
+void ScrollingTree::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const WebCore::FloatPoint& scrollPosition)
+{
+ ScrollingTreeNode* node = nodeForID(nodeID);
+ if (!node)
+ return;
+
+ if (node->nodeType() != OverflowScrollingNode)
+ return;
+
+ // Update descendant nodes
+ toScrollingTreeScrollingNode(node)->updateLayersAfterDelegatedScroll(scrollPosition);
+
+ // Update GraphicsLayers and scroll state.
+ scrollingTreeNodeDidScroll(nodeID, scrollPosition);
+}
+
void ScrollingTree::commitNewTreeState(PassOwnPtr<ScrollingStateTree> scrollingStateTree)
{
bool rootStateNodeChanged = scrollingStateTree->hasNewRootStateNode();
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (166530 => 166531)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2014-03-31 21:23:27 UTC (rev 166531)
@@ -63,8 +63,6 @@
virtual EventResult tryToHandleWheelEvent(const PlatformWheelEvent&) = 0;
bool shouldHandleWheelEventSynchronously(const PlatformWheelEvent&);
- virtual void viewportChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatRect& viewportRect, double scale);
-
void setMainFrameIsRubberBanding(bool);
bool isRubberBandInProgress();
@@ -73,7 +71,18 @@
void setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom);
+ // Called after a scrolling tree node has handled a scroll and updated its layers.
+ // Updates FrameView/RenderLayer scrolling state and GraphicsLayers.
virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) = 0;
+
+ // Delegated scrolling/zooming has caused the viewport to change, so update viewport-constrained layers
+ // (but don't cause scroll events to be fired).
+ virtual void viewportChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatRect& viewportRect, double scale);
+
+ // Delegated scrolling has scrolled a node. Update layer positions on descendant tree nodes,
+ // and call scrollingTreeNodeDidScroll().
+ virtual void scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatPoint& scrollPosition);
+
FloatPoint mainFrameScrollPosition();
bool isPointInNonFastScrollableRegion(IntPoint);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (166530 => 166531)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2014-03-31 21:23:27 UTC (rev 166531)
@@ -54,7 +54,8 @@
virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&) = 0;
virtual void updateLayersAfterViewportChange(const FloatRect& viewportRect, double scale) = 0;
-
+ virtual void updateLayersAfterDelegatedScroll(const FloatPoint&) { }
+
SynchronousScrollingReasons synchronousScrollingReasons() const { return m_synchronousScrollingReasons; }
bool shouldUpdateScrollLayerPositionSynchronously() const { return m_synchronousScrollingReasons; }
Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h (166530 => 166531)
--- trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h 2014-03-31 21:23:27 UTC (rev 166531)
@@ -50,12 +50,12 @@
CALayer *scrollLayer() const { return m_scrollLayer.get(); }
-private:
FloatPoint scrollPosition() const;
virtual void setScrollPosition(const FloatPoint&) override;
virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&) override;
virtual void updateLayersAfterViewportChange(const FloatRect& viewportRect, double scale);
+ virtual void updateLayersAfterDelegatedScroll(const FloatPoint&) override;
void setScrollLayerPosition(const FloatPoint&);
@@ -65,6 +65,9 @@
void scrollBy(const IntSize&);
void scrollByWithoutContentEdgeConstraints(const IntSize&);
+private:
+ void updateChildNodesAfterScroll(const FloatPoint&);
+
RetainPtr<CALayer> m_scrollLayer;
RetainPtr<CALayer> m_scrolledContentsLayer;
RetainPtr<CALayer> m_counterScrollingLayer;
Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm (166530 => 166531)
--- trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm 2014-03-31 21:23:27 UTC (rev 166531)
@@ -129,16 +129,38 @@
scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition);
}
-void ScrollingTreeScrollingNodeIOS::setScrollLayerPosition(const FloatPoint& position)
+void ScrollingTreeScrollingNodeIOS::setScrollLayerPosition(const FloatPoint& scrollPosition)
{
ASSERT(!shouldUpdateScrollLayerPositionSynchronously());
- [m_scrollLayer setPosition:CGPointMake(-position.x() + scrollOrigin().x(), -position.y() + scrollOrigin().y())];
+ [m_scrollLayer setPosition:CGPointMake(-scrollPosition.x() + scrollOrigin().x(), -scrollPosition.y() + scrollOrigin().y())];
+ updateChildNodesAfterScroll(scrollPosition);
+}
+
+void ScrollingTreeScrollingNodeIOS::updateLayersAfterViewportChange(const FloatRect& viewportRect, double scale)
+{
+ [m_counterScrollingLayer setPosition:viewportRect.location()];
+
+ if (!m_children)
+ return;
+
+ FloatRect viewportConstrainedObjectsRect = FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(viewportRect), totalContentsSize(), scale, false, scrollBehaviorForFixedElements());
+
+ size_t size = m_children->size();
+ for (size_t i = 0; i < size; ++i)
+ m_children->at(i)->parentScrollPositionDidChange(viewportConstrainedObjectsRect, FloatSize());
+}
+
+void ScrollingTreeScrollingNodeIOS::updateLayersAfterDelegatedScroll(const FloatPoint& scrollPosition)
+{
+ updateChildNodesAfterScroll(scrollPosition());
+}
+
+void ScrollingTreeScrollingNodeIOS::updateChildNodesAfterScroll(const FloatPoint& scrollPosition)
+{
ScrollBehaviorForFixedElements behaviorForFixed = scrollBehaviorForFixedElements();
- FloatPoint scrollOffset = position - toIntSize(scrollOrigin());
+ FloatPoint scrollOffset = scrollPosition - toIntSize(scrollOrigin());
FloatRect viewportRect(FloatPoint(), viewportSize());
-
- // FIXME: scrollOffsetForFixedPosition() needs to do float math.
FloatSize scrollOffsetForFixedChildren = FrameView::scrollOffsetForFixedPosition(enclosingLayoutRect(viewportRect), totalContentsSize(), flooredIntPoint(scrollOffset), scrollOrigin(), frameScaleFactor(), false, behaviorForFixed, headerHeight(), footerHeight());
[m_counterScrollingLayer setPosition:FloatPoint(scrollOffsetForFixedChildren)];
@@ -170,20 +192,6 @@
m_children->at(i)->parentScrollPositionDidChange(viewportConstrainedObjectsRect, FloatSize());
}
-void ScrollingTreeScrollingNodeIOS::updateLayersAfterViewportChange(const FloatRect& viewportRect, double scale)
-{
- [m_counterScrollingLayer setPosition:viewportRect.location()];
-
- if (!m_children)
- return;
-
- FloatRect viewportConstrainedObjectsRect = FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(viewportRect), totalContentsSize(), scale, false, scrollBehaviorForFixedElements());
-
- size_t size = m_children->size();
- for (size_t i = 0; i < size; ++i)
- m_children->at(i)->parentScrollPositionDidChange(viewportConstrainedObjectsRect, FloatSize());
-}
-
FloatPoint ScrollingTreeScrollingNodeIOS::minimumScrollPosition() const
{
FloatPoint position;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (166530 => 166531)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-03-31 21:23:27 UTC (rev 166531)
@@ -3515,6 +3515,7 @@
nodeID = scrollingCoordinator->attachToStateTree(isRootLayer ? FrameScrollingNode : OverflowScrollingNode, nodeID, parentNodeID);
backing->setScrollingNodeID(nodeID);
+ m_scrollingNodeToLayerMap.add(nodeID, &layer);
GraphicsLayer* scrollingLayer = backing->scrollingLayer();
GraphicsLayer* scrolledContentsLayer = backing->scrollingContentsLayer();
@@ -3537,10 +3538,24 @@
void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer& layer)
{
- if (RenderLayerBacking* backing = layer.backing())
- backing->detachFromScrollingCoordinator();
+ RenderLayerBacking* backing = layer.backing();
+ if (!backing)
+ return;
+
+ backing->detachFromScrollingCoordinator();
+
+ if (ScrollingNodeID nodeID = backing->scrollingNodeID())
+ m_scrollingNodeToLayerMap.remove(nodeID);
}
+ScrollableArea* RenderLayerCompositor::scrollableAreaForScrollLayerID(ScrollingNodeID nodeID) const
+{
+ if (!nodeID)
+ return nullptr;
+
+ return m_scrollingNodeToLayerMap.get(nodeID);
+}
+
#if PLATFORM(IOS)
typedef HashMap<PlatformLayer*, std::unique_ptr<ViewportConstraints>> LayerMap;
typedef HashMap<PlatformLayer*, PlatformLayer*> StickyContainerMap;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (166530 => 166531)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h 2014-03-31 21:23:27 UTC (rev 166531)
@@ -266,6 +266,8 @@
GraphicsLayer* updateLayerForFooter(bool wantsLayer);
#endif
+ ScrollableArea* scrollableAreaForScrollLayerID(ScrollingNodeID) const;
+
void updateScrollCoordinatedStatus(RenderLayer&);
void removeFromScrollCoordinatedLayers(RenderLayer&);
@@ -519,6 +521,8 @@
#endif
Color m_rootExtendedBackgroundColor;
+
+ HashMap<ScrollingNodeID, RenderLayer*> m_scrollingNodeToLayerMap;
};
Modified: trunk/Source/WebKit2/ChangeLog (166530 => 166531)
--- trunk/Source/WebKit2/ChangeLog 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebKit2/ChangeLog 2014-03-31 21:23:27 UTC (rev 166531)
@@ -1,3 +1,43 @@
+2014-03-31 Simon Fraser <[email protected]>
+
+ [iOS WK2] Hook up scroll events for accelerated overflow:scroll
+ https://bugs.webkit.org/show_bug.cgi?id=130976
+
+ Reviewed by Tim Horton.
+
+ When an accelerated overflow:scroll is scrolled in the UI process,
+ tell the WebProcess that the scroll happened to update RenderLayer
+ state and fire events.
+
+ Add a WKOverflowScrollViewDelegate which is set as the delegate of
+ UIScrollViews, owned by ScrollingTreeOverflowScrollingNodeIOS, and propagates
+ -scrollViewDidScroll: messages to ScrollingTree::scrollPositionChangedViaDelegatedScrolling(),
+ which updates child layers and then, via RemoteScrollingTree::scrollingTreeNodeDidScroll,
+ tells the RemoteScrollingCoordinator which sends a message to the WebProcess.
+
+ * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll): Name change
+ to try to reduce confusion.
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollPositionChanged): Deleted.
+ * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
+ * UIProcess/Scrolling/RemoteScrollingTree.cpp:
+ (WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
+ * UIProcess/Scrolling/RemoteScrollingTree.h:
+ * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
+ * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+ (-[WKOverflowScrollViewDelegate initWithScrollingTreeNode:WebKit::]):
+ (-[WKOverflowScrollViewDelegate scrollViewDidScroll:]):
+ (-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]):
+ (-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]):
+ (-[WKOverflowScrollViewDelegate scrollViewDidEndScrollingAnimation:]):
+ (WebKit::ScrollingTreeOverflowScrollingNodeIOS::~ScrollingTreeOverflowScrollingNodeIOS):
+ (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateBeforeChildren):
+ (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren):
+ (WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll):
+ * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
+ (WebKit::RemoteScrollingCoordinator::scrollPositionChangedForNode): No need for
+ rounding.
+
2014-03-29 Simon Fraser <[email protected]>
Fix scrolling on OS X with UI-side compositing
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp (166530 => 166531)
--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp 2014-03-31 21:23:27 UTC (rev 166531)
@@ -150,7 +150,7 @@
}
// This comes from the scrolling tree.
-void RemoteScrollingCoordinatorProxy::scrollPositionChanged(WebCore::ScrollingNodeID scrolledNodeID, const WebCore::FloatPoint& newScrollPosition)
+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID scrolledNodeID, const WebCore::FloatPoint& newScrollPosition)
{
// Scroll updates for the main frame are sent via WebPageProxy::updateVisibleContentRects()
// so don't send them here.
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h (166530 => 166531)
--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h 2014-03-31 21:23:27 UTC (rev 166531)
@@ -52,7 +52,7 @@
virtual ~RemoteScrollingCoordinatorProxy();
// Inform the web process that the scroll position changed (called from the scrolling tree)
- void scrollPositionChanged(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition);
+ void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition);
bool isPointInNonFastScrollableRegion(const WebCore::IntPoint&) const;
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp (166530 => 166531)
--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp 2014-03-31 21:23:27 UTC (rev 166531)
@@ -79,7 +79,7 @@
void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint& scrollPosition, SetOrSyncScrollingLayerPosition)
{
- m_scrollingCoordinatorProxy.scrollPositionChanged(nodeID, scrollPosition);
+ m_scrollingCoordinatorProxy.scrollingTreeNodeDidScroll(nodeID, scrollPosition);
}
PassOwnPtr<ScrollingTreeNode> RemoteScrollingTree::createNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h (166530 => 166531)
--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h 2014-03-31 21:23:27 UTC (rev 166531)
@@ -46,13 +46,14 @@
const RemoteScrollingCoordinatorProxy& scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy; }
+ virtual void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::SetOrSyncScrollingLayerPosition = WebCore::SyncScrollingLayerPosition) override;
+
private:
explicit RemoteScrollingTree(RemoteScrollingCoordinatorProxy&);
#if PLATFORM(MAC)
virtual void handleWheelEventPhase(WebCore::PlatformWheelEventPhase) override;
#endif
- virtual void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint& scrollPosition, WebCore::SetOrSyncScrollingLayerPosition = WebCore::SyncScrollingLayerPosition) override;
virtual PassOwnPtr<WebCore::ScrollingTreeNode> createNode(WebCore::ScrollingNodeType, WebCore::ScrollingNodeID);
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h (166530 => 166531)
--- trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h 2014-03-31 21:23:27 UTC (rev 166531)
@@ -32,6 +32,8 @@
#include <WebCore/ScrollingCoordinator.h>
#include <WebCore/ScrollingTreeScrollingNodeIOS.h>
+OBJC_CLASS WKOverflowScrollViewDelegate;
+
namespace WebKit {
class ScrollingTreeOverflowScrollingNodeIOS : public WebCore::ScrollingTreeScrollingNodeIOS {
@@ -39,11 +41,15 @@
static PassOwnPtr<ScrollingTreeOverflowScrollingNodeIOS> create(WebCore::ScrollingTree&, WebCore::ScrollingNodeID);
virtual ~ScrollingTreeOverflowScrollingNodeIOS();
+ void scrollViewDidScroll(const WebCore::FloatPoint&);
+
private:
ScrollingTreeOverflowScrollingNodeIOS(WebCore::ScrollingTree&, WebCore::ScrollingNodeID);
+ virtual void updateBeforeChildren(const WebCore::ScrollingStateNode&) override;
virtual void updateAfterChildren(const WebCore::ScrollingStateNode&) override;
+ RetainPtr<WKOverflowScrollViewDelegate> m_scrollViewDelegate;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm (166530 => 166531)
--- trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm 2014-03-31 21:23:27 UTC (rev 166531)
@@ -31,10 +31,48 @@
#import <WebCore/BlockExceptions.h>
#import <WebCore/ScrollingStateScrollingNode.h>
+#import <WebCore/ScrollingTree.h>
#import <UIKit/UIScrollView.h>
using namespace WebCore;
+@interface WKOverflowScrollViewDelegate : NSObject <UIScrollViewDelegate> {
+ WebKit::ScrollingTreeOverflowScrollingNodeIOS* _scrollingTreeNode;
+}
+- (instancetype)initWithScrollingTreeNode:(WebKit::ScrollingTreeOverflowScrollingNodeIOS*)node;
+
+@end
+
+
+@implementation WKOverflowScrollViewDelegate
+
+- (instancetype)initWithScrollingTreeNode:(WebKit::ScrollingTreeOverflowScrollingNodeIOS*)node
+{
+ if ((self = [super init])) {
+ _scrollingTreeNode = node;
+ }
+ return self;
+}
+
+- (void)scrollViewDidScroll:(UIScrollView *)scrollView
+{
+ _scrollingTreeNode->scrollViewDidScroll(scrollView.contentOffset);
+}
+
+- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
+{
+}
+
+- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
+{
+}
+
+- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
+{
+}
+
+@end
+
namespace WebKit {
PassOwnPtr<ScrollingTreeOverflowScrollingNodeIOS> ScrollingTreeOverflowScrollingNodeIOS::create(WebCore::ScrollingTree& scrollingTree, WebCore::ScrollingNodeID nodeID)
@@ -49,14 +87,46 @@
ScrollingTreeOverflowScrollingNodeIOS::~ScrollingTreeOverflowScrollingNodeIOS()
{
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ if (UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate]) {
+ ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
+ scrollView.delegate = nil;
+ }
+ END_BLOCK_OBJC_EXCEPTIONS
}
+void ScrollingTreeOverflowScrollingNodeIOS::updateBeforeChildren(const WebCore::ScrollingStateNode& stateNode)
+{
+ if (stateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollLayer)) {
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ if (UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate]) {
+ ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
+ scrollView.delegate = nil;
+ }
+ END_BLOCK_OBJC_EXCEPTIONS
+ }
+
+ ScrollingTreeScrollingNodeIOS::updateBeforeChildren(stateNode);
+}
+
void ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren(const ScrollingStateNode& stateNode)
{
ScrollingTreeScrollingNodeIOS::updateAfterChildren(stateNode);
const auto& scrollingStateNode = toScrollingStateScrollingNode(stateNode);
+ if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::ScrollLayer)) {
+ BEGIN_BLOCK_OBJC_EXCEPTIONS
+ UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
+ ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
+
+ if (!m_scrollViewDelegate)
+ m_scrollViewDelegate = adoptNS([[WKOverflowScrollViewDelegate alloc] initWithScrollingTreeNode:this]);
+
+ scrollView.delegate = m_scrollViewDelegate.get();
+ END_BLOCK_OBJC_EXCEPTIONS
+ }
+
if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize)) {
BEGIN_BLOCK_OBJC_EXCEPTIONS
UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
@@ -68,6 +138,11 @@
}
}
+void ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll(const FloatPoint& scrollPosition)
+{
+ scrollingTree().scrollPositionChangedViaDelegatedScrolling(scrollingNodeID(), scrollPosition);
+}
+
} // namespace WebCore
#endif // ENABLE(ASYNC_SCROLLING)
Modified: trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm (166530 => 166531)
--- trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm 2014-03-31 21:22:42 UTC (rev 166530)
+++ trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm 2014-03-31 21:23:27 UTC (rev 166531)
@@ -93,7 +93,7 @@
// Notification from the UI process that we scrolled.
void RemoteScrollingCoordinator::scrollPositionChangedForNode(ScrollingNodeID nodeID, const FloatPoint& scrollPosition)
{
- scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, roundedIntPoint(scrollPosition), false /* FIXME */, SyncScrollingLayerPosition);
+ scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, false /* FIXME */, SyncScrollingLayerPosition);
}
} // namespace WebKit