<!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>[163516] 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/163516">163516</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-02-05 22:55:20 -0800 (Wed, 05 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Transfer the non-fast-scrollable region to the UI process for iOS
https://bugs.webkit.org/show_bug.cgi?id=128293

Reviewed by Benjamin Poulain.

Source/WebCore:

Two main changes to support sending the non-fast scrollable region
to the UI process for iOS:

1. Add ScrollingCoordinator::frameViewNonFastScrollableRegionChanged(),
which is called when we've updated the touch event region (this can happen
independenly of layout). When called we just scheduled a scrolling tree
commit with the new region.

2. Avoid thinking that we have a new root node with every remote scrolling
transaction. This was a side-effect of reconstructing the scrolling state
tree in the UI process, and caused us to try to grab a nonFastScrollableRegion
from a node which never had one set.

* WebCore.exp.in:
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::computeNonFastScrollableRegion):
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
* page/scrolling/ScrollingStateTree.h:
(WebCore::ScrollingStateTree::setHasNewRootStateNode):
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::commitNewTreeState):
(WebCore::ScrollingTree::isPointInNonFastScrollableRegion):
* page/scrolling/ScrollingTree.h:

Source/WebKit2:

Two main changes to support sending the non-fast scrollable region
to the UI process for iOS:

1. Add ScrollingCoordinator::frameViewNonFastScrollableRegionChanged(),
which is called when we've updated the touch event region (this can happen
independenly of layout). When called we just scheduled a scrolling tree
commit with the new region.

2. Avoid thinking that we have a new root node with every remote scrolling
transaction. This was a side-effect of reconstructing the scrolling state
tree in the UI process, and caused us to try to grab a nonFastScrollableRegion
from a node which never had one set.

Now that we have the non-fast scrollable region in the UI process, we can
use it to avoid sending sync messages to the web process.

* Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
(ArgumentCoder&lt;ScrollingStateScrollingNode&gt;::encode): Encode hasNewRootNode.
(ArgumentCoder&lt;ScrollingStateScrollingNode&gt;::decode): Decode hasNewRootNode and set it on
the state tree.
(WebKit::RemoteScrollingCoordinatorTransaction::encode): Encode the nonFastScrollableRegion
now that we can encode Regions.
(WebKit::RemoteScrollingCoordinatorTransaction::decode): Decode the nonFastScrollableRegion
now that we can decode Regions.
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::isPointInNonFastScrollableRegion):
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::handleTouchEvent): If we're not in the non-fast scrollable region,
don't both sending touch events to the web process.</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="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorh">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingCoordinatorh">trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingStateTreeh">trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h</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="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedScrollingRemoteScrollingCoordinatorTransactioncpp">trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharediosNativeWebTouchEventIOSmm">trunk/Source/WebKit2/Shared/ios/NativeWebTouchEventIOS.mm</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="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth">trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/ChangeLog        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2014-02-05  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Transfer the non-fast-scrollable region to the UI process for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=128293
+
+        Reviewed by Benjamin Poulain.
+
+        Two main changes to support sending the non-fast scrollable region
+        to the UI process for iOS:
+        
+        1. Add ScrollingCoordinator::frameViewNonFastScrollableRegionChanged(),
+        which is called when we've updated the touch event region (this can happen
+        independenly of layout). When called we just scheduled a scrolling tree
+        commit with the new region.
+        
+        2. Avoid thinking that we have a new root node with every remote scrolling
+        transaction. This was a side-effect of reconstructing the scrolling state
+        tree in the UI process, and caused us to try to grab a nonFastScrollableRegion
+        from a node which never had one set.
+
+        * WebCore.exp.in:
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::computeNonFastScrollableRegion):
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::frameViewNonFastScrollableRegionChanged):
+        * page/scrolling/ScrollingStateTree.h:
+        (WebCore::ScrollingStateTree::setHasNewRootStateNode):
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::commitNewTreeState):
+        (WebCore::ScrollingTree::isPointInNonFastScrollableRegion):
+        * page/scrolling/ScrollingTree.h:
+
</ins><span class="cx"> 2014-02-05  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Synchronize the WKContentView and UIScrollView updates with the tiles being commited
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -1129,6 +1129,8 @@
</span><span class="cx"> __ZN7WebCore6Editor7commandERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore6Editor7outdentEv
</span><span class="cx"> __ZN7WebCore6JSNode6s_infoE
</span><ins>+__ZN7WebCore6Region21updateBoundsFromShapeEv
+__ZNK7WebCore6Region5Shape7isValidEv
</ins><span class="cx"> __ZN7WebCore6Region5uniteERKS0_
</span><span class="cx"> __ZN7WebCore6Region8subtractERKS0_
</span><span class="cx"> __ZN7WebCore6Region9intersectERKS0_
</span><span class="lines">@@ -2993,6 +2995,7 @@
</span><span class="cx"> __ZN7WebCore13ScrollingTree18commitNewTreeStateEN3WTF10PassOwnPtrINS_18ScrollingStateTreeEEE
</span><span class="cx"> __ZN7WebCore13ScrollingTree21setCanRubberBandStateEbbbb
</span><span class="cx"> __ZN7WebCore13ScrollingTree31willWheelEventStartSwipeGestureERKNS_18PlatformWheelEventE
</span><ins>+__ZN7WebCore13ScrollingTree32isPointInNonFastScrollableRegionENS_8IntPointE
</ins><span class="cx"> __ZN7WebCore13ScrollingTree35shouldHandleWheelEventSynchronouslyERKNS_18PlatformWheelEventE
</span><span class="cx"> __ZN7WebCore13ScrollingTree37setScrollingPerformanceLoggingEnabledEb
</span><span class="cx"> __ZN7WebCore13ScrollingTree42scrollPositionChangedViaDelegatedScrollingEyRKNS_8IntPointE
</span><span class="lines">@@ -3026,6 +3029,7 @@
</span><span class="cx"> __ZN7WebCore25AsyncScrollingCoordinator29updateViewportConstrainedNodeEyRKNS_19ViewportConstraintsEPNS_13GraphicsLayerE
</span><span class="cx"> __ZN7WebCore25AsyncScrollingCoordinator30setSynchronousScrollingReasonsEj
</span><span class="cx"> __ZN7WebCore25AsyncScrollingCoordinator37scrollableAreaScrollbarLayerDidChangeEPNS_14ScrollableAreaENS_20ScrollbarOrientationE
</span><ins>+__ZN7WebCore25AsyncScrollingCoordinator39frameViewNonFastScrollableRegionChangedEPNS_9FrameViewE
</ins><span class="cx"> __ZN7WebCore25AsyncScrollingCoordinator43recomputeWheelEventHandlerCountForFrameViewEPNS_9FrameViewE
</span><span class="cx"> __ZN7WebCore25AsyncScrollingCoordinator44scheduleUpdateScrollPositionAfterAsyncScrollEyRKNS_10FloatPointEbNS_31SetOrSyncScrollingLayerPositionE
</span><span class="cx"> __ZN7WebCore25AsyncScrollingCoordinatorC2EPNS_4PageE
</span><span class="lines">@@ -3041,6 +3045,7 @@
</span><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode20setTotalContentsSizeERKNS_7IntSizeE
</span><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode24setCounterScrollingLayerERKNS_19LayerRepresentationE
</span><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode25setWheelEventHandlerCountEj
</span><ins>+__ZN7WebCore27ScrollingStateScrollingNode26setNonFastScrollableRegionERKNS_6RegionE
</ins><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode27setScrollableAreaParametersERKNS_24ScrollableAreaParametersE
</span><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode30setSynchronousScrollingReasonsEj
</span><span class="cx"> __ZN7WebCore27ScrollingStateScrollingNode33setScrollBehaviorForFixedElementsENS_30ScrollBehaviorForFixedElementsE
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -105,6 +105,15 @@
</span><span class="cx">     node-&gt;setScrollableAreaParameters(scrollParameters);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged(FrameView*)
+{
+    if (!m_scrollingStateTree-&gt;rootStateNode())
+        return;
+
+    Region nonFastScrollableRegion = computeNonFastScrollableRegion(&amp;m_page-&gt;mainFrame(), IntPoint());
+    setNonFastScrollableRegionForNode(nonFastScrollableRegion, m_scrollingStateTree-&gt;rootStateNode());
+}
+
</ins><span class="cx"> void AsyncScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -78,6 +78,7 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void frameViewLayoutUpdated(FrameView*) override;
</span><span class="cx">     virtual void frameViewRootLayerDidChange(FrameView*) override;
</span><ins>+    virtual void frameViewNonFastScrollableRegionChanged(FrameView*) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&amp;) override;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -94,6 +94,24 @@
</span><span class="cx"> 
</span><span class="cx"> Region ScrollingCoordinator::computeNonFastScrollableRegion(const Frame* frame, const IntPoint&amp; frameLocation) const
</span><span class="cx"> {
</span><ins>+#if PLATFORM(IOS)
+    // On iOS, we use nonFastScrollableRegion to represent the region covered by elements with touch event handlers.
+    ASSERT(frame-&gt;isMainFrame());
+    UNUSED_PARAM(frameLocation);
+
+    Document* document = frame-&gt;document();
+    if (!document)
+        return Region();
+
+    Vector&lt;IntRect&gt; touchRects;
+    document-&gt;getTouchRects(touchRects);
+    
+    Region touchRegion;
+    for (auto rect : touchRects)
+        touchRegion.unite(rect);
+
+    return touchRegion;
+#else
</ins><span class="cx">     Region nonFastScrollableRegion;
</span><span class="cx">     FrameView* frameView = frame-&gt;view();
</span><span class="cx">     if (!frameView)
</span><span class="lines">@@ -126,6 +144,7 @@
</span><span class="cx">         nonFastScrollableRegion.unite(computeNonFastScrollableRegion(subframe, offset));
</span><span class="cx"> 
</span><span class="cx">     return nonFastScrollableRegion;
</span><ins>+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> unsigned ScrollingCoordinator::computeCurrentWheelEventHandlerCount()
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -125,6 +125,9 @@
</span><span class="cx">     // Should be called whenever the set of fixed objects changes.
</span><span class="cx">     void frameViewFixedObjectsDidChange(FrameView*);
</span><span class="cx"> 
</span><ins>+    // Called whenever the non-fast scrollable region changes for reasons other than layout.
+    virtual void frameViewNonFastScrollableRegionChanged(FrameView*) { }
+
</ins><span class="cx">     // Should be called whenever the root layer for the given frame view changes.
</span><span class="cx">     virtual void frameViewRootLayerDidChange(FrameView*);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingStateTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx">     bool hasChangedProperties() const { return m_hasChangedProperties; }
</span><span class="cx"> 
</span><span class="cx">     bool hasNewRootStateNode() const { return m_hasNewRootStateNode; }
</span><ins>+    void setHasNewRootStateNode(bool hasNewRoot) { m_hasNewRootStateNode = hasNewRoot; }
</ins><span class="cx">     
</span><span class="cx">     int nodeCount() const { return m_stateNodeMap.size(); }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -254,6 +254,13 @@
</span><span class="cx">     m_mainFrameScrollPosition = position;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool ScrollingTree::isPointInNonFastScrollableRegion(IntPoint p)
+{
+    MutexLocker lock(m_mutex);
+    
+    return m_nonFastScrollableRegion.contains(p);
+}
+
</ins><span class="cx"> bool ScrollingTree::isRubberBandInProgress()
</span><span class="cx"> {
</span><span class="cx">     MutexLocker lock(m_mutex);    
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -76,6 +76,8 @@
</span><span class="cx">     virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint&amp; scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) = 0;
</span><span class="cx">     FloatPoint mainFrameScrollPosition();
</span><span class="cx"> 
</span><ins>+    bool isPointInNonFastScrollableRegion(IntPoint);
+    
</ins><span class="cx"> #if PLATFORM(MAC) &amp;&amp; !PLATFORM(IOS)
</span><span class="cx">     virtual void handleWheelEventPhase(PlatformWheelEventPhase) = 0;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/ChangeLog        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -1,3 +1,41 @@
</span><ins>+2014-02-05  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Transfer the non-fast-scrollable region to the UI process for iOS
+        https://bugs.webkit.org/show_bug.cgi?id=128293
+
+        Reviewed by Benjamin Poulain.
+
+        Two main changes to support sending the non-fast scrollable region
+        to the UI process for iOS:
+        
+        1. Add ScrollingCoordinator::frameViewNonFastScrollableRegionChanged(),
+        which is called when we've updated the touch event region (this can happen
+        independenly of layout). When called we just scheduled a scrolling tree
+        commit with the new region.
+        
+        2. Avoid thinking that we have a new root node with every remote scrolling
+        transaction. This was a side-effect of reconstructing the scrolling state
+        tree in the UI process, and caused us to try to grab a nonFastScrollableRegion
+        from a node which never had one set.
+        
+        Now that we have the non-fast scrollable region in the UI process, we can
+        use it to avoid sending sync messages to the web process.
+        
+        * Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp:
+        (ArgumentCoder&lt;ScrollingStateScrollingNode&gt;::encode): Encode hasNewRootNode.
+        (ArgumentCoder&lt;ScrollingStateScrollingNode&gt;::decode): Decode hasNewRootNode and set it on
+        the state tree.
+        (WebKit::RemoteScrollingCoordinatorTransaction::encode): Encode the nonFastScrollableRegion
+        now that we can encode Regions.
+        (WebKit::RemoteScrollingCoordinatorTransaction::decode): Decode the nonFastScrollableRegion
+        now that we can decode Regions.
+        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
+        (WebKit::RemoteScrollingCoordinatorProxy::isPointInNonFastScrollableRegion):
+        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::handleTouchEvent): If we're not in the non-fast scrollable region,
+        don't both sending touch events to the web process.
+
</ins><span class="cx"> 2014-02-05  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] Synchronize the WKContentView and UIScrollView updates with the tiles being commited
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedScrollingRemoteScrollingCoordinatorTransactioncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/Shared/Scrolling/RemoteScrollingCoordinatorTransaction.cpp        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -113,7 +113,7 @@
</span><span class="cx">     SCROLLING_NODE_ENCODE(ScrollPosition, scrollPosition)
</span><span class="cx">     SCROLLING_NODE_ENCODE(ScrollOrigin, scrollOrigin)
</span><span class="cx">     SCROLLING_NODE_ENCODE(FrameScaleFactor, frameScaleFactor)
</span><del>-//    SCROLLING_NODE_ENCODE(NonFastScrollableRegion, nonFastScrollableRegion) // FIXME: no encoder support for Region
</del><ins>+    SCROLLING_NODE_ENCODE(NonFastScrollableRegion, nonFastScrollableRegion)
</ins><span class="cx">     SCROLLING_NODE_ENCODE(WheelEventHandlerCount, wheelEventHandlerCount)
</span><span class="cx">     SCROLLING_NODE_ENCODE(ReasonsForSynchronousScrolling, synchronousScrollingReasons)
</span><span class="cx">     SCROLLING_NODE_ENCODE(ScrollableAreaParams, scrollableAreaParameters)
</span><span class="lines">@@ -149,7 +149,7 @@
</span><span class="cx">     SCROLLING_NODE_DECODE(ScrollPosition, FloatPoint, setScrollPosition);
</span><span class="cx">     SCROLLING_NODE_DECODE(ScrollOrigin, IntPoint, setScrollOrigin);
</span><span class="cx">     SCROLLING_NODE_DECODE(FrameScaleFactor, float, setFrameScaleFactor);
</span><del>-//    SCROLLING_NODE_DECODE(NonFastScrollableRegion, Region, setNonFastScrollableRegion); // FIXME: no decoder support for Region.
</del><ins>+    SCROLLING_NODE_DECODE(NonFastScrollableRegion, Region, setNonFastScrollableRegion);
</ins><span class="cx">     SCROLLING_NODE_DECODE(WheelEventHandlerCount, int, setWheelEventHandlerCount);
</span><span class="cx">     SCROLLING_NODE_DECODE(ReasonsForSynchronousScrolling, SynchronousScrollingReasons, setSynchronousScrollingReasons);
</span><span class="cx">     SCROLLING_NODE_DECODE(ScrollableAreaParams, ScrollableAreaParameters, setScrollableAreaParameters);
</span><span class="lines">@@ -236,6 +236,9 @@
</span><span class="cx"> {
</span><span class="cx">     int numNodes = m_scrollingStateTree ? m_scrollingStateTree-&gt;nodeCount() : 0;
</span><span class="cx">     encoder &lt;&lt; numNodes;
</span><ins>+    
+    bool hasNewRootNode = m_scrollingStateTree ? m_scrollingStateTree-&gt;hasNewRootStateNode() : false;
+    encoder &lt;&lt; hasNewRootNode;
</ins><span class="cx"> 
</span><span class="cx">     if (m_scrollingStateTree) {
</span><span class="cx">         if (const ScrollingStateNode* rootNode = m_scrollingStateTree-&gt;rootStateNode())
</span><span class="lines">@@ -257,6 +260,10 @@
</span><span class="cx">     if (!decoder.decode(numNodes))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span><ins>+    bool hasNewRootNode;
+    if (!decoder.decode(hasNewRootNode))
+        return false;
+    
</ins><span class="cx">     m_scrollingStateTree = ScrollingStateTree::create();
</span><span class="cx">     
</span><span class="cx">     for (int i = 0; i &lt; numNodes; ++i) {
</span><span class="lines">@@ -293,6 +300,8 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    m_scrollingStateTree-&gt;setHasNewRootStateNode(hasNewRootNode);
+
</ins><span class="cx">     // Removed nodes
</span><span class="cx">     Vector&lt;ScrollingNodeID&gt; removedNodes;
</span><span class="cx">     if (!decoder.decode(removedNodes))
</span></span></pre></div>
<a id="trunkSourceWebKit2SharediosNativeWebTouchEventIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ios/NativeWebTouchEventIOS.mm (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ios/NativeWebTouchEventIOS.mm        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/Shared/ios/NativeWebTouchEventIOS.mm        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -41,11 +41,11 @@
</span><span class="cx">     case UIWebTouchEventTouchBegin:
</span><span class="cx">         return WebEvent::TouchStart;
</span><span class="cx">     case UIWebTouchEventTouchChange:
</span><del>-        return WebEvent::TouchStart;
</del><ins>+        return WebEvent::TouchMove;
</ins><span class="cx">     case UIWebTouchEventTouchEnd:
</span><del>-        return WebEvent::TouchStart;
</del><ins>+        return WebEvent::TouchEnd;
</ins><span class="cx">     case UIWebTouchEventTouchCancel:
</span><del>-        return WebEvent::TouchStart;
</del><ins>+        return WebEvent::TouchCancel;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -129,6 +129,11 @@
</span><span class="cx">     return result == ScrollingTree::DidHandleEvent; // FIXME: handle other values.
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool RemoteScrollingCoordinatorProxy::isPointInNonFastScrollableRegion(const WebCore::IntPoint&amp; p) const
+{
+    return m_scrollingTree-&gt;isPointInNonFastScrollableRegion(p);
+}
+
</ins><span class="cx"> void RemoteScrollingCoordinatorProxy::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const IntPoint&amp; offset)
</span><span class="cx"> {
</span><span class="cx">     m_scrollingTree-&gt;scrollPositionChangedViaDelegatedScrolling(nodeID, offset);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -54,6 +54,8 @@
</span><span class="cx">     // Inform the web process that the scroll position changed (called from the scrolling tree)
</span><span class="cx">     void scrollPositionChanged(WebCore::ScrollingNodeID, const WebCore::FloatPoint&amp; newScrollPosition);
</span><span class="cx"> 
</span><ins>+    bool isPointInNonFastScrollableRegion(const WebCore::IntPoint&amp;) const;
+
</ins><span class="cx">     // Called externally when native views move around.
</span><span class="cx">     void scrollPositionChangedViaDelegatedScrolling(WebCore::ScrollingNodeID, const WebCore::IntPoint&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -291,9 +291,6 @@
</span><span class="cx">     , m_syncNavigationActionPolicyAction(PolicyUse)
</span><span class="cx">     , m_syncNavigationActionPolicyDownloadID(0)
</span><span class="cx">     , m_processingMouseMoveEvent(false)
</span><del>-#if ENABLE(TOUCH_EVENTS)
-    , m_needTouchEvents(false)
-#endif
</del><span class="cx">     , m_pageID(pageID)
</span><span class="cx">     , m_session(session)
</span><span class="cx">     , m_isPageSuspended(false)
</span><span class="lines">@@ -1376,6 +1373,16 @@
</span><span class="cx"> #endif // ENABLE(NETSCAPE_PLUGIN_API)
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><ins>+static bool anyTouchIsInNonFastScrollableRegion(RemoteScrollingCoordinatorProxy&amp; scrollingCoordinator, const WebTouchEvent&amp; event)
+{
+    for (auto touchPoint : event.touchPoints()) {
+        if (scrollingCoordinator.isPointInNonFastScrollableRegion(touchPoint.location()))
+            return true;
+    }
+
+    return false;
+}
+
</ins><span class="cx"> void WebPageProxy::handleTouchEvent(const NativeWebTouchEvent&amp; event)
</span><span class="cx"> {
</span><span class="cx">     if (!isValid())
</span><span class="lines">@@ -1384,7 +1391,11 @@
</span><span class="cx">     // If the page is suspended, which should be the case during panning, pinching
</span><span class="cx">     // and animation on the page itself (kinetic scrolling, tap to zoom) etc, then
</span><span class="cx">     // we do not send any of the events to the page even if is has listeners.
</span><del>-    if (m_needTouchEvents &amp;&amp; !m_isPageSuspended) {
</del><ins>+    if (!m_isPageSuspended) {
+        // FIXME: we should only do this check for the start of a touch gesture.
+        if (!anyTouchIsInNonFastScrollableRegion(*m_scrollingCoordinatorProxy, event))
+            return;
+
</ins><span class="cx">         m_touchEventQueue.append(event);
</span><span class="cx">         m_process-&gt;responsivenessTimer()-&gt;start();
</span><span class="cx">         if (m_shouldSendEventsSynchronously) {
</span><span class="lines">@@ -2881,13 +2892,6 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if ENABLE(TOUCH_EVENTS)
-void WebPageProxy::needTouchEvents(bool needTouchEvents)
-{
-    m_needTouchEvents = needTouchEvents;
-}
-#endif
-
</del><span class="cx"> #if ENABLE(INPUT_TYPE_COLOR)
</span><span class="cx"> void WebPageProxy::showColorPicker(const WebCore::Color&amp; initialColor, const IntRect&amp; elementRect)
</span><span class="cx"> {
</span><span class="lines">@@ -3879,7 +3883,6 @@
</span><span class="cx">     m_processingMouseMoveEvent = false;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><del>-    m_needTouchEvents = false;
</del><span class="cx">     m_touchEventQueue.clear();
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -1318,7 +1318,6 @@
</span><span class="cx">     OwnPtr&lt;NativeWebMouseEvent&gt; m_currentlyProcessedMouseDownEvent;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><del>-    bool m_needTouchEvents;
</del><span class="cx">     Deque&lt;QueuedTouchEvents&gt; m_touchEventQueue;
</span><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(INPUT_TYPE_COLOR)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -94,10 +94,6 @@
</span><span class="cx">     DidChangeContentSize(WebCore::IntSize newSize)
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if ENABLE(TOUCH_EVENTS)
-    NeedTouchEvents(bool needTouchEvents)
-#endif
-
</del><span class="cx"> #if ENABLE(INPUT_TYPE_COLOR)
</span><span class="cx">     ShowColorPicker(WebCore::Color initialColor, WebCore::IntRect elementRect);
</span><span class="cx">     SetColorPickerColor(WebCore::Color color);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -821,13 +821,6 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if ENABLE(TOUCH_EVENTS)
-void WebChromeClient::needTouchEvents(bool needTouchEvents)
-{
-    m_page-&gt;send(Messages::WebPageProxy::NeedTouchEvents(needTouchEvents));
-}
-#endif
-
</del><span class="cx"> #if ENABLE(FULLSCREEN_API)
</span><span class="cx"> bool WebChromeClient::supportsFullScreenForElement(const WebCore::Element*, bool withKeyboard)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebCoreSupportWebChromeClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h (163515 => 163516)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-02-06 06:45:41 UTC (rev 163515)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h        2014-02-06 06:55:20 UTC (rev 163516)
</span><span class="lines">@@ -230,7 +230,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TOUCH_EVENTS)
</span><del>-    virtual void needTouchEvents(bool) override;
</del><ins>+    virtual void needTouchEvents(bool) override { }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span></span></pre>
</div>
</div>

</body>
</html>