- Revision
- 162748
- Author
- simon.fra...@apple.com
- Date
- 2014-01-24 18:32:26 -0800 (Fri, 24 Jan 2014)
Log Message
Start using the RemoteScrollingCoordinatorProxy on iOS
https://bugs.webkit.org/show_bug.cgi?id=127598
Reviewed by Tim Horton.
Source/WebCore:
Add a scrollPositionChangedViaDelegatedScrolling() function to
ScrollingTree, allowing the ScrollingTree to be informed about
external sources of scrolling.
Also add a convenience getter for nodes, nodeForID().
* WebCore.exp.in:
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling):
(WebCore::ScrollingTree::nodeForID):
* page/scrolling/ScrollingTree.h:
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers):
To avoid assertions on iOS, bail from iOS WK1 fixed position code if
we have a ScrollingCoordinator.
(WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers):
Ditto.
Source/WebKit2:
Add a scrollPositionChangedViaDelegatedScrolling() function to
ScrollingTree, allowing the ScrollingTree to be informed about
external sources of scrolling.
Call it from -[WKContentView didScrollTo:] for the root node.
* UIProcess/API/ios/WKContentView.mm:
(-[WKContentView didScrollTo:]):
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::rootScrollingNodeID):
(WebKit::RemoteScrollingCoordinatorProxy::scrollPositionChangedViaDelegatedScrolling):
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (162747 => 162748)
--- trunk/Source/WebCore/ChangeLog 2014-01-25 02:32:23 UTC (rev 162747)
+++ trunk/Source/WebCore/ChangeLog 2014-01-25 02:32:26 UTC (rev 162748)
@@ -1,5 +1,30 @@
2014-01-24 Simon Fraser <simon.fra...@apple.com>
+ Start using the RemoteScrollingCoordinatorProxy on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=127598
+
+ Reviewed by Tim Horton.
+
+ Add a scrollPositionChangedViaDelegatedScrolling() function to
+ ScrollingTree, allowing the ScrollingTree to be informed about
+ external sources of scrolling.
+
+ Also add a convenience getter for nodes, nodeForID().
+
+ * WebCore.exp.in:
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::scrollPositionChangedViaDelegatedScrolling):
+ (WebCore::ScrollingTree::nodeForID):
+ * page/scrolling/ScrollingTree.h:
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers):
+ To avoid assertions on iOS, bail from iOS WK1 fixed position code if
+ we have a ScrollingCoordinator.
+ (WebCore::RenderLayerCompositor::unregisterAllViewportConstrainedLayers):
+ Ditto.
+
+2014-01-24 Simon Fraser <simon.fra...@apple.com>
+
Add typesafe casts for ScrollingTreeNode classes
https://bugs.webkit.org/show_bug.cgi?id=127597
Modified: trunk/Source/WebCore/WebCore.exp.in (162747 => 162748)
--- trunk/Source/WebCore/WebCore.exp.in 2014-01-25 02:32:23 UTC (rev 162747)
+++ trunk/Source/WebCore/WebCore.exp.in 2014-01-25 02:32:26 UTC (rev 162748)
@@ -2974,6 +2974,7 @@
__ZN7WebCore13ScrollingTree31willWheelEventStartSwipeGestureERKNS_18PlatformWheelEventE
__ZN7WebCore13ScrollingTree35shouldHandleWheelEventSynchronouslyERKNS_18PlatformWheelEventE
__ZN7WebCore13ScrollingTree37setScrollingPerformanceLoggingEnabledEb
+__ZN7WebCore13ScrollingTree42scrollPositionChangedViaDelegatedScrollingEyRKNS_8IntPointE
__ZN7WebCore13ScrollingTreeC2Ev
__ZN7WebCore13ScrollingTreeD1Ev
__ZN7WebCore13ScrollingTreeD2Ev
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (162747 => 162748)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2014-01-25 02:32:23 UTC (rev 162747)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2014-01-25 02:32:26 UTC (rev 162748)
@@ -80,6 +80,18 @@
m_rootNode->handleWheelEvent(wheelEvent);
}
+void ScrollingTree::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const IntPoint& scrollPosition)
+{
+ ScrollingTreeNode* node = nodeForID(nodeID);
+ if (!node)
+ return;
+
+ if (node->nodeType() != ScrollingNode)
+ return;
+
+ toScrollingTreeScrollingNode(node)->setScrollPosition(scrollPosition);
+}
+
void ScrollingTree::commitNewTreeState(PassOwnPtr<ScrollingStateTree> scrollingStateTree)
{
bool rootStateNodeChanged = scrollingStateTree->hasNewRootStateNode();
@@ -173,6 +185,14 @@
}
}
+ScrollingTreeNode* ScrollingTree::nodeForID(ScrollingNodeID nodeID) const
+{
+ if (!nodeID)
+ return nullptr;
+
+ return m_nodeMap.get(nodeID);
+}
+
void ScrollingTree::setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom)
{
MutexLocker locker(m_swipeStateMutex);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (162747 => 162748)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2014-01-25 02:32:23 UTC (rev 162747)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2014-01-25 02:32:26 UTC (rev 162748)
@@ -62,6 +62,8 @@
virtual EventResult tryToHandleWheelEvent(const PlatformWheelEvent&) = 0;
bool shouldHandleWheelEventSynchronously(const PlatformWheelEvent&);
+
+ virtual void scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID, const IntPoint&);
void setMainFrameIsRubberBanding(bool);
bool isRubberBandInProgress();
@@ -107,6 +109,8 @@
virtual PassOwnPtr<ScrollingTreeNode> createNode(ScrollingNodeType, ScrollingNodeID) = 0;
+ ScrollingTreeNode* nodeForID(ScrollingNodeID) const;
+
OwnPtr<ScrollingTreeScrollingNode> m_rootNode;
typedef HashMap<ScrollingNodeID, ScrollingTreeNode*> ScrollingTreeNodeMap;
Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (162747 => 162748)
--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-01-25 02:32:23 UTC (rev 162747)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp 2014-01-25 02:32:26 UTC (rev 162748)
@@ -3528,6 +3528,9 @@
if (m_renderView.document().ownerElement())
return;
+ if (scrollingCoordinator())
+ return;
+
LayerMap layerMap;
StickyContainerMap stickyContainerMap;
@@ -3559,6 +3562,9 @@
if (m_renderView.document().ownerElement())
return;
+ if (scrollingCoordinator())
+ return;
+
if (ChromeClient* client = this->chromeClient()) {
LayerMap layerMap;
StickyContainerMap stickyContainerMap;
Modified: trunk/Source/WebKit2/ChangeLog (162747 => 162748)
--- trunk/Source/WebKit2/ChangeLog 2014-01-25 02:32:23 UTC (rev 162747)
+++ trunk/Source/WebKit2/ChangeLog 2014-01-25 02:32:26 UTC (rev 162748)
@@ -1,3 +1,23 @@
+2014-01-24 Simon Fraser <simon.fra...@apple.com>
+
+ Start using the RemoteScrollingCoordinatorProxy on iOS
+ https://bugs.webkit.org/show_bug.cgi?id=127598
+
+ Reviewed by Tim Horton.
+
+ Add a scrollPositionChangedViaDelegatedScrolling() function to
+ ScrollingTree, allowing the ScrollingTree to be informed about
+ external sources of scrolling.
+
+ Call it from -[WKContentView didScrollTo:] for the root node.
+
+ * UIProcess/API/ios/WKContentView.mm:
+ (-[WKContentView didScrollTo:]):
+ * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
+ (WebKit::RemoteScrollingCoordinatorProxy::rootScrollingNodeID):
+ (WebKit::RemoteScrollingCoordinatorProxy::scrollPositionChangedViaDelegatedScrolling):
+ * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
+
2014-01-24 Anders Carlsson <ander...@apple.com>
Try to fix the GTK+ build.
Modified: trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm (162747 => 162748)
--- trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm 2014-01-25 02:32:23 UTC (rev 162747)
+++ trunk/Source/WebKit2/UIProcess/API/ios/WKContentView.mm 2014-01-25 02:32:26 UTC (rev 162748)
@@ -29,6 +29,7 @@
#import "InteractionInformationAtPosition.h"
#import "PageClientImplIOS.h"
#import "RemoteLayerTreeDrawingAreaProxy.h"
+#import "RemoteScrollingCoordinatorProxy.h"
#import "WebKit2Initialize.h"
#import "WKBrowsingContextControllerInternal.h"
#import "WKBrowsingContextGroupPrivate.h"
@@ -193,6 +194,8 @@
{
_currentExposedRectPosition = contentOffset;
[self _updateViewExposedRect];
+
+ _page->scrollingCoordinatorProxy()->scrollPositionChangedViaDelegatedScrolling(_page->scrollingCoordinatorProxy()->rootScrollingNodeID(), roundedIntPoint(contentOffset));
}
- (void)didZoomToScale:(CGFloat)scale
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp (162747 => 162748)
--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp 2014-01-25 02:32:23 UTC (rev 162747)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp 2014-01-25 02:32:26 UTC (rev 162748)
@@ -39,6 +39,7 @@
#include "WebPageProxy.h"
#include "WebProcessProxy.h"
#include <WebCore/ScrollingStateTree.h>
+#include <WebCore/ScrollingTreeScrollingNode.h>
using namespace WebCore;
@@ -54,6 +55,11 @@
{
}
+WebCore::ScrollingNodeID RemoteScrollingCoordinatorProxy::rootScrollingNodeID() const
+{
+ return m_scrollingTree->rootNode()->scrollingNodeID();
+}
+
const RemoteLayerTreeHost* RemoteScrollingCoordinatorProxy::layerTreeHost() const
{
DrawingAreaProxy* drawingArea = m_webPageProxy.drawingArea();
@@ -120,6 +126,11 @@
return result == ScrollingTree::DidHandleEvent; // FIXME: handle other values.
}
+void RemoteScrollingCoordinatorProxy::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const IntPoint& offset)
+{
+ m_scrollingTree->scrollPositionChangedViaDelegatedScrolling(nodeID, offset);
+}
+
void RemoteScrollingCoordinatorProxy::scrollPositionChanged(WebCore::ScrollingNodeID scrolledNodeID, const WebCore::FloatPoint& newScrollPosition)
{
m_webPageProxy.send(Messages::RemoteScrollingCoordinator::ScrollPositionChangedForNode(scrolledNodeID, newScrollPosition));
Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h (162747 => 162748)
--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h 2014-01-25 02:32:23 UTC (rev 162747)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h 2014-01-25 02:32:26 UTC (rev 162748)
@@ -51,9 +51,12 @@
explicit RemoteScrollingCoordinatorProxy(WebPageProxy&);
virtual ~RemoteScrollingCoordinatorProxy();
- // Inform the web process that the scroll position changed.
+ // Inform the web process that the scroll position changed (called from the scrolling tree)
void scrollPositionChanged(WebCore::ScrollingNodeID, const WebCore::FloatPoint& newScrollPosition);
+ // Called externally when native views move around.
+ void scrollPositionChangedViaDelegatedScrolling(WebCore::ScrollingNodeID, const WebCore::IntPoint&);
+
// FIXME: expose the tree and pass this to that?
bool handleWheelEvent(const WebCore::PlatformWheelEvent&);