<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[166531] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/166531">166531</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-03-31 14:23:27 -0700 (Mon, 31 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS WK2] Hook up scroll events for accelerated overflow:scroll
https://bugs.webkit.org/show_bug.cgi?id=130976

Source/WebCore:

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-&gt;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:

Source/WebKit2:

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.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreecpp">trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeh">trunk/Source/WebCore/page/scrolling/ScrollingTree.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeScrollingNodeh">trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingiosScrollingTreeScrollingNodeIOSh">trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingiosScrollingTreeScrollingNodeIOSmm">trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorh">trunk/Source/WebCore/rendering/RenderLayerCompositor.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxycpp">trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxyh">trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingRemoteScrollingTreecpp">trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingRemoteScrollingTreeh">trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSh">trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSmm">trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessScrollingRemoteScrollingCoordinatormm">trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2014-03-31  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [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-&gt;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:
+
</ins><span class="cx"> 2014-03-31  Antti Koivisto  &lt;antti@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rename TileCache to LegacyTileCache
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -2738,6 +2738,7 @@
</span><span class="cx"> __ZN7WebCore13ScrollingTree35shouldHandleWheelEventSynchronouslyERKNS_18PlatformWheelEventE
</span><span class="cx"> __ZN7WebCore13ScrollingTree36viewportChangedViaDelegatedScrollingEyRKNS_9FloatRectEd
</span><span class="cx"> __ZN7WebCore13ScrollingTree37setScrollingPerformanceLoggingEnabledEb
</span><ins>+__ZN7WebCore13ScrollingTree42scrollPositionChangedViaDelegatedScrollingEyRKNS_10FloatPointE
</ins><span class="cx"> __ZN7WebCore13ScrollingTreeC2Ev
</span><span class="cx"> __ZN7WebCore13ScrollingTreeD1Ev
</span><span class="cx"> __ZN7WebCore13ScrollingTreeD2Ev
</span><span class="lines">@@ -2801,6 +2802,7 @@
</span><span class="cx"> __ZN7WebCore29ScrollingTreeScrollingNodeIOS19updateAfterChildrenERKNS_18ScrollingStateNodeE
</span><span class="cx"> __ZN7WebCore29ScrollingTreeScrollingNodeIOS20updateBeforeChildrenERKNS_18ScrollingStateNodeE
</span><span class="cx"> __ZN7WebCore29ScrollingTreeScrollingNodeIOS31updateLayersAfterViewportChangeERKNS_9FloatRectEd
</span><ins>+__ZN7WebCore29ScrollingTreeScrollingNodeIOS32updateLayersAfterDelegatedScrollERKNS_10FloatPointE
</ins><span class="cx"> __ZN7WebCore29ScrollingTreeScrollingNodeIOS46setScrollPositionWithoutContentEdgeConstraintsERKNS_10FloatPointE
</span><span class="cx"> __ZN7WebCore29ScrollingTreeScrollingNodeIOS6createERNS_13ScrollingTreeENS_17ScrollingNodeTypeEy
</span><span class="cx"> __ZN7WebCore29ScrollingTreeScrollingNodeIOSC2ERNS_13ScrollingTreeENS_17ScrollingNodeTypeEy
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -817,6 +817,15 @@
</span><span class="cx">     return backing-&gt;scrollingNodeID();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ScrollableArea* FrameView::scrollableAreaForScrollLayerID(uint64_t nodeID) const
+{
+    RenderView* renderView = this-&gt;renderView();
+    if (!renderView)
+        return nullptr;
+
+    return renderView-&gt;compositor().scrollableAreaForScrollLayerID(nodeID);
+}
+
</ins><span class="cx"> #if ENABLE(RUBBER_BANDING)
</span><span class="cx"> GraphicsLayer* FrameView::layerForOverhangAreas() const
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -156,6 +156,7 @@
</span><span class="cx">     // In the future when any ScrollableArea can have a node in th ScrollingTree, this should
</span><span class="cx">     // become a virtual function on ScrollableArea.
</span><span class="cx">     uint64_t scrollLayerID() const;
</span><ins>+    ScrollableArea* scrollableAreaForScrollLayerID(uint64_t) const;
</ins><span class="cx"> 
</span><span class="cx">     bool hasCompositedContent() const;
</span><span class="cx">     bool hasCompositedContentIncludingDescendants() const;
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -194,16 +194,17 @@
</span><span class="cx">     if (!frameView)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    bool oldProgrammaticScroll = frameView-&gt;inProgrammaticScroll();
-    frameView-&gt;setInProgrammaticScroll(programmaticScroll);
</del><ins>+    // Main frame.
+    if (scrollingNodeID == frameView-&gt;scrollLayerID()) {
+        bool oldProgrammaticScroll = frameView-&gt;inProgrammaticScroll();
+        frameView-&gt;setInProgrammaticScroll(programmaticScroll);
</ins><span class="cx"> 
</span><del>-    frameView-&gt;setConstrainsScrollingToContentEdge(false);
-    frameView-&gt;notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
-    frameView-&gt;setConstrainsScrollingToContentEdge(true);
</del><ins>+        frameView-&gt;setConstrainsScrollingToContentEdge(false);
+        frameView-&gt;notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
+        frameView-&gt;setConstrainsScrollingToContentEdge(true);
</ins><span class="cx"> 
</span><del>-    frameView-&gt;setInProgrammaticScroll(oldProgrammaticScroll);
</del><ins>+        frameView-&gt;setInProgrammaticScroll(oldProgrammaticScroll);
</ins><span class="cx"> 
</span><del>-    if (scrollingNodeID == frameView-&gt;scrollLayerID()) {
</del><span class="cx">         if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
</span><span class="cx">             GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
</span><span class="cx">             GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
</span><span class="lines">@@ -231,8 +232,13 @@
</span><span class="cx">                 syncChildPositions(viewportRect);
</span><span class="cx">             }
</span><span class="cx">         }
</span><ins>+
+        return;
</ins><span class="cx">     }
</span><del>-    // FIXME: handle non-main scrolling nodes.
</del><ins>+
+    // Overflow-scroll area.
+    if (ScrollableArea* scrollableArea = frameView-&gt;scrollableAreaForScrollLayerID(scrollingNodeID))
+        scrollableArea-&gt;scrollToOffsetWithoutAnimation(scrollPosition);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea* scrollableArea, ScrollbarOrientation orientation)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -104,12 +104,28 @@
</span><span class="cx">     if (!node)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (node-&gt;nodeType() != FrameScrollingNode &amp;&amp; node-&gt;nodeType() != OverflowScrollingNode)
</del><ins>+    if (!node-&gt;isScrollingNode())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     toScrollingTreeScrollingNode(node)-&gt;updateLayersAfterViewportChange(viewportRect, scale);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScrollingTree::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const WebCore::FloatPoint&amp; scrollPosition)
+{
+    ScrollingTreeNode* node = nodeForID(nodeID);
+    if (!node)
+        return;
+
+    if (node-&gt;nodeType() != OverflowScrollingNode)
+        return;
+
+    // Update descendant nodes
+    toScrollingTreeScrollingNode(node)-&gt;updateLayersAfterDelegatedScroll(scrollPosition);
+
+    // Update GraphicsLayers and scroll state.
+    scrollingTreeNodeDidScroll(nodeID, scrollPosition);
+}
+
</ins><span class="cx"> void ScrollingTree::commitNewTreeState(PassOwnPtr&lt;ScrollingStateTree&gt; scrollingStateTree)
</span><span class="cx"> {
</span><span class="cx">     bool rootStateNodeChanged = scrollingStateTree-&gt;hasNewRootStateNode();
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -63,8 +63,6 @@
</span><span class="cx">     virtual EventResult tryToHandleWheelEvent(const PlatformWheelEvent&amp;) = 0;
</span><span class="cx">     bool shouldHandleWheelEventSynchronously(const PlatformWheelEvent&amp;);
</span><span class="cx">     
</span><del>-    virtual void viewportChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatRect&amp; viewportRect, double scale);
-
</del><span class="cx">     void setMainFrameIsRubberBanding(bool);
</span><span class="cx">     bool isRubberBandInProgress();
</span><span class="cx"> 
</span><span class="lines">@@ -73,7 +71,18 @@
</span><span class="cx"> 
</span><span class="cx">     void setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight, bool pinnedToTheTop, bool pinnedToTheBottom);
</span><span class="cx"> 
</span><ins>+    // Called after a scrolling tree node has handled a scroll and updated its layers.
+    // Updates FrameView/RenderLayer scrolling state and GraphicsLayers.
</ins><span class="cx">     virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint&amp; scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) = 0;
</span><ins>+
+    // 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&amp; 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&amp; scrollPosition);
+
</ins><span class="cx">     FloatPoint mainFrameScrollPosition();
</span><span class="cx"> 
</span><span class="cx">     bool isPointInNonFastScrollableRegion(IntPoint);
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeScrollingNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -54,7 +54,8 @@
</span><span class="cx">     virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&amp;) = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual void updateLayersAfterViewportChange(const FloatRect&amp; viewportRect, double scale) = 0;
</span><del>-    
</del><ins>+    virtual void updateLayersAfterDelegatedScroll(const FloatPoint&amp;) { }
+
</ins><span class="cx">     SynchronousScrollingReasons synchronousScrollingReasons() const { return m_synchronousScrollingReasons; }
</span><span class="cx">     bool shouldUpdateScrollLayerPositionSynchronously() const { return m_synchronousScrollingReasons; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingiosScrollingTreeScrollingNodeIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -50,12 +50,12 @@
</span><span class="cx"> 
</span><span class="cx">     CALayer *scrollLayer() const { return m_scrollLayer.get(); }
</span><span class="cx"> 
</span><del>-private:
</del><span class="cx">     FloatPoint scrollPosition() const;
</span><span class="cx">     virtual void setScrollPosition(const FloatPoint&amp;) override;
</span><span class="cx">     virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     virtual void updateLayersAfterViewportChange(const FloatRect&amp; viewportRect, double scale);
</span><ins>+    virtual void updateLayersAfterDelegatedScroll(const FloatPoint&amp;) override;
</ins><span class="cx"> 
</span><span class="cx">     void setScrollLayerPosition(const FloatPoint&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -65,6 +65,9 @@
</span><span class="cx">     void scrollBy(const IntSize&amp;);
</span><span class="cx">     void scrollByWithoutContentEdgeConstraints(const IntSize&amp;);
</span><span class="cx"> 
</span><ins>+private:
+    void updateChildNodesAfterScroll(const FloatPoint&amp;);
+
</ins><span class="cx">     RetainPtr&lt;CALayer&gt; m_scrollLayer;
</span><span class="cx">     RetainPtr&lt;CALayer&gt; m_scrolledContentsLayer;
</span><span class="cx">     RetainPtr&lt;CALayer&gt; m_counterScrollingLayer;
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingiosScrollingTreeScrollingNodeIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -129,16 +129,38 @@
</span><span class="cx">     scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScrollingTreeScrollingNodeIOS::setScrollLayerPosition(const FloatPoint&amp; position)
</del><ins>+void ScrollingTreeScrollingNodeIOS::setScrollLayerPosition(const FloatPoint&amp; scrollPosition)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!shouldUpdateScrollLayerPositionSynchronously());
</span><del>-    [m_scrollLayer setPosition:CGPointMake(-position.x() + scrollOrigin().x(), -position.y() + scrollOrigin().y())];
</del><ins>+    [m_scrollLayer setPosition:CGPointMake(-scrollPosition.x() + scrollOrigin().x(), -scrollPosition.y() + scrollOrigin().y())];
</ins><span class="cx"> 
</span><ins>+    updateChildNodesAfterScroll(scrollPosition);
+}
+
+void ScrollingTreeScrollingNodeIOS::updateLayersAfterViewportChange(const FloatRect&amp; 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-&gt;size();
+    for (size_t i = 0; i &lt; size; ++i)
+        m_children-&gt;at(i)-&gt;parentScrollPositionDidChange(viewportConstrainedObjectsRect, FloatSize());
+}
+
+void ScrollingTreeScrollingNodeIOS::updateLayersAfterDelegatedScroll(const FloatPoint&amp; scrollPosition)
+{
+    updateChildNodesAfterScroll(scrollPosition());
+}
+
+void ScrollingTreeScrollingNodeIOS::updateChildNodesAfterScroll(const FloatPoint&amp; scrollPosition)
+{
</ins><span class="cx">     ScrollBehaviorForFixedElements behaviorForFixed = scrollBehaviorForFixedElements();
</span><del>-    FloatPoint scrollOffset = position - toIntSize(scrollOrigin());
</del><ins>+    FloatPoint scrollOffset = scrollPosition - toIntSize(scrollOrigin());
</ins><span class="cx">     FloatRect viewportRect(FloatPoint(), viewportSize());
</span><del>-    
-    // FIXME: scrollOffsetForFixedPosition() needs to do float math.
</del><span class="cx">     FloatSize scrollOffsetForFixedChildren = FrameView::scrollOffsetForFixedPosition(enclosingLayoutRect(viewportRect), totalContentsSize(), flooredIntPoint(scrollOffset), scrollOrigin(), frameScaleFactor(), false, behaviorForFixed, headerHeight(), footerHeight());
</span><span class="cx"> 
</span><span class="cx">     [m_counterScrollingLayer setPosition:FloatPoint(scrollOffsetForFixedChildren)];
</span><span class="lines">@@ -170,20 +192,6 @@
</span><span class="cx">         m_children-&gt;at(i)-&gt;parentScrollPositionDidChange(viewportConstrainedObjectsRect, FloatSize());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScrollingTreeScrollingNodeIOS::updateLayersAfterViewportChange(const FloatRect&amp; 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-&gt;size();
-    for (size_t i = 0; i &lt; size; ++i)
-        m_children-&gt;at(i)-&gt;parentScrollPositionDidChange(viewportConstrainedObjectsRect, FloatSize());
-}
-
</del><span class="cx"> FloatPoint ScrollingTreeScrollingNodeIOS::minimumScrollPosition() const
</span><span class="cx"> {
</span><span class="cx">     FloatPoint position;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -3515,6 +3515,7 @@
</span><span class="cx"> 
</span><span class="cx">         nodeID = scrollingCoordinator-&gt;attachToStateTree(isRootLayer ? FrameScrollingNode : OverflowScrollingNode, nodeID, parentNodeID);
</span><span class="cx">         backing-&gt;setScrollingNodeID(nodeID);
</span><ins>+        m_scrollingNodeToLayerMap.add(nodeID, &amp;layer);
</ins><span class="cx"> 
</span><span class="cx">         GraphicsLayer* scrollingLayer = backing-&gt;scrollingLayer();
</span><span class="cx">         GraphicsLayer* scrolledContentsLayer = backing-&gt;scrollingContentsLayer();
</span><span class="lines">@@ -3537,10 +3538,24 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderLayerCompositor::detachScrollCoordinatedLayer(RenderLayer&amp; layer)
</span><span class="cx"> {
</span><del>-    if (RenderLayerBacking* backing = layer.backing())
-        backing-&gt;detachFromScrollingCoordinator();
</del><ins>+    RenderLayerBacking* backing = layer.backing();
+    if (!backing)
+        return;
+
+    backing-&gt;detachFromScrollingCoordinator();
+
+    if (ScrollingNodeID nodeID = backing-&gt;scrollingNodeID())
+        m_scrollingNodeToLayerMap.remove(nodeID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+ScrollableArea* RenderLayerCompositor::scrollableAreaForScrollLayerID(ScrollingNodeID nodeID) const
+{
+    if (!nodeID)
+        return nullptr;
+
+    return m_scrollingNodeToLayerMap.get(nodeID);
+}
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> typedef HashMap&lt;PlatformLayer*, std::unique_ptr&lt;ViewportConstraints&gt;&gt; LayerMap;
</span><span class="cx"> typedef HashMap&lt;PlatformLayer*, PlatformLayer*&gt; StickyContainerMap;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -266,6 +266,8 @@
</span><span class="cx">     GraphicsLayer* updateLayerForFooter(bool wantsLayer);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    ScrollableArea* scrollableAreaForScrollLayerID(ScrollingNodeID) const;
+
</ins><span class="cx">     void updateScrollCoordinatedStatus(RenderLayer&amp;);
</span><span class="cx">     void removeFromScrollCoordinatedLayers(RenderLayer&amp;);
</span><span class="cx"> 
</span><span class="lines">@@ -519,6 +521,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     Color m_rootExtendedBackgroundColor;
</span><ins>+
+    HashMap&lt;ScrollingNodeID, RenderLayer*&gt; m_scrollingNodeToLayerMap;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2014-03-31  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [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.
+
</ins><span class="cx"> 2014-03-29  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix scrolling on OS X with UI-side compositing
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // This comes from the scrolling tree.
</span><del>-void RemoteScrollingCoordinatorProxy::scrollPositionChanged(WebCore::ScrollingNodeID scrolledNodeID, const WebCore::FloatPoint&amp; newScrollPosition)
</del><ins>+void RemoteScrollingCoordinatorProxy::scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID scrolledNodeID, const WebCore::FloatPoint&amp; newScrollPosition)
</ins><span class="cx"> {
</span><span class="cx">     // Scroll updates for the main frame are sent via WebPageProxy::updateVisibleContentRects()
</span><span class="cx">     // so don't send them here.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -52,7 +52,7 @@
</span><span class="cx">     virtual ~RemoteScrollingCoordinatorProxy();
</span><span class="cx">     
</span><span class="cx">     // Inform the web process that the scroll position changed (called from the scrolling tree)
</span><del>-    void scrollPositionChanged(WebCore::ScrollingNodeID, const WebCore::FloatPoint&amp; newScrollPosition);
</del><ins>+    void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint&amp; newScrollPosition);
</ins><span class="cx"> 
</span><span class="cx">     bool isPointInNonFastScrollableRegion(const WebCore::IntPoint&amp;) const;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint&amp; scrollPosition, SetOrSyncScrollingLayerPosition)
</span><span class="cx"> {
</span><del>-    m_scrollingCoordinatorProxy.scrollPositionChanged(nodeID, scrollPosition);
</del><ins>+    m_scrollingCoordinatorProxy.scrollingTreeNodeDidScroll(nodeID, scrollPosition);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> PassOwnPtr&lt;ScrollingTreeNode&gt; RemoteScrollingTree::createNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -46,13 +46,14 @@
</span><span class="cx"> 
</span><span class="cx">     const RemoteScrollingCoordinatorProxy&amp; scrollingCoordinatorProxy() const { return m_scrollingCoordinatorProxy; }
</span><span class="cx"> 
</span><ins>+    virtual void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint&amp; scrollPosition, WebCore::SetOrSyncScrollingLayerPosition = WebCore::SyncScrollingLayerPosition) override;
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit RemoteScrollingTree(RemoteScrollingCoordinatorProxy&amp;);
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     virtual void handleWheelEventPhase(WebCore::PlatformWheelEventPhase) override;
</span><span class="cx"> #endif
</span><del>-    virtual void scrollingTreeNodeDidScroll(WebCore::ScrollingNodeID, const WebCore::FloatPoint&amp; scrollPosition, WebCore::SetOrSyncScrollingLayerPosition = WebCore::SyncScrollingLayerPosition) override;
</del><span class="cx"> 
</span><span class="cx">     virtual PassOwnPtr&lt;WebCore::ScrollingTreeNode&gt; createNode(WebCore::ScrollingNodeType, WebCore::ScrollingNodeID);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -32,6 +32,8 @@
</span><span class="cx"> #include &lt;WebCore/ScrollingCoordinator.h&gt;
</span><span class="cx"> #include &lt;WebCore/ScrollingTreeScrollingNodeIOS.h&gt;
</span><span class="cx"> 
</span><ins>+OBJC_CLASS WKOverflowScrollViewDelegate;
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> class ScrollingTreeOverflowScrollingNodeIOS : public WebCore::ScrollingTreeScrollingNodeIOS {
</span><span class="lines">@@ -39,11 +41,15 @@
</span><span class="cx">     static PassOwnPtr&lt;ScrollingTreeOverflowScrollingNodeIOS&gt; create(WebCore::ScrollingTree&amp;, WebCore::ScrollingNodeID);
</span><span class="cx">     virtual ~ScrollingTreeOverflowScrollingNodeIOS();
</span><span class="cx"> 
</span><ins>+    void scrollViewDidScroll(const WebCore::FloatPoint&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     ScrollingTreeOverflowScrollingNodeIOS(WebCore::ScrollingTree&amp;, WebCore::ScrollingNodeID);
</span><span class="cx"> 
</span><ins>+    virtual void updateBeforeChildren(const WebCore::ScrollingStateNode&amp;) override;
</ins><span class="cx">     virtual void updateAfterChildren(const WebCore::ScrollingStateNode&amp;) override;
</span><span class="cx"> 
</span><ins>+    RetainPtr&lt;WKOverflowScrollViewDelegate&gt; m_scrollViewDelegate;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -31,10 +31,48 @@
</span><span class="cx"> 
</span><span class="cx"> #import &lt;WebCore/BlockExceptions.h&gt;
</span><span class="cx"> #import &lt;WebCore/ScrollingStateScrollingNode.h&gt;
</span><ins>+#import &lt;WebCore/ScrollingTree.h&gt;
</ins><span class="cx"> #import &lt;UIKit/UIScrollView.h&gt;
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><ins>+@interface WKOverflowScrollViewDelegate : NSObject &lt;UIScrollViewDelegate&gt; {
+    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-&gt;scrollViewDidScroll(scrollView.contentOffset);
+}
+
+- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
+{
+}
+
+- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
+{
+}
+
+- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView
+{
+}
+
+@end
+
</ins><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> PassOwnPtr&lt;ScrollingTreeOverflowScrollingNodeIOS&gt; ScrollingTreeOverflowScrollingNodeIOS::create(WebCore::ScrollingTree&amp; scrollingTree, WebCore::ScrollingNodeID nodeID)
</span><span class="lines">@@ -49,14 +87,46 @@
</span><span class="cx"> 
</span><span class="cx"> ScrollingTreeOverflowScrollingNodeIOS::~ScrollingTreeOverflowScrollingNodeIOS()
</span><span class="cx"> {
</span><ins>+    BEGIN_BLOCK_OBJC_EXCEPTIONS
+    if (UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate]) {
+        ASSERT([scrollView isKindOfClass:[UIScrollView self]]);
+        scrollView.delegate = nil;
+    }
+    END_BLOCK_OBJC_EXCEPTIONS
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScrollingTreeOverflowScrollingNodeIOS::updateBeforeChildren(const WebCore::ScrollingStateNode&amp; 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);
+}
+
</ins><span class="cx"> void ScrollingTreeOverflowScrollingNodeIOS::updateAfterChildren(const ScrollingStateNode&amp; stateNode)
</span><span class="cx"> {
</span><span class="cx">     ScrollingTreeScrollingNodeIOS::updateAfterChildren(stateNode);
</span><span class="cx"> 
</span><span class="cx">     const auto&amp; scrollingStateNode = toScrollingStateScrollingNode(stateNode);
</span><span class="cx"> 
</span><ins>+    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
+    }
+
</ins><span class="cx">     if (scrollingStateNode.hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize)) {
</span><span class="cx">         BEGIN_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx">         UIScrollView *scrollView = (UIScrollView *)[scrollLayer() delegate];
</span><span class="lines">@@ -68,6 +138,11 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll(const FloatPoint&amp; scrollPosition)
+{
+    scrollingTree().scrollPositionChangedViaDelegatedScrolling(scrollingNodeID(), scrollPosition);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(ASYNC_SCROLLING)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessScrollingRemoteScrollingCoordinatormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm (166530 => 166531)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -93,7 +93,7 @@
</span><span class="cx"> // Notification from the UI process that we scrolled.
</span><span class="cx"> void RemoteScrollingCoordinator::scrollPositionChangedForNode(ScrollingNodeID nodeID, const FloatPoint&amp; scrollPosition)
</span><span class="cx"> {
</span><del>-    scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, roundedIntPoint(scrollPosition), false /* FIXME */, SyncScrollingLayerPosition);
</del><ins>+    scheduleUpdateScrollPositionAfterAsyncScroll(nodeID, scrollPosition, false /* FIXME */, SyncScrollingLayerPosition);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>

</body>
</html>