<!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 -> 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 <simon.fraser@apple.com>
+
+ 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 <akling@apple.com>
</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 = "<group>"; };
</span><span class="cx">                 0FF5026F102BA96A0066F39A /* StyleMedia.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StyleMedia.h; sourceTree = "<group>"; };
</span><span class="cx">                 0FF50270102BA96A0066F39A /* StyleMedia.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = StyleMedia.idl; sourceTree = "<group>"; };
</span><ins>+                0FFD4D5E18651FA300512F6E /* AsyncScrollingCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AsyncScrollingCoordinator.cpp; sourceTree = "<group>"; };
+                0FFD4D5F18651FA300512F6E /* AsyncScrollingCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncScrollingCoordinator.h; sourceTree = "<group>"; };
</ins><span class="cx">                 10FB084A14E15C7E00A3DB98 /* PublicURLManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PublicURLManager.h; sourceTree = "<group>"; };
</span><span class="cx">                 1400D7A717136EA70077CE05 /* ScriptWrappableInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptWrappableInlines.h; sourceTree = "<group>"; };
</span><span class="cx">                 1402645D0AFDC19B005919E2 /* LoggingMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = LoggingMac.mm; sourceTree = "<group>"; };
</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 "config.h"
+
+#if ENABLE(ASYNC_SCROLLING)
+#include "AsyncScrollingCoordinator.h"
+
+#include "Frame.h"
+#include "FrameView.h"
+#include "GraphicsLayer.h"
+#include "MainFrame.h"
+#include "Page.h"
+#include "ScrollingConstraints.h"
+#include "ScrollingStateFixedNode.h"
+#include "ScrollingStateScrollingNode.h"
+#include "ScrollingStateStickyNode.h"
+#include "ScrollingStateTree.h"
+
+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->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(&m_page->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->rootStateNode());
+
+ if (!coordinatesScrollingForFrameView(frameView))
+ return;
+
+ ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
+ if (!node)
+ return;
+
+ Scrollbar* verticalScrollbar = frameView->verticalScrollbar();
+ Scrollbar* horizontalScrollbar = frameView->horizontalScrollbar();
+ setScrollbarPaintersFromScrollbarsForNode(verticalScrollbar, horizontalScrollbar, node);
+
+ node->setFrameScaleFactor(frameView->frame().frameScaleFactor());
+ node->setHeaderHeight(frameView->headerHeight());
+ node->setFooterHeight(frameView->footerHeight());
+
+ node->setScrollOrigin(frameView->scrollOrigin());
+ node->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size()));
+ node->setTotalContentsSize(frameView->totalContentsSize());
+
+ ScrollableAreaParameters scrollParameters;
+ scrollParameters.horizontalScrollElasticity = frameView->horizontalScrollElasticity();
+ scrollParameters.verticalScrollElasticity = frameView->verticalScrollElasticity();
+ scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar && horizontalScrollbar->enabled();
+ scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar && verticalScrollbar->enabled();
+ scrollParameters.horizontalScrollbarMode = frameView->horizontalScrollbarMode();
+ scrollParameters.verticalScrollbarMode = frameView->verticalScrollbarMode();
+
+ node->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->rootStateNode());
+
+ ScrollingCoordinator::frameViewRootLayerDidChange(frameView);
+
+ ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
+ setScrollLayerForNode(scrollLayerForFrameView(frameView), node);
+ setCounterScrollingLayerForNode(counterScrollingLayerForFrameView(frameView), node);
+ setHeaderLayerForNode(headerLayerForFrameView(frameView), node);
+ setFooterLayerForNode(footerLayerForFrameView(frameView), node);
+ setScrollBehaviorForFixedElementsForNode(frameView->scrollBehaviorForFixedElements(), node);
+}
+
+bool AsyncScrollingCoordinator::requestScrollPositionUpdate(FrameView* frameView, const IntPoint& scrollPosition)
+{
+ ASSERT(isMainThread());
+ ASSERT(m_page);
+
+ if (!coordinatesScrollingForFrameView(frameView))
+ return false;
+
+ if (frameView->inProgrammaticScroll() || frameView->frame().document()->inPageCache())
+ updateMainFrameScrollPosition(scrollPosition, frameView->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->frame().document()->inPageCache())
+ return true;
+
+ ScrollingStateScrollingNode* stateNode = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
+ if (!stateNode)
+ return false;
+
+ stateNode->setRequestedScrollPosition(scrollPosition, frameView->inProgrammaticScroll());
+ scheduleTreeStateCommit();
+ return true;
+}
+
+void AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea* scrollableArea, ScrollbarOrientation orientation)
+{
+ ASSERT(isMainThread());
+ ASSERT(m_page);
+
+ if (scrollableArea != static_cast<ScrollableArea*>(m_page->mainFrame().view()))
+ return;
+
+ if (orientation == VerticalScrollbar)
+ scrollableArea->verticalScrollbarLayerDidChange();
+ else
+ scrollableArea->horizontalScrollbarLayerDidChange();
+}
+
+ScrollingNodeID AsyncScrollingCoordinator::attachToStateTree(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID)
+{
+ return m_scrollingStateTree->attachNode(nodeType, newNodeID, parentID);
+}
+
+void AsyncScrollingCoordinator::detachFromStateTree(ScrollingNodeID nodeID)
+{
+ m_scrollingStateTree->detachNode(nodeID);
+}
+
+void AsyncScrollingCoordinator::clearStateTree()
+{
+ m_scrollingStateTree->clear();
+}
+
+void AsyncScrollingCoordinator::syncChildPositions(const LayoutRect& viewportRect)
+{
+ if (!m_scrollingStateTree->rootStateNode())
+ return;
+
+ Vector<OwnPtr<ScrollingStateNode>>* children = m_scrollingStateTree->rootStateNode()->children();
+ if (!children)
+ return;
+
+ // FIXME: We'll have to traverse deeper into the tree at some point.
+ size_t size = children->size();
+ for (size_t i = 0; i < size; ++i) {
+ ScrollingStateNode* child = children->at(i).get();
+ child->syncLayerPositionForViewportRect(viewportRect);
+ }
+}
+
+void AsyncScrollingCoordinator::ensureRootStateNodeForFrameView(FrameView* frameView)
+{
+ ASSERT(frameView->scrollLayerID());
+ attachToStateTree(ScrollingNode, frameView->scrollLayerID(), 0);
+}
+
+void AsyncScrollingCoordinator::updateScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* scrollLayer, GraphicsLayer* counterScrollingLayer)
+{
+ ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(nodeID));
+ ASSERT(node);
+ if (!node)
+ return;
+
+ node->setScrollLayer(scrollLayer);
+ node->setCounterScrollingLayer(counterScrollingLayer);
+ scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::updateViewportConstrainedNode(ScrollingNodeID nodeID, const ViewportConstraints& constraints, GraphicsLayer* graphicsLayer)
+{
+ ASSERT(supportsFixedPositionLayers());
+
+ ScrollingStateNode* node = m_scrollingStateTree->stateNodeForID(nodeID);
+ if (!node)
+ return;
+
+ switch (constraints.constraintType()) {
+ case ViewportConstraints::FixedPositionConstraint: {
+ ScrollingStateFixedNode* fixedNode = toScrollingStateFixedNode(node);
+ setScrollLayerForNode(graphicsLayer, fixedNode);
+ fixedNode->updateConstraints((const FixedPositionViewportConstraints&)constraints);
+ break;
+ }
+ case ViewportConstraints::StickyPositionConstraint: {
+ ScrollingStateStickyNode* stickyNode = toScrollingStateStickyNode(node);
+ setScrollLayerForNode(graphicsLayer, stickyNode);
+ stickyNode->updateConstraints((const StickyPositionViewportConstraints&)constraints);
+ break;
+ }
+ }
+ scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setScrollLayerForNode(GraphicsLayer* scrollLayer, ScrollingStateNode* node)
+{
+ node->setScrollLayer(scrollLayer);
+ scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setCounterScrollingLayerForNode(GraphicsLayer* layer, ScrollingStateScrollingNode* node)
+{
+ node->setCounterScrollingLayer(layer);
+ scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setHeaderLayerForNode(GraphicsLayer* headerLayer, ScrollingStateScrollingNode* node)
+{
+ // Headers and footers are only supported on the root node.
+ ASSERT(node == m_scrollingStateTree->rootStateNode());
+
+ node->setHeaderLayer(headerLayer);
+ scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setFooterLayerForNode(GraphicsLayer* footerLayer, ScrollingStateScrollingNode* node)
+{
+ // Headers and footers are only supported on the root node.
+ ASSERT(node == m_scrollingStateTree->rootStateNode());
+
+ node->setFooterLayer(footerLayer);
+ scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setNonFastScrollableRegionForNode(const Region& region, ScrollingStateScrollingNode* node)
+{
+ node->setNonFastScrollableRegion(region);
+ scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setWheelEventHandlerCountForNode(unsigned wheelEventHandlerCount, ScrollingStateScrollingNode* node)
+{
+ node->setWheelEventHandlerCount(wheelEventHandlerCount);
+ scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements behaviorForFixed, ScrollingStateScrollingNode* node)
+{
+ node->setScrollBehaviorForFixedElements(behaviorForFixed);
+ scheduleTreeStateCommit();
+}
+
+// FIXME: not sure if this belongs here.
+void AsyncScrollingCoordinator::setScrollbarPaintersFromScrollbarsForNode(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar, ScrollingStateScrollingNode* node)
+{
+ node->setScrollbarPaintersFromScrollbars(verticalScrollbar, horizontalScrollbar);
+ scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::setSynchronousScrollingReasons(SynchronousScrollingReasons reasons)
+{
+ if (!m_scrollingStateTree->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->rootStateNode()->setSynchronousScrollingReasons(reasons);
+ scheduleTreeStateCommit();
+}
+
+void AsyncScrollingCoordinator::updateMainFrameScrollLayerPosition()
+{
+ ASSERT(isMainThread());
+
+ if (!m_page)
+ return;
+
+ FrameView* frameView = m_page->mainFrame().view();
+ if (!frameView)
+ return;
+
+ if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView))
+ scrollLayer->setPosition(-frameView->scrollPosition());
+}
+
+void AsyncScrollingCoordinator::recomputeWheelEventHandlerCountForFrameView(FrameView* frameView)
+{
+ ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
+ if (!node)
+ return;
+ setWheelEventHandlerCountForNode(computeCurrentWheelEventHandlerCount(), node);
+}
+
+bool AsyncScrollingCoordinator::isRubberBandInProgress() const
+{
+ return scrollingTree()->isRubberBandInProgress();
+}
+
+void AsyncScrollingCoordinator::setScrollPinningBehavior(ScrollPinningBehavior pinning)
+{
+ scrollingTree()->setScrollPinningBehavior(pinning);
+}
+
+String AsyncScrollingCoordinator::scrollingStateTreeAsText() const
+{
+ if (m_scrollingStateTree->rootStateNode())
+ return m_scrollingStateTree->rootStateNode()->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 "ScrollingCoordinator.h"
+
+#include "ScrollingTree.h"
+#include <wtf/OwnPtr.h>
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+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<AsyncScrollingCoordinator> create(Page*);
+ virtual ~AsyncScrollingCoordinator();
+
+ ScrollingTree* scrollingTree() const { return m_scrollingTree.get(); }
+
+protected:
+ AsyncScrollingCoordinator(Page*);
+
+ void setScrollingTree(PassRefPtr<ScrollingTree> scrollingTree) { m_scrollingTree = scrollingTree; }
+
+ ScrollingStateTree* scrollingStateTree() { return m_scrollingStateTree.get(); }
+
+ PassRefPtr<ScrollingTree> 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&) 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&, 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& 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&, ScrollingStateScrollingNode*);
+ void setWheelEventHandlerCountForNode(unsigned, ScrollingStateScrollingNode*);
+ void setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements, ScrollingStateScrollingNode*);
+ // FIXME: move somewhere else?
+ void setScrollbarPaintersFromScrollbarsForNode(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar, ScrollingStateScrollingNode*);
+
+ OwnPtr<ScrollingStateTree> m_scrollingStateTree;
+ RefPtr<ScrollingTree> 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->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<ScrollingStateTree>) OVERRIDE;
+
</ins><span class="cx"> virtual void handleWheelEvent(const PlatformWheelEvent&) 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<ScrollingStateTree>) OVERRIDE;
</del><span class="cx"> virtual void updateMainFrameScrollPosition(const IntPoint& 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 "ScrollingCoordinator.h"
</del><ins>+#include "AsyncScrollingCoordinator.h"
</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&);
-
</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&);
</del><ins>+ virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&) 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&, 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& 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&, ScrollingStateScrollingNode*);
- void setWheelEventHandlerCountForNode(unsigned, ScrollingStateScrollingNode*);
- void setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements, ScrollingStateScrollingNode*);
-
- void updateMainFrameScrollLayerPosition();
-
- void scheduleTreeStateCommit();
-
</del><span class="cx"> void scrollingStateTreeCommitterTimerFired(Timer<ScrollingCoordinatorMac>*);
</span><span class="cx"> void commitTreeState();
</span><ins>+
+ void updateTiledScrollingIndicator();
</ins><span class="cx">
</span><del>- OwnPtr<ScrollingStateTree> m_scrollingStateTree;
- RefPtr<ThreadedScrollingTree> m_scrollingTree;
</del><span class="cx"> Timer<ScrollingCoordinatorMac> 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 "ScrollingCoordinatorMac.h"
</span><span class="cx">
</span><del>-#include "GraphicsLayer.h"
</del><span class="cx"> #include "FrameView.h"
</span><del>-#include "IntRect.h"
</del><span class="cx"> #include "MainFrame.h"
</span><span class="cx"> #include "Page.h"
</span><span class="cx"> #include "PlatformWheelEvent.h"
</span><del>-#include "PluginViewBase.h"
</del><span class="cx"> #include "Region.h"
</span><del>-#include "RenderLayerCompositor.h"
-#include "RenderView.h"
-#include "ScrollAnimator.h"
-#include "ScrollingConstraints.h"
-#include "ScrollingStateFixedNode.h"
-#include "ScrollingStateScrollingNode.h"
-#include "ScrollingStateStickyNode.h"
</del><span class="cx"> #include "ScrollingStateTree.h"
</span><span class="cx"> #include "ScrollingThread.h"
</span><span class="cx"> #include "ThreadedScrollingTree.h"
</span><span class="lines">@@ -52,354 +42,58 @@
</span><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx"> #include <wtf/PassRefPtr.h>
</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, &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(&ScrollingTree::invalidate, m_scrollingTree.release()));
</del><ins>+ RefPtr<ThreadedScrollingTree> scrollingTree = static_pointer_cast<ThreadedScrollingTree>(releaseScrollingTree());
+ ScrollingThread::dispatch(bind(&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()->isRubberBandInProgress();
-}
-
-void ScrollingCoordinatorMac::setScrollPinningBehavior(ScrollPinningBehavior pinning)
-{
- scrollingTree()->setScrollPinningBehavior(pinning);
-}
-
</del><span class="cx"> void ScrollingCoordinatorMac::commitTreeStateIfNeeded()
</span><span class="cx"> {
</span><del>- if (!m_scrollingStateTree->hasChangedProperties())
</del><ins>+ if (!scrollingStateTree()->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->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(&m_page->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->rootStateNode());
-
- if (!coordinatesScrollingForFrameView(frameView))
- return;
-
- ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
- if (!node)
- return;
-
- Scrollbar* verticalScrollbar = frameView->verticalScrollbar();
- Scrollbar* horizontalScrollbar = frameView->horizontalScrollbar();
- setScrollbarPaintersFromScrollbarsForNode(verticalScrollbar, horizontalScrollbar, node);
-
- node->setFrameScaleFactor(frameView->frame().frameScaleFactor());
- node->setHeaderHeight(frameView->headerHeight());
- node->setFooterHeight(frameView->footerHeight());
-
- node->setScrollOrigin(frameView->scrollOrigin());
- node->setViewportRect(IntRect(IntPoint(), frameView->visibleContentRect().size()));
- node->setTotalContentsSize(frameView->totalContentsSize());
-
- ScrollableAreaParameters scrollParameters;
- scrollParameters.horizontalScrollElasticity = frameView->horizontalScrollElasticity();
- scrollParameters.verticalScrollElasticity = frameView->verticalScrollElasticity();
- scrollParameters.hasEnabledHorizontalScrollbar = horizontalScrollbar && horizontalScrollbar->enabled();
- scrollParameters.hasEnabledVerticalScrollbar = verticalScrollbar && verticalScrollbar->enabled();
- scrollParameters.horizontalScrollbarMode = frameView->horizontalScrollbarMode();
- scrollParameters.verticalScrollbarMode = frameView->verticalScrollbarMode();
-
- node->setScrollableAreaParameters(scrollParameters);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::recomputeWheelEventHandlerCountForFrameView(FrameView* frameView)
-{
- ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->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->rootStateNode());
-
- ScrollingCoordinator::frameViewRootLayerDidChange(frameView);
-
- ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
- setScrollLayerForNode(scrollLayerForFrameView(frameView), node);
- setCounterScrollingLayerForNode(counterScrollingLayerForFrameView(frameView), node);
- setHeaderLayerForNode(headerLayerForFrameView(frameView), node);
- setFooterLayerForNode(footerLayerForFrameView(frameView), node);
- setScrollBehaviorForFixedElementsForNode(frameView->scrollBehaviorForFixedElements(), node);
-}
-
-void ScrollingCoordinatorMac::scrollableAreaScrollbarLayerDidChange(ScrollableArea* scrollableArea, ScrollbarOrientation orientation)
-{
- ASSERT(isMainThread());
- ASSERT(m_page);
-
- if (scrollableArea != static_cast<ScrollableArea*>(m_page->mainFrame().view()))
- return;
-
- if (orientation == VerticalScrollbar)
- scrollableArea->verticalScrollbarLayerDidChange();
- else
- scrollableArea->horizontalScrollbarLayerDidChange();
-}
-
-bool ScrollingCoordinatorMac::requestScrollPositionUpdate(FrameView* frameView, const IntPoint& scrollPosition)
-{
- ASSERT(isMainThread());
- ASSERT(m_page);
-
- if (!coordinatesScrollingForFrameView(frameView))
- return false;
-
- if (frameView->inProgrammaticScroll() || frameView->frame().document()->inPageCache())
- updateMainFrameScrollPosition(scrollPosition, frameView->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->frame().document()->inPageCache())
- return true;
-
- ScrollingStateScrollingNode* stateNode = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(frameView->scrollLayerID()));
- if (!stateNode)
- return false;
-
- stateNode->setRequestedScrollPosition(scrollPosition, frameView->inProgrammaticScroll());
- scheduleTreeStateCommit();
- return true;
-}
-
</del><span class="cx"> bool ScrollingCoordinatorMac::handleWheelEvent(FrameView*, const PlatformWheelEvent& 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->willWheelEventStartSwipeGesture(wheelEvent))
</del><ins>+ if (scrollingTree()->willWheelEventStartSwipeGesture(wheelEvent))
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- ScrollingThread::dispatch(bind(&ThreadedScrollingTree::handleWheelEvent, m_scrollingTree.get(), wheelEvent));
</del><ins>+ ScrollingThread::dispatch(bind(&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->attachNode(nodeType, newNodeID, parentID);
-}
-
-void ScrollingCoordinatorMac::detachFromStateTree(ScrollingNodeID nodeID)
-{
- m_scrollingStateTree->detachNode(nodeID);
-}
-
-void ScrollingCoordinatorMac::clearStateTree()
-{
- m_scrollingStateTree->clear();
-}
-
-void ScrollingCoordinatorMac::ensureRootStateNodeForFrameView(FrameView* frameView)
-{
- ASSERT(frameView->scrollLayerID());
- attachToStateTree(ScrollingNode, frameView->scrollLayerID(), 0);
-}
-
-void ScrollingCoordinatorMac::setScrollLayerForNode(GraphicsLayer* scrollLayer, ScrollingStateNode* node)
-{
- node->setScrollLayer(scrollLayer);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setCounterScrollingLayerForNode(GraphicsLayer* layer, ScrollingStateScrollingNode* node)
-{
- node->setCounterScrollingLayer(layer);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setHeaderLayerForNode(GraphicsLayer* headerLayer, ScrollingStateScrollingNode* node)
-{
- // Headers and footers are only supported on the root node.
- ASSERT(node == m_scrollingStateTree->rootStateNode());
-
- node->setHeaderLayer(headerLayer);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setFooterLayerForNode(GraphicsLayer* footerLayer, ScrollingStateScrollingNode* node)
-{
- // Headers and footers are only supported on the root node.
- ASSERT(node == m_scrollingStateTree->rootStateNode());
-
- node->setFooterLayer(footerLayer);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setScrollbarPaintersFromScrollbarsForNode(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar, ScrollingStateScrollingNode* node)
-{
- node->setScrollbarPaintersFromScrollbars(verticalScrollbar, horizontalScrollbar);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setNonFastScrollableRegionForNode(const Region& region, ScrollingStateScrollingNode* node)
-{
- node->setNonFastScrollableRegion(region);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setWheelEventHandlerCountForNode(unsigned wheelEventHandlerCount, ScrollingStateScrollingNode* node)
-{
- node->setWheelEventHandlerCount(wheelEventHandlerCount);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setScrollBehaviorForFixedElementsForNode(ScrollBehaviorForFixedElements behaviorForFixed, ScrollingStateScrollingNode* node)
-{
- node->setScrollBehaviorForFixedElements(behaviorForFixed);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::setSynchronousScrollingReasons(SynchronousScrollingReasons reasons)
-{
- if (!m_scrollingStateTree->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->rootStateNode()->setSynchronousScrollingReasons(reasons);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::updateMainFrameScrollLayerPosition()
-{
- ASSERT(isMainThread());
-
- if (!m_page)
- return;
-
- FrameView* frameView = m_page->mainFrame().view();
- if (!frameView)
- return;
-
- if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView))
- scrollLayer->setPosition(-frameView->scrollPosition());
-}
-
-void ScrollingCoordinatorMac::syncChildPositions(const LayoutRect& viewportRect)
-{
- if (!m_scrollingStateTree->rootStateNode())
- return;
-
- Vector<OwnPtr<ScrollingStateNode>>* children = m_scrollingStateTree->rootStateNode()->children();
- if (!children)
- return;
-
- // FIXME: We'll have to traverse deeper into the tree at some point.
- size_t size = children->size();
- for (size_t i = 0; i < size; ++i) {
- ScrollingStateNode* child = children->at(i).get();
- child->syncLayerPositionForViewportRect(viewportRect);
- }
-}
-
-void ScrollingCoordinatorMac::updateScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* scrollLayer, GraphicsLayer* counterScrollingLayer)
-{
- ScrollingStateScrollingNode* node = toScrollingStateScrollingNode(m_scrollingStateTree->stateNodeForID(nodeID));
- ASSERT(node);
- if (!node)
- return;
-
- node->setScrollLayer(scrollLayer);
- node->setCounterScrollingLayer(counterScrollingLayer);
- scheduleTreeStateCommit();
-}
-
-void ScrollingCoordinatorMac::updateViewportConstrainedNode(ScrollingNodeID nodeID, const ViewportConstraints& constraints, GraphicsLayer* graphicsLayer)
-{
- ASSERT(supportsFixedPositionLayers());
-
- ScrollingStateNode* node = m_scrollingStateTree->stateNodeForID(nodeID);
- if (!node)
- return;
-
- switch (constraints.constraintType()) {
- case ViewportConstraints::FixedPositionConstraint: {
- ScrollingStateFixedNode* fixedNode = toScrollingStateFixedNode(node);
- setScrollLayerForNode(graphicsLayer, fixedNode);
- fixedNode->updateConstraints((const FixedPositionViewportConstraints&)constraints);
- break;
- }
- case ViewportConstraints::StickyPositionConstraint: {
- ScrollingStateStickyNode* stickyNode = toScrollingStateStickyNode(node);
- setScrollLayerForNode(graphicsLayer, stickyNode);
- stickyNode->updateConstraints((const StickyPositionViewportConstraints&)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->hasChangedProperties())
</del><ins>+ if (!scrollingStateTree()->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->hasChangedProperties());
</del><ins>+ ASSERT(scrollingStateTree()->hasChangedProperties());
</ins><span class="cx">
</span><del>- OwnPtr<ScrollingStateTree> treeState = m_scrollingStateTree->commit();
- ScrollingThread::dispatch(bind(&ScrollingTree::commitNewTreeState, m_scrollingTree.get(), treeState.release()));
</del><ins>+ OwnPtr<ScrollingStateTree> treeState = scrollingStateTree()->commit();
+ ScrollingThread::dispatch(bind(&ThreadedScrollingTree::commitNewTreeState, toThreadedScrollingTree(scrollingTree()), treeState.release()));
</ins><span class="cx">
</span><ins>+ updateTiledScrollingIndicator();
+}
+
+void ScrollingCoordinatorMac::updateTiledScrollingIndicator()
+{
</ins><span class="cx"> FrameView* frameView = m_page->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->rootStateNode() && m_scrollingStateTree->rootStateNode()->wheelEventHandlerCount())
</del><ins>+ else if (scrollingStateTree()->rootStateNode() && scrollingStateTree()->rootStateNode()->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->setScrollingModeIndication(indicatorMode);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-String ScrollingCoordinatorMac::scrollingStateTreeAsText() const
-{
- if (m_scrollingStateTree->rootStateNode())
- return m_scrollingStateTree->rootStateNode()->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 <simon.fraser@apple.com>
+
+ 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 -> 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 <simon.fraser@apple.com>
</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 <wtf/RunLoop.h>
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><del>-#include <WebCore/ScrollingCoordinator.h>
</del><ins>+#include <WebCore/AsyncScrollingCoordinator.h>
</ins><span class="cx"> #include <WebCore/ScrollingThread.h>
</span><span class="cx"> #include <WebCore/ThreadedScrollingTree.h>
</span><span class="cx"> #endif
</span><span class="lines">@@ -67,7 +67,9 @@
</span><span class="cx">
</span><span class="cx"> ASSERT(webPage->corePage()->scrollingCoordinator());
</span><span class="cx"> ASSERT(!m_scrollingTrees.contains(webPage->pageID()));
</span><del>- m_scrollingTrees.set(webPage->pageID(), toThreadedScrollingTree(webPage->corePage()->scrollingCoordinator()->scrollingTree()));
</del><ins>+
+ AsyncScrollingCoordinator* scrollingCoordinator = toAsyncScrollingCoordinator(webPage->corePage()->scrollingCoordinator());
+ m_scrollingTrees.set(webPage->pageID(), toThreadedScrollingTree(scrollingCoordinator->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->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->supportsThreadedScrolling())
</span><del>- m_useThreadedScrolling = false;
- m_page->settings().setScrollingCoordinatorEnabled(m_useThreadedScrolling);
</del><ins>+ m_useAsyncScrolling = false;
+ m_page->settings().setScrollingCoordinatorEnabled(m_useAsyncScrolling);
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> m_mainFrame = WebFrame::createWithCoreMainFrame(this, &m_page->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 <wtf/MainThread.h>
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><del>-#import <WebCore/ScrollingCoordinator.h>
</del><ins>+#import <WebCore/AsyncScrollingCoordinator.h>
</ins><span class="cx"> #import <WebCore/ScrollingThread.h>
</span><span class="cx"> #import <WebCore/ScrollingTree.h>
</span><span class="cx"> #endif
</span><span class="lines">@@ -243,7 +243,7 @@
</span><span class="cx"> Settings& settings = m_webPage->corePage()->settings();
</span><span class="cx">
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><del>- if (ScrollingCoordinator* scrollingCoordinator = m_webPage->corePage()->scrollingCoordinator()) {
</del><ins>+ if (AsyncScrollingCoordinator* scrollingCoordinator = toAsyncScrollingCoordinator(m_webPage->corePage()->scrollingCoordinator())) {
</ins><span class="cx"> bool scrollingPerformanceLoggingEnabled = m_webPage->scrollingPerformanceLoggingEnabled();
</span><span class="cx"> ScrollingThread::dispatch(bind(&ScrollingTree::setScrollingPerformanceLoggingEnabled, scrollingCoordinator->scrollingTree(), scrollingPerformanceLoggingEnabled));
</span><span class="cx"> }
</span></span></pre>
</div>
</div>
</body>
</html>