<!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>[161212] 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/161212">161212</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-01-02 11:41:45 -0800 (Thu, 02 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add AsyncScrollingCoordinator, which is a base class for threaded and future remote ScrollingCoordinators
https://bugs.webkit.org/show_bug.cgi?id=126389

Source/WebCore:

Reviewed by Tim Horton.

Add AsyncScrollingCoordinator, a ScrollingCoordinator that knows about ScrollingStateTrees
and ScrollingTrees, but leaves it up to subclasses to decide when and how to commit.

* WebCore.xcodeproj/project.pbxproj: Added AsyncScrollingCoordinator.*
* page/scrolling/AsyncScrollingCoordinator.cpp: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm.
(WebCore::AsyncScrollingCoordinator::AsyncScrollingCoordinator):
(WebCore::AsyncScrollingCoordinator::~AsyncScrollingCoordinator):
(WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
(WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
(WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
(WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
(WebCore::AsyncScrollingCoordinator::attachToStateTree):
(WebCore::AsyncScrollingCoordinator::detachFromStateTree):
(WebCore::AsyncScrollingCoordinator::clearStateTree):
(WebCore::AsyncScrollingCoordinator::syncChildPositions):
(WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
(WebCore::AsyncScrollingCoordinator::updateScrollingNode):
(WebCore::AsyncScrollingCoordinator::updateViewportConstrainedNode):
(WebCore::AsyncScrollingCoordinator::setScrollLayerForNode):
(WebCore::AsyncScrollingCoordinator::setCounterScrollingLayerForNode):
(WebCore::AsyncScrollingCoordinator::setHeaderLayerForNode):
(WebCore::AsyncScrollingCoordinator::setFooterLayerForNode):
(WebCore::AsyncScrollingCoordinator::setNonFastScrollableRegionForNode):
(WebCore::AsyncScrollingCoordinator::setWheelEventHandlerCountForNode):
(WebCore::AsyncScrollingCoordinator::setScrollBehaviorForFixedElementsForNode):
(WebCore::AsyncScrollingCoordinator::setScrollbarPaintersFromScrollbarsForNode):
(WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
(WebCore::AsyncScrollingCoordinator::updateMainFrameScrollLayerPosition):
(WebCore::AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView):
(WebCore::AsyncScrollingCoordinator::isRubberBandInProgress):
(WebCore::AsyncScrollingCoordinator::setScrollPinningBehavior):
(WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText):
* page/scrolling/AsyncScrollingCoordinator.h: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h.
(WebCore::AsyncScrollingCoordinator::scrollingTree):
(WebCore::AsyncScrollingCoordinator::setScrollingTree):
(WebCore::AsyncScrollingCoordinator::scrollingStateTree):
(WebCore::AsyncScrollingCoordinator::releaseScrollingTree):
* page/scrolling/ScrollingCoordinator.h: Add casting support.
(WebCore::ScrollingCoordinator::isAsyncScrollingCoordinator):
* page/scrolling/ThreadedScrollingTree.h: commitNewTreeState() needs to be public.
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm: Lots of code moved to AsyncScrollingCoordinator.
(WebCore::ScrollingCoordinatorMac::ScrollingCoordinatorMac):
(WebCore::ScrollingCoordinatorMac::~ScrollingCoordinatorMac):
(WebCore::ScrollingCoordinatorMac::pageDestroyed):
(WebCore::ScrollingCoordinatorMac::commitTreeStateIfNeeded):
(WebCore::ScrollingCoordinatorMac::handleWheelEvent):
(WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
(WebCore::ScrollingCoordinatorMac::commitTreeState):
(WebCore::ScrollingCoordinatorMac::updateTiledScrollingIndicator):

Source/WebKit2:

Reviewed by Tim Horton.

Add AsyncScrollingCoordinator, a ScrollingCoordinator that knows about ScrollingStateTrees
and ScrollingTrees, but leaves it up to subclasses to decide when and how to commit.

* WebProcess/WebPage/EventDispatcher.cpp:
(WebKit::EventDispatcher::addScrollingTreeForPage): The ScrollingTree is exposed on
AsyncScrollingCoordinator now, not ScrollingCoordinator, so we have to cast here.
* WebProcess/WebPage/WebPage.cpp: m_useThreadedScrolling -&gt; m_useAsyncScrolling terminology change.
(WebKit::WebPage::WebPage):
(WebKit::WebPage::~WebPage):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::updatePreferences): Cast to AsyncScrollingCoordinator in order
to get to the ScrollingTree.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingCoordinatorh">trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingThreadedScrollingTreeh">trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingCoordinatorMach">trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingCoordinatorMacmm">trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageEventDispatchercpp">trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreamm">trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebCore/ChangeLog        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -1,3 +1,61 @@
</span><ins>+2014-01-02  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Add AsyncScrollingCoordinator, which is a base class for threaded and future remote ScrollingCoordinators
+        https://bugs.webkit.org/show_bug.cgi?id=126389
+
+        Reviewed by Tim Horton.
+
+        Add AsyncScrollingCoordinator, a ScrollingCoordinator that knows about ScrollingStateTrees
+        and ScrollingTrees, but leaves it up to subclasses to decide when and how to commit.
+
+        * WebCore.xcodeproj/project.pbxproj: Added AsyncScrollingCoordinator.*
+        * page/scrolling/AsyncScrollingCoordinator.cpp: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm.
+        (WebCore::AsyncScrollingCoordinator::AsyncScrollingCoordinator):
+        (WebCore::AsyncScrollingCoordinator::~AsyncScrollingCoordinator):
+        (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
+        (WebCore::AsyncScrollingCoordinator::frameViewRootLayerDidChange):
+        (WebCore::AsyncScrollingCoordinator::requestScrollPositionUpdate):
+        (WebCore::AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange):
+        (WebCore::AsyncScrollingCoordinator::attachToStateTree):
+        (WebCore::AsyncScrollingCoordinator::detachFromStateTree):
+        (WebCore::AsyncScrollingCoordinator::clearStateTree):
+        (WebCore::AsyncScrollingCoordinator::syncChildPositions):
+        (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
+        (WebCore::AsyncScrollingCoordinator::updateScrollingNode):
+        (WebCore::AsyncScrollingCoordinator::updateViewportConstrainedNode):
+        (WebCore::AsyncScrollingCoordinator::setScrollLayerForNode):
+        (WebCore::AsyncScrollingCoordinator::setCounterScrollingLayerForNode):
+        (WebCore::AsyncScrollingCoordinator::setHeaderLayerForNode):
+        (WebCore::AsyncScrollingCoordinator::setFooterLayerForNode):
+        (WebCore::AsyncScrollingCoordinator::setNonFastScrollableRegionForNode):
+        (WebCore::AsyncScrollingCoordinator::setWheelEventHandlerCountForNode):
+        (WebCore::AsyncScrollingCoordinator::setScrollBehaviorForFixedElementsForNode):
+        (WebCore::AsyncScrollingCoordinator::setScrollbarPaintersFromScrollbarsForNode):
+        (WebCore::AsyncScrollingCoordinator::setSynchronousScrollingReasons):
+        (WebCore::AsyncScrollingCoordinator::updateMainFrameScrollLayerPosition):
+        (WebCore::AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView):
+        (WebCore::AsyncScrollingCoordinator::isRubberBandInProgress):
+        (WebCore::AsyncScrollingCoordinator::setScrollPinningBehavior):
+        (WebCore::AsyncScrollingCoordinator::scrollingStateTreeAsText):
+        * page/scrolling/AsyncScrollingCoordinator.h: Copied from Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h.
+        (WebCore::AsyncScrollingCoordinator::scrollingTree):
+        (WebCore::AsyncScrollingCoordinator::setScrollingTree):
+        (WebCore::AsyncScrollingCoordinator::scrollingStateTree):
+        (WebCore::AsyncScrollingCoordinator::releaseScrollingTree):
+        * page/scrolling/ScrollingCoordinator.h: Add casting support.
+        (WebCore::ScrollingCoordinator::isAsyncScrollingCoordinator):
+        * page/scrolling/ThreadedScrollingTree.h: commitNewTreeState() needs to be public.
+        * page/scrolling/mac/ScrollingCoordinatorMac.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm: Lots of code moved to AsyncScrollingCoordinator.
+        (WebCore::ScrollingCoordinatorMac::ScrollingCoordinatorMac):
+        (WebCore::ScrollingCoordinatorMac::~ScrollingCoordinatorMac):
+        (WebCore::ScrollingCoordinatorMac::pageDestroyed):
+        (WebCore::ScrollingCoordinatorMac::commitTreeStateIfNeeded):
+        (WebCore::ScrollingCoordinatorMac::handleWheelEvent):
+        (WebCore::ScrollingCoordinatorMac::scheduleTreeStateCommit):
+        (WebCore::ScrollingCoordinatorMac::commitTreeState):
+        (WebCore::ScrollingCoordinatorMac::updateTiledScrollingIndicator):
+
</ins><span class="cx"> 2014-01-02  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Simplify the insides of DocumentSharedObjectPool and reduce memory usage.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -498,6 +498,8 @@
</span><span class="cx">                 0FF5026A102BA9430066F39A /* JSStyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF50268102BA9430066F39A /* JSStyleMedia.h */; };
</span><span class="cx">                 0FF50271102BA96A0066F39A /* StyleMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FF5026E102BA9660066F39A /* StyleMedia.cpp */; };
</span><span class="cx">                 0FF50272102BA96A0066F39A /* StyleMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FF5026F102BA96A0066F39A /* StyleMedia.h */; };
</span><ins>+                0FFD4D6018651FA300512F6E /* AsyncScrollingCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0FFD4D5E18651FA300512F6E /* AsyncScrollingCoordinator.cpp */; };
+                0FFD4D6118651FA300512F6E /* AsyncScrollingCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = 0FFD4D5F18651FA300512F6E /* AsyncScrollingCoordinator.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 10FB084B14E15C7E00A3DB98 /* PublicURLManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */; };
</span><span class="cx">                 1400D7A817136EA70077CE05 /* ScriptWrappableInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 1400D7A717136EA70077CE05 /* ScriptWrappableInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 1402645E0AFDC19B005919E2 /* LoggingMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1402645D0AFDC19B005919E2 /* LoggingMac.mm */; };
</span><span class="lines">@@ -7128,6 +7130,8 @@
</span><span class="cx">                 0FF5026E102BA9660066F39A /* StyleMedia.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StyleMedia.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0FF5026F102BA96A0066F39A /* StyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleMedia.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 0FF50270102BA96A0066F39A /* StyleMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleMedia.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                0FFD4D5E18651FA300512F6E /* AsyncScrollingCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncScrollingCoordinator.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                0FFD4D5F18651FA300512F6E /* AsyncScrollingCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncScrollingCoordinator.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicURLManager.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1400D7A717136EA70077CE05 /* ScriptWrappableInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappableInlines.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -14462,6 +14466,8 @@
</span><span class="cx">                 1AF62EE114DA22A70041556C /* scrolling */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                0FFD4D5E18651FA300512F6E /* AsyncScrollingCoordinator.cpp */,
+                                0FFD4D5F18651FA300512F6E /* AsyncScrollingCoordinator.h */,
</ins><span class="cx">                                 1AF62EE214DA22A70041556C /* mac */,
</span><span class="cx">                                 0F605AEA15F94848004DF0C0 /* ScrollingConstraints.cpp */,
</span><span class="cx">                                 0F605AEB15F94848004DF0C0 /* ScrollingConstraints.h */,
</span><span class="lines">@@ -25197,6 +25203,7 @@
</span><span class="cx">                                 9759E94314EF1CF80026A2DD /* TextTrackCue.h in Headers */,
</span><span class="cx">                                 071A9EC3168FBC55002629F9 /* TextTrackCueGeneric.h in Headers */,
</span><span class="cx">                                 9759E94614EF1CF80026A2DD /* TextTrackCueList.h in Headers */,
</span><ins>+                                0FFD4D6118651FA300512F6E /* AsyncScrollingCoordinator.h in Headers */,
</ins><span class="cx">                                 076970871463AD8700F502CF /* TextTrackList.h in Headers */,
</span><span class="cx">                                 B1AD4E7413A12A4600846B27 /* TextTrackLoader.h in Headers */,
</span><span class="cx">                                 498770F11242C535002226BA /* Texture.h in Headers */,
</span><span class="lines">@@ -26457,6 +26464,7 @@
</span><span class="cx">                                 A75E8B880E1DE2D6007F2481 /* FEBlend.cpp in Sources */,
</span><span class="cx">                                 A75E8B8A0E1DE2D6007F2481 /* FEColorMatrix.cpp in Sources */,
</span><span class="cx">                                 A75E8B8C0E1DE2D6007F2481 /* FEComponentTransfer.cpp in Sources */,
</span><ins>+                                0FFD4D6018651FA300512F6E /* AsyncScrollingCoordinator.cpp in Sources */,
</ins><span class="cx">                                 A75E8B8E0E1DE2D6007F2481 /* FEComposite.cpp in Sources */,
</span><span class="cx">                                 84730D781248F0B300D3A9C9 /* FEConvolveMatrix.cpp in Sources */,
</span><span class="cx">                                 CDD7089618359F6F002B3DC6 /* SampleMap.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcppfromrev161210trunkSourceWebCorepagescrollingmacScrollingCoordinatorMacmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (from rev 161210, trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm) (0 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp                                (rev 0)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -0,0 +1,351 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+
+#if ENABLE(ASYNC_SCROLLING)
+#include &quot;AsyncScrollingCoordinator.h&quot;
+
+#include &quot;Frame.h&quot;
+#include &quot;FrameView.h&quot;
+#include &quot;GraphicsLayer.h&quot;
+#include &quot;MainFrame.h&quot;
+#include &quot;Page.h&quot;
+#include &quot;ScrollingConstraints.h&quot;
+#include &quot;ScrollingStateFixedNode.h&quot;
+#include &quot;ScrollingStateScrollingNode.h&quot;
+#include &quot;ScrollingStateStickyNode.h&quot;
+#include &quot;ScrollingStateTree.h&quot;
+
+namespace WebCore {
+
+AsyncScrollingCoordinator::AsyncScrollingCoordinator(Page* page)
+    : ScrollingCoordinator(page)
+    , m_scrollingStateTree(ScrollingStateTree::create())
+{
+}
+
+AsyncScrollingCoordinator::~AsyncScrollingCoordinator()
+{
+}
+
+void AsyncScrollingCoordinator::frameViewLayoutUpdated(FrameView* frameView)
+{
+    ASSERT(isMainThread());
+    ASSERT(m_page);
+
+    // If there isn't a root node yet, don't do anything. We'll be called again after creating one.
+    if (!m_scrollingStateTree-&gt;rootStateNode())
+        return;
+
+    // Compute the region of the page that we can't do fast scrolling for. This currently includes
+    // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the
+    // frame view whose layout was updated is not the main frame.
+    Region nonFastScrollableRegion = computeNonFastScrollableRegion(&amp;m_page-&gt;mainFrame(), IntPoint());
+
+    // In the future, we may want to have the ability to set non-fast scrolling regions for more than
+    // just the root node. But right now, this concept only applies to the root.
+    setNonFastScrollableRegionForNode(nonFastScrollableRegion, m_scrollingStateTree-&gt;rootStateNode());
+
+    if (!coordinatesScrollingForFrameView(frameView))
+        return;
+
+    ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree-&gt;stateNodeForID(frameView-&gt;scrollLayerID()));
+    if (!node)
+        return;
+
+    Scrollbar* verticalScrollbar = frameView-&gt;verticalScrollbar();
+    Scrollbar* horizontalScrollbar = frameView-&gt;horizontalScrollbar();
+    setScrollbarPaintersFromScrollbarsForNode(verticalScrollbar, horizontalScrollbar, node);
+
+    node-&gt;setFrameScaleFactor(frameView-&gt;frame().frameScaleFactor());
+    node-&gt;setHeaderHeight(frameView-&gt;headerHeight());
+    node-&gt;setFooterHeight(frameView-&gt;footerHeight());
+
+    node-&gt;setScrollOrigin(frameView-&gt;scrollOrigin());
+    node-&gt;setViewportRect(IntRect(IntPoint(), frameView-&gt;visibleContentRect().size()));
+    node-&gt;setTotalContentsSize(frameView-&gt;totalContentsSize());
+
+    ScrollableAreaParameters scrollParameters;
+    scrollParameters.horizontalScrollElasticity = frameView-&gt;horizontalScrollElasticity();
+    scrollParameters.verticalScrollElasticity = frameView-&gt;verticalScrollElasticity();
+    scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar &amp;&amp; horizontalScrollbar-&gt;enabled();
+    scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar &amp;&amp; verticalScrollbar-&gt;enabled();
+    scrollParameters.horizontalScrollbarMode = frameView-&gt;horizontalScrollbarMode();
+    scrollParameters.verticalScrollbarMode = frameView-&gt;verticalScrollbarMode();
+
+    node-&gt;setScrollableAreaParameters(scrollParameters);
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView)
+{
+    ASSERT(isMainThread());
+    ASSERT(m_page);
+
+    if (!coordinatesScrollingForFrameView(frameView))
+        return;
+
+    // If the root layer does not have a ScrollingStateNode, then we should create one.
+    ensureRootStateNodeForFrameView(frameView);
+    ASSERT(m_scrollingStateTree-&gt;rootStateNode());
+
+    ScrollingCoordinator::frameViewRootLayerDidChange(frameView);
+
+    ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree-&gt;stateNodeForID(frameView-&gt;scrollLayerID()));
+    setScrollLayerForNode(scrollLayerForFrameView(frameView), node);
+    setCounterScrollingLayerForNode(counterScrollingLayerForFrameView(frameView), node);
+    setHeaderLayerForNode(headerLayerForFrameView(frameView), node);
+    setFooterLayerForNode(footerLayerForFrameView(frameView), node);
+    setScrollBehaviorForFixedElementsForNode(frameView-&gt;scrollBehaviorForFixedElements(), node);
+}
+
+bool AsyncScrollingCoordinator::requestScrollPositionUpdate(FrameView* frameView, const IntPoint&amp; scrollPosition)
+{
+    ASSERT(isMainThread());
+    ASSERT(m_page);
+
+    if (!coordinatesScrollingForFrameView(frameView))
+        return false;
+
+    if (frameView-&gt;inProgrammaticScroll() || frameView-&gt;frame().document()-&gt;inPageCache())
+        updateMainFrameScrollPosition(scrollPosition, frameView-&gt;inProgrammaticScroll(), SetScrollingLayerPosition);
+
+    // If this frame view's document is being put into the page cache, we don't want to update our
+    // main frame scroll position. Just let the FrameView think that we did.
+    if (frameView-&gt;frame().document()-&gt;inPageCache())
+        return true;
+
+    ScrollingStateScrollingNode* stateNode = toScrollingStateScrollingNode(m_scrollingStateTree-&gt;stateNodeForID(frameView-&gt;scrollLayerID()));
+    if (!stateNode)
+        return false;
+
+    stateNode-&gt;setRequestedScrollPosition(scrollPosition, frameView-&gt;inProgrammaticScroll());
+    scheduleTreeStateCommit();
+    return true;
+}
+
+void AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea* scrollableArea, ScrollbarOrientation orientation)
+{
+    ASSERT(isMainThread());
+    ASSERT(m_page);
+
+    if (scrollableArea != static_cast&lt;ScrollableArea*&gt;(m_page-&gt;mainFrame().view()))
+        return;
+
+    if (orientation == VerticalScrollbar)
+        scrollableArea-&gt;verticalScrollbarLayerDidChange();
+    else
+        scrollableArea-&gt;horizontalScrollbarLayerDidChange();
+}
+
+ScrollingNodeID AsyncScrollingCoordinator::attachToStateTree(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID)
+{
+    return m_scrollingStateTree-&gt;attachNode(nodeType, newNodeID, parentID);
+}
+
+void AsyncScrollingCoordinator::detachFromStateTree(ScrollingNodeID nodeID)
+{
+    m_scrollingStateTree-&gt;detachNode(nodeID);
+}
+
+void AsyncScrollingCoordinator::clearStateTree()
+{
+    m_scrollingStateTree-&gt;clear();
+}
+
+void AsyncScrollingCoordinator::syncChildPositions(const LayoutRect&amp; viewportRect)
+{
+    if (!m_scrollingStateTree-&gt;rootStateNode())
+        return;
+
+    Vector&lt;OwnPtr&lt;ScrollingStateNode&gt;&gt;* children = m_scrollingStateTree-&gt;rootStateNode()-&gt;children();
+    if (!children)
+        return;
+
+    // FIXME: We'll have to traverse deeper into the tree at some point.
+    size_t size = children-&gt;size();
+    for (size_t i = 0; i &lt; size; ++i) {
+        ScrollingStateNode* child = children-&gt;at(i).get();
+        child-&gt;syncLayerPositionForViewportRect(viewportRect);
+    }
+}
+
+void AsyncScrollingCoordinator::ensureRootStateNodeForFrameView(FrameView* frameView)
+{
+    ASSERT(frameView-&gt;scrollLayerID());
+    attachToStateTree(ScrollingNode, frameView-&gt;scrollLayerID(), 0);
+}
+
+void AsyncScrollingCoordinator::updateScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* scrollLayer, GraphicsLayer* counterScrollingLayer)
+{
+    ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree-&gt;stateNodeForID(nodeID));
+    ASSERT(node);
+    if (!node)
+        return;
+
+    node-&gt;setScrollLayer(scrollLayer);
+    node-&gt;setCounterScrollingLayer(counterScrollingLayer);
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::updateViewportConstrainedNode(ScrollingNodeID nodeID, const ViewportConstraints&amp; constraints, GraphicsLayer* graphicsLayer)
+{
+    ASSERT(supportsFixedPositionLayers());
+
+    ScrollingStateNode* node = m_scrollingStateTree-&gt;stateNodeForID(nodeID);
+    if (!node)
+        return;
+
+    switch (constraints.constraintType()) {
+    case ViewportConstraints::FixedPositionConstraint: {
+        ScrollingStateFixedNode* fixedNode = toScrollingStateFixedNode(node);
+        setScrollLayerForNode(graphicsLayer, fixedNode);
+        fixedNode-&gt;updateConstraints((const FixedPositionViewportConstraints&amp;)constraints);
+        break;
+    }
+    case ViewportConstraints::StickyPositionConstraint: {
+        ScrollingStateStickyNode* stickyNode = toScrollingStateStickyNode(node);
+        setScrollLayerForNode(graphicsLayer, stickyNode);
+        stickyNode-&gt;updateConstraints((const StickyPositionViewportConstraints&amp;)constraints);
+        break;
+    }
+    }
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setScrollLayerForNode(GraphicsLayer* scrollLayer, ScrollingStateNode* node)
+{
+    node-&gt;setScrollLayer(scrollLayer);
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setCounterScrollingLayerForNode(GraphicsLayer* layer, ScrollingStateScrollingNode* node)
+{
+    node-&gt;setCounterScrollingLayer(layer);
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setHeaderLayerForNode(GraphicsLayer* headerLayer, ScrollingStateScrollingNode* node)
+{
+    // Headers and footers are only supported on the root node.
+    ASSERT(node == m_scrollingStateTree-&gt;rootStateNode());
+
+    node-&gt;setHeaderLayer(headerLayer);
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setFooterLayerForNode(GraphicsLayer* footerLayer, ScrollingStateScrollingNode* node)
+{
+    // Headers and footers are only supported on the root node.
+    ASSERT(node == m_scrollingStateTree-&gt;rootStateNode());
+
+    node-&gt;setFooterLayer(footerLayer);
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setNonFastScrollableRegionForNode(const Region&amp; region, ScrollingStateScrollingNode* node)
+{
+    node-&gt;setNonFastScrollableRegion(region);
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setWheelEventHandlerCountForNode(unsigned wheelEventHandlerCount, ScrollingStateScrollingNode* node)
+{
+    node-&gt;setWheelEventHandlerCount(wheelEventHandlerCount);
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements behaviorForFixed, ScrollingStateScrollingNode* node)
+{
+    node-&gt;setScrollBehaviorForFixedElements(behaviorForFixed);
+    scheduleTreeStateCommit();
+}
+
+// FIXME: not sure if this belongs here.
+void AsyncScrollingCoordinator::setScrollbarPaintersFromScrollbarsForNode(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar, ScrollingStateScrollingNode* node)
+{
+    node-&gt;setScrollbarPaintersFromScrollbars(verticalScrollbar, horizontalScrollbar);
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setSynchronousScrollingReasons(SynchronousScrollingReasons reasons)
+{
+    if (!m_scrollingStateTree-&gt;rootStateNode())
+        return;
+
+    // The FrameView's GraphicsLayer is likely to be out-of-synch with the PlatformLayer
+    // at this point. So we'll update it before we switch back to main thread scrolling
+    // in order to avoid layer positioning bugs.
+    if (reasons)
+        updateMainFrameScrollLayerPosition();
+    m_scrollingStateTree-&gt;rootStateNode()-&gt;setSynchronousScrollingReasons(reasons);
+    scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::updateMainFrameScrollLayerPosition()
+{
+    ASSERT(isMainThread());
+
+    if (!m_page)
+        return;
+
+    FrameView* frameView = m_page-&gt;mainFrame().view();
+    if (!frameView)
+        return;
+
+    if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView))
+        scrollLayer-&gt;setPosition(-frameView-&gt;scrollPosition());
+}
+
+void AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView* frameView)
+{
+    ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree-&gt;stateNodeForID(frameView-&gt;scrollLayerID()));
+    if (!node)
+        return;
+    setWheelEventHandlerCountForNode(computeCurrentWheelEventHandlerCount(), node);
+}
+
+bool AsyncScrollingCoordinator::isRubberBandInProgress() const
+{
+    return scrollingTree()-&gt;isRubberBandInProgress();
+}
+
+void AsyncScrollingCoordinator::setScrollPinningBehavior(ScrollPinningBehavior pinning)
+{
+    scrollingTree()-&gt;setScrollPinningBehavior(pinning);
+}
+
+String AsyncScrollingCoordinator::scrollingStateTreeAsText() const
+{
+    if (m_scrollingStateTree-&gt;rootStateNode())
+        return m_scrollingStateTree-&gt;rootStateNode()-&gt;scrollingStateTreeAsText();
+
+    return String();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(ASYNC_SCROLLING)
</ins></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorhfromrev161210trunkSourceWebCorepagescrollingmacScrollingCoordinatorMach"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (from rev 161210, trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h) (0 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h                                (rev 0)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -0,0 +1,116 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AsyncScrollingCoordinator_h
+#define AsyncScrollingCoordinator_h
+
+#if ENABLE(ASYNC_SCROLLING)
+
+#include &quot;ScrollingCoordinator.h&quot;
+
+#include &quot;ScrollingTree.h&quot;
+#include &lt;wtf/OwnPtr.h&gt;
+#include &lt;wtf/PassRefPtr.h&gt;
+#include &lt;wtf/RefPtr.h&gt;
+
+namespace WebCore {
+
+class Page;
+class Scrollbar;
+class ScrollingStateNode;
+class ScrollingStateScrollingNode;
+class ScrollingStateTree;
+
+// ScrollingCoordinator subclass that maintains a ScrollingStateTree and a ScrollingTree,
+// allowing asynchronous scrolling (in another thread or process).
+class AsyncScrollingCoordinator : public ScrollingCoordinator {
+public:
+    static PassRefPtr&lt;AsyncScrollingCoordinator&gt; create(Page*);
+    virtual ~AsyncScrollingCoordinator();
+
+    ScrollingTree* scrollingTree() const { return m_scrollingTree.get(); }
+
+protected:
+    AsyncScrollingCoordinator(Page*);
+
+    void setScrollingTree(PassRefPtr&lt;ScrollingTree&gt; scrollingTree) { m_scrollingTree = scrollingTree; }
+
+    ScrollingStateTree* scrollingStateTree() { return m_scrollingStateTree.get(); }
+
+    PassRefPtr&lt;ScrollingTree&gt; releaseScrollingTree() { return m_scrollingTree.release(); }
+
+private:
+    virtual bool isAsyncScrollingCoordinator() const OVERRIDE { return true; }
+
+    virtual bool supportsFixedPositionLayers() const OVERRIDE { return true; }
+    virtual bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const OVERRIDE { return false; }
+
+    virtual void frameViewLayoutUpdated(FrameView*) OVERRIDE;
+    virtual void frameViewRootLayerDidChange(FrameView*) OVERRIDE;
+
+    virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&amp;) OVERRIDE;
+
+    virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID) OVERRIDE;
+    virtual void detachFromStateTree(ScrollingNodeID) OVERRIDE;
+    virtual void clearStateTree() OVERRIDE;
+
+    virtual void updateViewportConstrainedNode(ScrollingNodeID, const ViewportConstraints&amp;, GraphicsLayer*) OVERRIDE;
+    virtual void updateScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* counterScrollingLayer) OVERRIDE;
+    virtual String scrollingStateTreeAsText() const OVERRIDE;
+    virtual bool isRubberBandInProgress() const OVERRIDE;
+    virtual void setScrollPinningBehavior(ScrollPinningBehavior) OVERRIDE;
+
+    virtual void syncChildPositions(const LayoutRect&amp; viewportRect) OVERRIDE;
+    virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea*, ScrollbarOrientation) OVERRIDE;
+
+    virtual void recomputeWheelEventHandlerCountForFrameView(FrameView*) OVERRIDE;
+    virtual void setSynchronousScrollingReasons(SynchronousScrollingReasons) OVERRIDE;
+
+    virtual void scheduleTreeStateCommit() = 0;
+
+    void ensureRootStateNodeForFrameView(FrameView*);
+    void updateMainFrameScrollLayerPosition();
+
+    void setScrollLayerForNode(GraphicsLayer*, ScrollingStateNode*);
+    void setCounterScrollingLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
+    void setHeaderLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
+    void setFooterLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
+    void setNonFastScrollableRegionForNode(const Region&amp;, ScrollingStateScrollingNode*);
+    void setWheelEventHandlerCountForNode(unsigned, ScrollingStateScrollingNode*);
+    void setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements, ScrollingStateScrollingNode*);
+    // FIXME: move somewhere else?
+    void setScrollbarPaintersFromScrollbarsForNode(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar, ScrollingStateScrollingNode*);
+
+    OwnPtr&lt;ScrollingStateTree&gt; m_scrollingStateTree;
+    RefPtr&lt;ScrollingTree&gt; m_scrollingTree;
+};
+
+SCROLLING_COORDINATOR_TYPE_CASTS(AsyncScrollingCoordinator, isAsyncScrollingCoordinator());
+
+} // namespace WebCore
+
+#endif // ENABLE(ASYNC_SCROLLING)
+
+#endif // AsyncScrollingCoordinator_h
</ins></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -106,11 +106,9 @@
</span><span class="cx">     virtual ~ScrollingCoordinator();
</span><span class="cx"> 
</span><span class="cx">     virtual void pageDestroyed();
</span><ins>+    
+    virtual bool isAsyncScrollingCoordinator() const { return false; }
</ins><span class="cx"> 
</span><del>-#if ENABLE(ASYNC_SCROLLING)
-    virtual ScrollingTree* scrollingTree() const { return 0; }
-#endif
-
</del><span class="cx">     // Return whether this scrolling coordinator handles scrolling for the given frame view.
</span><span class="cx">     bool coordinatesScrollingForFrameView(FrameView*) const;
</span><span class="cx"> 
</span><span class="lines">@@ -219,6 +217,9 @@
</span><span class="cx">     bool m_forceSynchronousScrollLayerPositionUpdates;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+#define SCROLLING_COORDINATOR_TYPE_CASTS(ToValueTypeName, predicate) \
+    TYPE_CASTS_BASE(ToValueTypeName, ScrollingCoordinator, value, value-&gt;predicate, value.predicate)
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ScrollingCoordinator_h
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingThreadedScrollingTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -47,6 +47,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual bool isThreadedScrollingTree() const { return true; }
</span><span class="cx"> 
</span><ins>+    virtual void commitNewTreeState(PassOwnPtr&lt;ScrollingStateTree&gt;) OVERRIDE;
+
</ins><span class="cx">     virtual void handleWheelEvent(const PlatformWheelEvent&amp;) OVERRIDE;
</span><span class="cx"> 
</span><span class="cx">     // Can be called from any thread. Will try to handle the wheel event on the scrolling thread.
</span><span class="lines">@@ -59,7 +61,6 @@
</span><span class="cx"> private:
</span><span class="cx">     explicit ThreadedScrollingTree(ScrollingCoordinator*);
</span><span class="cx"> 
</span><del>-    virtual void commitNewTreeState(PassOwnPtr&lt;ScrollingStateTree&gt;) OVERRIDE;
</del><span class="cx">     virtual void updateMainFrameScrollPosition(const IntPoint&amp; scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) OVERRIDE;
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     virtual void handleWheelEventPhase(PlatformWheelEventPhase) OVERRIDE;
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingCoordinatorMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><span class="cx"> 
</span><del>-#include &quot;ScrollingCoordinator.h&quot;
</del><ins>+#include &quot;AsyncScrollingCoordinator.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="lines">@@ -38,84 +38,26 @@
</span><span class="cx"> class ScrollingStateTree;
</span><span class="cx"> class ThreadedScrollingTree;
</span><span class="cx"> 
</span><del>-class ScrollingCoordinatorMac : public ScrollingCoordinator {
</del><ins>+class ScrollingCoordinatorMac : public AsyncScrollingCoordinator {
</ins><span class="cx"> public:
</span><span class="cx">     explicit ScrollingCoordinatorMac(Page*);
</span><span class="cx">     virtual ~ScrollingCoordinatorMac();
</span><span class="cx"> 
</span><span class="cx">     virtual void pageDestroyed();
</span><span class="cx"> 
</span><del>-    virtual ScrollingTree* scrollingTree() const;
-    virtual void commitTreeStateIfNeeded();
</del><ins>+    virtual void commitTreeStateIfNeeded() OVERRIDE;
</ins><span class="cx"> 
</span><del>-    // Should be called whenever the given frame view has been laid out.
-    virtual void frameViewLayoutUpdated(FrameView*);
-
-    // Should be called whenever the root layer for the given frame view changes.
-    virtual void frameViewRootLayerDidChange(FrameView*);
-
-    // Should be called whenever the scrollbar layer for the given scrollable area changes.
-    virtual void scrollableAreaScrollbarLayerDidChange(ScrollableArea*, ScrollbarOrientation);
-
-    // Requests that the scrolling coordinator updates the scroll position of the given frame view. If this function returns true, it means that the
-    // position will be updated asynchronously. If it returns false, the caller should update the scrolling position itself.
-    virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&amp;);
-
</del><span class="cx">     // Handle the wheel event on the scrolling thread. Returns whether the event was handled or not.
</span><del>-    virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&amp;);
</del><ins>+    virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&amp;) OVERRIDE;
</ins><span class="cx"> 
</span><del>-    // These functions are used to indicate that a layer should be (or should not longer be) represented by a node
-    // in the scrolling tree.
-    virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID);
-    virtual void detachFromStateTree(ScrollingNodeID);
-
-    // This function wipes out the current tree.
-    virtual void clearStateTree();
-
-    virtual String scrollingStateTreeAsText() const OVERRIDE;
-
-    virtual bool isRubberBandInProgress() const OVERRIDE;
-    
-    virtual void setScrollPinningBehavior(ScrollPinningBehavior) OVERRIDE;
-
</del><span class="cx"> private:
</span><del>-    // Return whether this scrolling coordinator can keep fixed position layers fixed to their
-    // containers while scrolling.
-    virtual bool supportsFixedPositionLayers() const OVERRIDE { return true; }
</del><ins>+    virtual void scheduleTreeStateCommit() OVERRIDE;
</ins><span class="cx"> 
</span><del>-    // This function will update the ScrollingStateNode for the given viewport constrained object.
-    virtual void updateViewportConstrainedNode(ScrollingNodeID, const ViewportConstraints&amp;, GraphicsLayer*) OVERRIDE;
-
-    virtual void updateScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* counterScrollingLayer) OVERRIDE;
-
-    // Called to synch the GraphicsLayer positions for child layers when their CALayers have been moved by the scrolling thread.
-    virtual void syncChildPositions(const LayoutRect&amp; viewportRect) OVERRIDE;
-
-    virtual void recomputeWheelEventHandlerCountForFrameView(FrameView*);
-    virtual void setSynchronousScrollingReasons(SynchronousScrollingReasons);
-
-    virtual bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const { return false; }
-
-    void ensureRootStateNodeForFrameView(FrameView*);
-
-    void setScrollLayerForNode(GraphicsLayer*, ScrollingStateNode*);
-    void setCounterScrollingLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
-    void setHeaderLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
-    void setFooterLayerForNode(GraphicsLayer*, ScrollingStateScrollingNode*);
-    void setScrollbarPaintersFromScrollbarsForNode(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar, ScrollingStateScrollingNode*);
-    void setNonFastScrollableRegionForNode(const Region&amp;, ScrollingStateScrollingNode*);
-    void setWheelEventHandlerCountForNode(unsigned, ScrollingStateScrollingNode*);
-    void setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements, ScrollingStateScrollingNode*);
-
-    void updateMainFrameScrollLayerPosition();
-
-    void scheduleTreeStateCommit();
-
</del><span class="cx">     void scrollingStateTreeCommitterTimerFired(Timer&lt;ScrollingCoordinatorMac&gt;*);
</span><span class="cx">     void commitTreeState();
</span><ins>+    
+    void updateTiledScrollingIndicator();
</ins><span class="cx"> 
</span><del>-    OwnPtr&lt;ScrollingStateTree&gt; m_scrollingStateTree;
-    RefPtr&lt;ThreadedScrollingTree&gt; m_scrollingTree;
</del><span class="cx">     Timer&lt;ScrollingCoordinatorMac&gt; m_scrollingStateTreeCommitterTimer;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingCoordinatorMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -29,21 +29,11 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;ScrollingCoordinatorMac.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;GraphicsLayer.h&quot;
</del><span class="cx"> #include &quot;FrameView.h&quot;
</span><del>-#include &quot;IntRect.h&quot;
</del><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;PlatformWheelEvent.h&quot;
</span><del>-#include &quot;PluginViewBase.h&quot;
</del><span class="cx"> #include &quot;Region.h&quot;
</span><del>-#include &quot;RenderLayerCompositor.h&quot;
-#include &quot;RenderView.h&quot;
-#include &quot;ScrollAnimator.h&quot;
-#include &quot;ScrollingConstraints.h&quot;
-#include &quot;ScrollingStateFixedNode.h&quot;
-#include &quot;ScrollingStateScrollingNode.h&quot;
-#include &quot;ScrollingStateStickyNode.h&quot;
</del><span class="cx"> #include &quot;ScrollingStateTree.h&quot;
</span><span class="cx"> #include &quot;ScrollingThread.h&quot;
</span><span class="cx"> #include &quot;ThreadedScrollingTree.h&quot;
</span><span class="lines">@@ -52,354 +42,58 @@
</span><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-class ScrollingCoordinatorPrivate {
-};
-
</del><span class="cx"> ScrollingCoordinatorMac::ScrollingCoordinatorMac(Page* page)
</span><del>-    : ScrollingCoordinator(page)
-    , m_scrollingStateTree(ScrollingStateTree::create())
-    , m_scrollingTree(ThreadedScrollingTree::create(this))
</del><ins>+    : AsyncScrollingCoordinator(page)
</ins><span class="cx">     , m_scrollingStateTreeCommitterTimer(this, &amp;ScrollingCoordinatorMac::scrollingStateTreeCommitterTimerFired)
</span><span class="cx"> {
</span><ins>+    setScrollingTree(ThreadedScrollingTree::create(this));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> ScrollingCoordinatorMac::~ScrollingCoordinatorMac()
</span><span class="cx"> {
</span><del>-    ASSERT(!m_scrollingTree);
</del><ins>+    ASSERT(!scrollingTree());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollingCoordinatorMac::pageDestroyed()
</span><span class="cx"> {
</span><del>-    ScrollingCoordinator::pageDestroyed();
</del><ins>+    AsyncScrollingCoordinator::pageDestroyed();
</ins><span class="cx"> 
</span><span class="cx">     m_scrollingStateTreeCommitterTimer.stop();
</span><span class="cx"> 
</span><span class="cx">     // Invalidating the scrolling tree will break the reference cycle between the ScrollingCoordinator and ScrollingTree objects.
</span><del>-    ScrollingThread::dispatch(bind(&amp;ScrollingTree::invalidate, m_scrollingTree.release()));
</del><ins>+    RefPtr&lt;ThreadedScrollingTree&gt; scrollingTree = static_pointer_cast&lt;ThreadedScrollingTree&gt;(releaseScrollingTree());
+    ScrollingThread::dispatch(bind(&amp;ThreadedScrollingTree::invalidate, scrollingTree));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ScrollingTree* ScrollingCoordinatorMac::scrollingTree() const
-{
-    ASSERT(m_scrollingTree);
-    return m_scrollingTree.get();
-}
-
-bool ScrollingCoordinatorMac::isRubberBandInProgress() const
-{
-    return scrollingTree()-&gt;isRubberBandInProgress();
-}
-
-void ScrollingCoordinatorMac::setScrollPinningBehavior(ScrollPinningBehavior pinning)
-{
-    scrollingTree()-&gt;setScrollPinningBehavior(pinning);
-}
-
</del><span class="cx"> void ScrollingCoordinatorMac::commitTreeStateIfNeeded()
</span><span class="cx"> {
</span><del>-    if (!m_scrollingStateTree-&gt;hasChangedProperties())
</del><ins>+    if (!scrollingStateTree()-&gt;hasChangedProperties())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     commitTreeState();
</span><span class="cx">     m_scrollingStateTreeCommitterTimer.stop();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScrollingCoordinatorMac::frameViewLayoutUpdated(FrameView* frameView)
-{
-    ASSERT(isMainThread());
-    ASSERT(m_page);
-
-    // If there isn't a root node yet, don't do anything. We'll be called again after creating one.
-    if (!m_scrollingStateTree-&gt;rootStateNode())
-        return;
-
-    // Compute the region of the page that we can't do fast scrolling for. This currently includes
-    // all scrollable areas, such as subframes, overflow divs and list boxes. We need to do this even if the
-    // frame view whose layout was updated is not the main frame.
-    Region nonFastScrollableRegion = computeNonFastScrollableRegion(&amp;m_page-&gt;mainFrame(), IntPoint());
-
-    // In the future, we may want to have the ability to set non-fast scrolling regions for more than
-    // just the root node. But right now, this concept only applies to the root.
-    setNonFastScrollableRegionForNode(nonFastScrollableRegion, m_scrollingStateTree-&gt;rootStateNode());
-
-    if (!coordinatesScrollingForFrameView(frameView))
-        return;
-
-    ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree-&gt;stateNodeForID(frameView-&gt;scrollLayerID()));
-    if (!node)
-        return;
-
-    Scrollbar* verticalScrollbar = frameView-&gt;verticalScrollbar();
-    Scrollbar* horizontalScrollbar = frameView-&gt;horizontalScrollbar();
-    setScrollbarPaintersFromScrollbarsForNode(verticalScrollbar, horizontalScrollbar, node);
-
-    node-&gt;setFrameScaleFactor(frameView-&gt;frame().frameScaleFactor());
-    node-&gt;setHeaderHeight(frameView-&gt;headerHeight());
-    node-&gt;setFooterHeight(frameView-&gt;footerHeight());
-
-    node-&gt;setScrollOrigin(frameView-&gt;scrollOrigin());
-    node-&gt;setViewportRect(IntRect(IntPoint(), frameView-&gt;visibleContentRect().size()));
-    node-&gt;setTotalContentsSize(frameView-&gt;totalContentsSize());
-
-    ScrollableAreaParameters scrollParameters;
-    scrollParameters.horizontalScrollElasticity = frameView-&gt;horizontalScrollElasticity();
-    scrollParameters.verticalScrollElasticity = frameView-&gt;verticalScrollElasticity();
-    scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar &amp;&amp; horizontalScrollbar-&gt;enabled();
-    scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar &amp;&amp; verticalScrollbar-&gt;enabled();
-    scrollParameters.horizontalScrollbarMode = frameView-&gt;horizontalScrollbarMode();
-    scrollParameters.verticalScrollbarMode = frameView-&gt;verticalScrollbarMode();
-
-    node-&gt;setScrollableAreaParameters(scrollParameters);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::recomputeWheelEventHandlerCountForFrameView(FrameView* frameView)
-{
-    ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree-&gt;stateNodeForID(frameView-&gt;scrollLayerID()));
-    if (!node)
-        return;
-    setWheelEventHandlerCountForNode(computeCurrentWheelEventHandlerCount(), node);
-}
-
-void ScrollingCoordinatorMac::frameViewRootLayerDidChange(FrameView* frameView)
-{
-    ASSERT(isMainThread());
-    ASSERT(m_page);
-
-    if (!coordinatesScrollingForFrameView(frameView))
-        return;
-
-    // If the root layer does not have a ScrollingStateNode, then we should create one.
-    ensureRootStateNodeForFrameView(frameView);
-    ASSERT(m_scrollingStateTree-&gt;rootStateNode());
-
-    ScrollingCoordinator::frameViewRootLayerDidChange(frameView);
-
-    ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree-&gt;stateNodeForID(frameView-&gt;scrollLayerID()));
-    setScrollLayerForNode(scrollLayerForFrameView(frameView), node);
-    setCounterScrollingLayerForNode(counterScrollingLayerForFrameView(frameView), node);
-    setHeaderLayerForNode(headerLayerForFrameView(frameView), node);
-    setFooterLayerForNode(footerLayerForFrameView(frameView), node);
-    setScrollBehaviorForFixedElementsForNode(frameView-&gt;scrollBehaviorForFixedElements(), node);
-}
-
-void ScrollingCoordinatorMac::scrollableAreaScrollbarLayerDidChange(ScrollableArea* scrollableArea, ScrollbarOrientation orientation)
-{
-    ASSERT(isMainThread());
-    ASSERT(m_page);
-
-    if (scrollableArea != static_cast&lt;ScrollableArea*&gt;(m_page-&gt;mainFrame().view()))
-        return;
-
-    if (orientation == VerticalScrollbar)
-        scrollableArea-&gt;verticalScrollbarLayerDidChange();
-    else
-        scrollableArea-&gt;horizontalScrollbarLayerDidChange();
-}
-
-bool ScrollingCoordinatorMac::requestScrollPositionUpdate(FrameView* frameView, const IntPoint&amp; scrollPosition)
-{
-    ASSERT(isMainThread());
-    ASSERT(m_page);
-
-    if (!coordinatesScrollingForFrameView(frameView))
-        return false;
-
-    if (frameView-&gt;inProgrammaticScroll() || frameView-&gt;frame().document()-&gt;inPageCache())
-        updateMainFrameScrollPosition(scrollPosition, frameView-&gt;inProgrammaticScroll(), SetScrollingLayerPosition);
-
-    // If this frame view's document is being put into the page cache, we don't want to update our
-    // main frame scroll position. Just let the FrameView think that we did.
-    if (frameView-&gt;frame().document()-&gt;inPageCache())
-        return true;
-
-    ScrollingStateScrollingNode* stateNode = toScrollingStateScrollingNode(m_scrollingStateTree-&gt;stateNodeForID(frameView-&gt;scrollLayerID()));
-    if (!stateNode)
-        return false;
-
-    stateNode-&gt;setRequestedScrollPosition(scrollPosition, frameView-&gt;inProgrammaticScroll());
-    scheduleTreeStateCommit();
-    return true;
-}
-
</del><span class="cx"> bool ScrollingCoordinatorMac::handleWheelEvent(FrameView*, const PlatformWheelEvent&amp; wheelEvent)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     ASSERT(m_page);
</span><span class="cx"> 
</span><del>-    if (m_scrollingTree-&gt;willWheelEventStartSwipeGesture(wheelEvent))
</del><ins>+    if (scrollingTree()-&gt;willWheelEventStartSwipeGesture(wheelEvent))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><del>-    ScrollingThread::dispatch(bind(&amp;ThreadedScrollingTree::handleWheelEvent, m_scrollingTree.get(), wheelEvent));
</del><ins>+    ScrollingThread::dispatch(bind(&amp;ThreadedScrollingTree::handleWheelEvent, toThreadedScrollingTree(scrollingTree()), wheelEvent));
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-ScrollingNodeID ScrollingCoordinatorMac::attachToStateTree(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID)
-{
-    return m_scrollingStateTree-&gt;attachNode(nodeType, newNodeID, parentID);
-}
-
-void ScrollingCoordinatorMac::detachFromStateTree(ScrollingNodeID nodeID)
-{
-    m_scrollingStateTree-&gt;detachNode(nodeID);
-}
-
-void ScrollingCoordinatorMac::clearStateTree()
-{
-    m_scrollingStateTree-&gt;clear();
-}
-
-void ScrollingCoordinatorMac::ensureRootStateNodeForFrameView(FrameView* frameView)
-{
-    ASSERT(frameView-&gt;scrollLayerID());
-    attachToStateTree(ScrollingNode, frameView-&gt;scrollLayerID(), 0);
-}
-
-void ScrollingCoordinatorMac::setScrollLayerForNode(GraphicsLayer* scrollLayer, ScrollingStateNode* node)
-{
-    node-&gt;setScrollLayer(scrollLayer);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setCounterScrollingLayerForNode(GraphicsLayer* layer, ScrollingStateScrollingNode* node)
-{
-    node-&gt;setCounterScrollingLayer(layer);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setHeaderLayerForNode(GraphicsLayer* headerLayer, ScrollingStateScrollingNode* node)
-{
-    // Headers and footers are only supported on the root node.
-    ASSERT(node == m_scrollingStateTree-&gt;rootStateNode());
-
-    node-&gt;setHeaderLayer(headerLayer);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setFooterLayerForNode(GraphicsLayer* footerLayer, ScrollingStateScrollingNode* node)
-{
-    // Headers and footers are only supported on the root node.
-    ASSERT(node == m_scrollingStateTree-&gt;rootStateNode());
-
-    node-&gt;setFooterLayer(footerLayer);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setScrollbarPaintersFromScrollbarsForNode(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar, ScrollingStateScrollingNode* node)
-{
-    node-&gt;setScrollbarPaintersFromScrollbars(verticalScrollbar, horizontalScrollbar);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setNonFastScrollableRegionForNode(const Region&amp; region, ScrollingStateScrollingNode* node)
-{
-    node-&gt;setNonFastScrollableRegion(region);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setWheelEventHandlerCountForNode(unsigned wheelEventHandlerCount, ScrollingStateScrollingNode* node)
-{
-    node-&gt;setWheelEventHandlerCount(wheelEventHandlerCount);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements behaviorForFixed, ScrollingStateScrollingNode* node)
-{
-    node-&gt;setScrollBehaviorForFixedElements(behaviorForFixed);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setSynchronousScrollingReasons(SynchronousScrollingReasons reasons)
-{
-    if (!m_scrollingStateTree-&gt;rootStateNode())
-        return;
-
-    // The FrameView's GraphicsLayer is likely to be out-of-synch with the PlatformLayer
-    // at this point. So we'll update it before we switch back to main thread scrolling
-    // in order to avoid layer positioning bugs.
-    if (reasons)
-        updateMainFrameScrollLayerPosition();
-    m_scrollingStateTree-&gt;rootStateNode()-&gt;setSynchronousScrollingReasons(reasons);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::updateMainFrameScrollLayerPosition()
-{
-    ASSERT(isMainThread());
-
-    if (!m_page)
-        return;
-
-    FrameView* frameView = m_page-&gt;mainFrame().view();
-    if (!frameView)
-        return;
-
-    if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView))
-        scrollLayer-&gt;setPosition(-frameView-&gt;scrollPosition());
-}
-
-void ScrollingCoordinatorMac::syncChildPositions(const LayoutRect&amp; viewportRect)
-{
-    if (!m_scrollingStateTree-&gt;rootStateNode())
-        return;
-
-    Vector&lt;OwnPtr&lt;ScrollingStateNode&gt;&gt;* children = m_scrollingStateTree-&gt;rootStateNode()-&gt;children();
-    if (!children)
-        return;
-
-    // FIXME: We'll have to traverse deeper into the tree at some point.
-    size_t size = children-&gt;size();
-    for (size_t i = 0; i &lt; size; ++i) {
-        ScrollingStateNode* child = children-&gt;at(i).get();
-        child-&gt;syncLayerPositionForViewportRect(viewportRect);
-    }
-}
-
-void ScrollingCoordinatorMac::updateScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* scrollLayer, GraphicsLayer* counterScrollingLayer)
-{
-    ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree-&gt;stateNodeForID(nodeID));
-    ASSERT(node);
-    if (!node)
-        return;
-
-    node-&gt;setScrollLayer(scrollLayer);
-    node-&gt;setCounterScrollingLayer(counterScrollingLayer);
-    scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::updateViewportConstrainedNode(ScrollingNodeID nodeID, const ViewportConstraints&amp; constraints, GraphicsLayer* graphicsLayer)
-{
-    ASSERT(supportsFixedPositionLayers());
-
-    ScrollingStateNode* node = m_scrollingStateTree-&gt;stateNodeForID(nodeID);
-    if (!node)
-        return;
-
-    switch (constraints.constraintType()) {
-    case ViewportConstraints::FixedPositionConstraint: {
-        ScrollingStateFixedNode* fixedNode = toScrollingStateFixedNode(node);
-        setScrollLayerForNode(graphicsLayer, fixedNode);
-        fixedNode-&gt;updateConstraints((const FixedPositionViewportConstraints&amp;)constraints);
-        break;
-    }
-    case ViewportConstraints::StickyPositionConstraint: {
-        ScrollingStateStickyNode* stickyNode = toScrollingStateStickyNode(node);
-        setScrollLayerForNode(graphicsLayer, stickyNode);
-        stickyNode-&gt;updateConstraints((const StickyPositionViewportConstraints&amp;)constraints);
-        break;
-    }
-    }
-    scheduleTreeStateCommit();
-}
-
</del><span class="cx"> void ScrollingCoordinatorMac::scheduleTreeStateCommit()
</span><span class="cx"> {
</span><span class="cx">     if (m_scrollingStateTreeCommitterTimer.isActive())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (!m_scrollingStateTree-&gt;hasChangedProperties())
</del><ins>+    if (!scrollingStateTree()-&gt;hasChangedProperties())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     m_scrollingStateTreeCommitterTimer.startOneShot(0);
</span><span class="lines">@@ -412,11 +106,16 @@
</span><span class="cx"> 
</span><span class="cx"> void ScrollingCoordinatorMac::commitTreeState()
</span><span class="cx"> {
</span><del>-    ASSERT(m_scrollingStateTree-&gt;hasChangedProperties());
</del><ins>+    ASSERT(scrollingStateTree()-&gt;hasChangedProperties());
</ins><span class="cx"> 
</span><del>-    OwnPtr&lt;ScrollingStateTree&gt; treeState = m_scrollingStateTree-&gt;commit();
-    ScrollingThread::dispatch(bind(&amp;ScrollingTree::commitNewTreeState, m_scrollingTree.get(), treeState.release()));
</del><ins>+    OwnPtr&lt;ScrollingStateTree&gt; treeState = scrollingStateTree()-&gt;commit();
+    ScrollingThread::dispatch(bind(&amp;ThreadedScrollingTree::commitNewTreeState, toThreadedScrollingTree(scrollingTree()), treeState.release()));
</ins><span class="cx"> 
</span><ins>+    updateTiledScrollingIndicator();
+}
+
+void ScrollingCoordinatorMac::updateTiledScrollingIndicator()
+{
</ins><span class="cx">     FrameView* frameView = m_page-&gt;mainFrame().view();
</span><span class="cx">     if (!frameView)
</span><span class="cx">         return;
</span><span class="lines">@@ -428,7 +127,7 @@
</span><span class="cx">     ScrollingModeIndication indicatorMode;
</span><span class="cx">     if (shouldUpdateScrollLayerPositionSynchronously())
</span><span class="cx">         indicatorMode = SynchronousScrollingBecauseOfStyleIndication;
</span><del>-    else if (m_scrollingStateTree-&gt;rootStateNode() &amp;&amp; m_scrollingStateTree-&gt;rootStateNode()-&gt;wheelEventHandlerCount())
</del><ins>+    else if (scrollingStateTree()-&gt;rootStateNode() &amp;&amp; scrollingStateTree()-&gt;rootStateNode()-&gt;wheelEventHandlerCount())
</ins><span class="cx">         indicatorMode =  SynchronousScrollingBecauseOfEventHandlersIndication;
</span><span class="cx">     else
</span><span class="cx">         indicatorMode = AsyncScrollingIndication;
</span><span class="lines">@@ -436,14 +135,6 @@
</span><span class="cx">     tiledBacking-&gt;setScrollingModeIndication(indicatorMode);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-String ScrollingCoordinatorMac::scrollingStateTreeAsText() const
-{
-    if (m_scrollingStateTree-&gt;rootStateNode())
-        return m_scrollingStateTree-&gt;rootStateNode()-&gt;scrollingStateTreeAsText();
-
-    return String();
-}
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(ASYNC_SCROLLING)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebKit2/ChangeLog        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-01-02  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Add AsyncScrollingCoordinator, which is a base class for threaded and future remote ScrollingCoordinators
+        https://bugs.webkit.org/show_bug.cgi?id=126389
+
+        Reviewed by Tim Horton.
+        
+        Add AsyncScrollingCoordinator, a ScrollingCoordinator that knows about ScrollingStateTrees
+        and ScrollingTrees, but leaves it up to subclasses to decide when and how to commit.
+        
+        * WebProcess/WebPage/EventDispatcher.cpp:
+        (WebKit::EventDispatcher::addScrollingTreeForPage): The ScrollingTree is exposed on
+        AsyncScrollingCoordinator now, not ScrollingCoordinator, so we have to cast here.
+        * WebProcess/WebPage/WebPage.cpp: m_useThreadedScrolling -&gt; m_useAsyncScrolling terminology change.
+        (WebKit::WebPage::WebPage):
+        (WebKit::WebPage::~WebPage):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::updatePreferences): Cast to AsyncScrollingCoordinator in order
+        to get to the ScrollingTree.
+
</ins><span class="cx"> 2014-01-01  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Create a ThreadedScrollingTree subclass of ScrollingTree, and push all knowledge of the scrolling thread into it
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageEventDispatchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebKit2/WebProcess/WebPage/EventDispatcher.cpp        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> #include &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><del>-#include &lt;WebCore/ScrollingCoordinator.h&gt;
</del><ins>+#include &lt;WebCore/AsyncScrollingCoordinator.h&gt;
</ins><span class="cx"> #include &lt;WebCore/ScrollingThread.h&gt;
</span><span class="cx"> #include &lt;WebCore/ThreadedScrollingTree.h&gt;
</span><span class="cx"> #endif
</span><span class="lines">@@ -67,7 +67,9 @@
</span><span class="cx"> 
</span><span class="cx">     ASSERT(webPage-&gt;corePage()-&gt;scrollingCoordinator());
</span><span class="cx">     ASSERT(!m_scrollingTrees.contains(webPage-&gt;pageID()));
</span><del>-    m_scrollingTrees.set(webPage-&gt;pageID(), toThreadedScrollingTree(webPage-&gt;corePage()-&gt;scrollingCoordinator()-&gt;scrollingTree()));
</del><ins>+
+    AsyncScrollingCoordinator* scrollingCoordinator = toAsyncScrollingCoordinator(webPage-&gt;corePage()-&gt;scrollingCoordinator());
+    m_scrollingTrees.set(webPage-&gt;pageID(), toThreadedScrollingTree(scrollingCoordinator-&gt;scrollingTree()));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void EventDispatcher::removeScrollingTreeForPage(WebPage* webPage)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -281,7 +281,7 @@
</span><span class="cx">     , m_backgroundColor(Color::white)
</span><span class="cx">     , m_maximumRenderingSuppressionToken(0)
</span><span class="cx">     , m_scrollPinningBehavior(DoNotPin)
</span><del>-    , m_useThreadedScrolling(false)
</del><ins>+    , m_useAsyncScrolling(false)
</ins><span class="cx">     , m_viewState(parameters.viewState)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(m_pageID);
</span><span class="lines">@@ -315,10 +315,10 @@
</span><span class="cx">     m_drawingArea-&gt;setPaintingEnabled(false);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><del>-    m_useThreadedScrolling = parameters.store.getBoolValueForKey(WebPreferencesKey::threadedScrollingEnabledKey());
</del><ins>+    m_useAsyncScrolling = parameters.store.getBoolValueForKey(WebPreferencesKey::threadedScrollingEnabledKey());
</ins><span class="cx">     if (!m_drawingArea-&gt;supportsThreadedScrolling())
</span><del>-        m_useThreadedScrolling = false;
-    m_page-&gt;settings().setScrollingCoordinatorEnabled(m_useThreadedScrolling);
</del><ins>+        m_useAsyncScrolling = false;
+    m_page-&gt;settings().setScrollingCoordinatorEnabled(m_useAsyncScrolling);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     m_mainFrame = WebFrame::createWithCoreMainFrame(this, &amp;m_page-&gt;mainFrame());
</span><span class="lines">@@ -421,7 +421,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><del>-    if (m_useThreadedScrolling)
</del><ins>+    if (m_useAsyncScrolling)
</ins><span class="cx">         WebProcess::shared().eventDispatcher().addScrollingTreeForPage(this);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -436,7 +436,7 @@
</span><span class="cx">     ASSERT(!m_page);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><del>-    if (m_useThreadedScrolling)
</del><ins>+    if (m_useAsyncScrolling)
</ins><span class="cx">         WebProcess::shared().eventDispatcher().removeScrollingTreeForPage(this);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -1047,7 +1047,7 @@
</span><span class="cx">     
</span><span class="cx">     WebCore::ScrollPinningBehavior m_scrollPinningBehavior;
</span><span class="cx"> 
</span><del>-    bool m_useThreadedScrolling;
</del><ins>+    bool m_useAsyncScrolling;
</ins><span class="cx"> 
</span><span class="cx">     ViewState::Flags m_viewState;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (161211 => 161212)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm        2014-01-02 19:20:52 UTC (rev 161211)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm        2014-01-02 19:41:45 UTC (rev 161212)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> #import &lt;wtf/MainThread.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><del>-#import &lt;WebCore/ScrollingCoordinator.h&gt;
</del><ins>+#import &lt;WebCore/AsyncScrollingCoordinator.h&gt;
</ins><span class="cx"> #import &lt;WebCore/ScrollingThread.h&gt;
</span><span class="cx"> #import &lt;WebCore/ScrollingTree.h&gt;
</span><span class="cx"> #endif
</span><span class="lines">@@ -243,7 +243,7 @@
</span><span class="cx">     Settings&amp; settings = m_webPage-&gt;corePage()-&gt;settings();
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><del>-    if (ScrollingCoordinator* scrollingCoordinator = m_webPage-&gt;corePage()-&gt;scrollingCoordinator()) {
</del><ins>+    if (AsyncScrollingCoordinator* scrollingCoordinator = toAsyncScrollingCoordinator(m_webPage-&gt;corePage()-&gt;scrollingCoordinator())) {
</ins><span class="cx">         bool scrollingPerformanceLoggingEnabled = m_webPage-&gt;scrollingPerformanceLoggingEnabled();
</span><span class="cx">         ScrollingThread::dispatch(bind(&amp;ScrollingTree::setScrollingPerformanceLoggingEnabled, scrollingCoordinator-&gt;scrollingTree(), scrollingPerformanceLoggingEnabled));
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>