<!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>[169733] trunk</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/169733">169733</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-06-09 17:37:06 -0700 (Mon, 09 Jun 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Work towards having frames in the scrolling tree
https://bugs.webkit.org/show_bug.cgi?id=133665
Reviewed by Tim Horton.
Source/WebCore:
Optionally (based on Setting) create nodes in the scrolling tree for frames which
contain async-scrollable content. This will be used on iOS/WK2 to support accelerated
overflow-scroll in iframes. The setting allows for testing on OS X.
The change breaks an assumption in ScrollingCoordinator/AsyncScrollingCoordinator
that we're always dealing with the main frame, and changes logic in RenderLayerCompositor
so that we can connect the scrolling tree across frame boundaries. RenderLayerCompositor
maintains a m_subframeScrollLayersNeedReattach flag that gets set whenever we add or remove
scroll-coordinated layers in the current frame. When set, after updating compositing
layers we walk child frames, and, if they have scrolling nodes, re-attach them to the
scrolling tree (which will find the new ancestor node).
Tests: platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed.html
platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame.html
* WebCore.exp.in:
* page/FrameView.cpp:
(WebCore::FrameView::scrollLayerID): Use the new "for role" way of getting the node ID.
* page/Settings.cpp:
* page/Settings.in: Add scrollingTreeIncludesFrames.
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
(WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged): Only set
the region for the main frame.
(WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode): updateScrollPositionAfterAsyncScroll()
needs to know which FrameView a given nodeID is hosted in; doing a walk of the frame tree for
non-main frames seems to be the safest way.
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
(WebCore::AsyncScrollingCoordinator::syncChildPositions):
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView): Consult the new setting.
(WebCore::ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange):
(WebCore::ScrollingCoordinator::frameViewFixedObjectsDidChange):
(WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
(WebCore::ScrollingCoordinator::synchronousScrollingReasons):
(WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons):
(WebCore::ScrollingCoordinator::setForceSynchronousScrollLayerPositionUpdates):
(WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously):
(WebCore::ScrollingCoordinator::replaySessionStateDidChange):
(WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously): Deleted.
* rendering/RenderLayerBacking.h: Rather than separate functions to get the two scrolling
node IDs, having one scrollingNodeIDForRole() makes calling code cleaner.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::updateCompositingLayers): call reattachSubframeScrollLayers()
after a compositing tree update.
(WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer): Deals with the various configurations
in which we can do async scrolling of sticky elements.
(WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer):
(WebCore::useCoordinatedScrollingForLayer):
(WebCore::RenderLayerCompositor::requiresCompositingForPosition):
(WebCore::RenderLayerCompositor::requiresCompositingForScrolling): Moved.
(WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange): This is a bug fix;
we only need to notify child frames, not all descendant frames.
(WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
(WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
(WebCore::enclosingScrollingNodeID):
(WebCore::scrollCoordinatedAncestorInParentOfFrame):
(WebCore::RenderLayerCompositor::reattachSubframeScrollLayers):
(WebCore::RenderLayerCompositor::attachScrollingNode):
(WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
(WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
(WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers):
(WebCore::RenderLayerCompositor::willRemoveScrollingLayer):
(WebCore::isStickyInAcceleratedScrollingLayerOrViewport): Deleted.
(WebCore::isViewportConstrainedFixedOrStickyLayer): Deleted.
(WebCore::isMainFrameScrollingOrOverflowScrolling): Deleted.
(WebCore::nearestScrollCoordinatedAncestor): Deleted.
* rendering/RenderLayerCompositor.h:
* rendering/RenderView.cpp:
(WebCore::RenderView::setSelection): Added comment.
* testing/InternalSettings.cpp:
(WebCore::InternalSettings::setScrollingTreeIncludesFrames):
* testing/InternalSettings.h: Removed some useless parameter names.
* testing/InternalSettings.idl: Added setScrollingTreeIncludesFrames() setting.
Source/WebKit2:
Override coordinatesScrollingForFrameView() to always return true for composited
frames, for iOS WK2 (eventually this class will have to be specialized for iOS and OS X).
* WebProcess/Scrolling/RemoteScrollingCoordinator.h:
* WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
(WebKit::RemoteScrollingCoordinator::coordinatesScrollingForFrameView):
LayoutTests:
Tests that dump the scrolling tree with subframes.
* platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame.html: Added.
* platform/mac-wk2/tiled-drawing/scrolling/frames/resources/doc-with-sticky.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageSettingscpp">trunk/Source/WebCore/page/Settings.cpp</a></li>
<li><a href="#trunkSourceWebCorepageSettingsin">trunk/Source/WebCore/page/Settings.in</a></li>
<li><a href="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorh">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingCoordinatorh">trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingh">trunk/Source/WebCore/rendering/RenderLayerBacking.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorh">trunk/Source/WebCore/rendering/RenderLayerCompositor.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderViewcpp">trunk/Source/WebCore/rendering/RenderView.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingscpp">trunk/Source/WebCore/testing/InternalSettings.cpp</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingsh">trunk/Source/WebCore/testing/InternalSettings.h</a></li>
<li><a href="#trunkSourceWebCoretestingInternalSettingsidl">trunk/Source/WebCore/testing/InternalSettings.idl</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessScrollingRemoteScrollingCoordinatorh">trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessScrollingRemoteScrollingCoordinatormm">trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/</li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingframescoordinatedframeexpectedtxt">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingframescoordinatedframeinfixedexpectedtxt">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingframescoordinatedframeinfixedhtml">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed.html</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingframescoordinatedframehtml">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame.html</a></li>
<li>trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/</li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingscrollingframesresourcesdocwithstickyhtml">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/doc-with-sticky.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/LayoutTests/ChangeLog        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-06-09 Simon Fraser <simon.fraser@apple.com>
+
+ Work towards having frames in the scrolling tree
+ https://bugs.webkit.org/show_bug.cgi?id=133665
+
+ Reviewed by Tim Horton.
+
+ Tests that dump the scrolling tree with subframes.
+
+ * platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-expected.txt: Added.
+ * platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed-expected.txt: Added.
+ * platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed.html: Added.
+ * platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame.html: Added.
+ * platform/mac-wk2/tiled-drawing/scrolling/frames/resources/doc-with-sticky.html: Added.
+
</ins><span class="cx"> 2014-06-09 Eric Carlson <eric.carlson@apple.com>
</span><span class="cx">
</span><span class="cx"> Automatic text track selection can select more than one track
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingframescoordinatedframeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-expected.txt (0 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-expected.txt        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -0,0 +1,22 @@
</span><ins>+(Frame scrolling node
+ (scrollable area size 785 600)
+ (contents size 785 1016)
+ (children 1
+ (Frame scrolling node
+ (scrollable area size 485 300)
+ (contents size 485 1868)
+ (children 1
+ (Sticky node
+ (anchor edges: AnchorEdgeTop )
+ (top offset 10.00)
+ (containing block rect 8.00, 10.00 469.00 x 1850.00)
+ (sticky box rect 8.00 830.00 100.00 100.00)
+ (sticky box rect 8.00 830.00 100.00 100.00)
+ (sticky offset at last layout 0.00 0.00)
+ (layer position at last layout 8.00 830.00)
+ )
+ )
+ )
+ )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingframescoordinatedframeinfixedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed-expected.txt (0 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed-expected.txt         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed-expected.txt        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+(Frame scrolling node
+ (scrollable area size 785 600)
+ (contents size 785 1016)
+ (children 1
+ (Fixed node
+ (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
+ (viewport rect at last layout: 0.00 0.00 785.00 600.00)
+ (layer position at last layout 8.00 0.00)
+ (children 1
+ (Frame scrolling node
+ (scrollable area size 485 300)
+ (contents size 485 1868)
+ (children 1
+ (Sticky node
+ (anchor edges: AnchorEdgeTop )
+ (top offset 10.00)
+ (containing block rect 8.00, 10.00 469.00 x 1850.00)
+ (sticky box rect 8.00 830.00 100.00 100.00)
+ (sticky box rect 8.00 830.00 100.00 100.00)
+ (sticky offset at last layout 0.00 0.00)
+ (layer position at last layout 8.00 830.00)
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingframescoordinatedframeinfixedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed.html (0 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed.html         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed.html        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body {
+ height: 1000px;
+ }
+
+ iframe {
+ display: block;
+ margin: 10px;
+ border: 5px solid black;
+ }
+
+ #container {
+ position: absolute;
+ top: 10px;
+ border: 4px solid green;
+ padding: 10px;
+ }
+
+ #container {
+ position: fixed;
+ top: 0;
+ border: 4px solid orange;
+ }
+
+ #tree {
+ position: absolute;
+ top: 375px;
+ }
+ </style>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ window.internals.settings.setScrollingTreeIncludesFrames(true);
+ }
+
+ function startTest()
+ {
+ if (window.internals)
+ document.getElementById('tree').innerText = internals.scrollingStateTreeAsText();
+ }
+
+ window.addEventListener('load', startTest, false);
+ </script>
+</head>
+<body>
+
+ <div id="container">
+ <iframe src="resources/doc-with-sticky.html" width="500" height="300"></iframe>
+ </div>
+<pre id="tree">Scrolling tree goes here</pre>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingframescoordinatedframehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame.html (0 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame.html         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame.html        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body {
+ height: 1000px;
+ }
+
+ iframe {
+ display: block;
+ margin: 10px;
+ border: 5px solid black;
+ }
+
+ #container {
+ position: absolute;
+ top: 10px;
+ border: 4px solid green;
+ padding: 10px;
+ }
+
+ #container {
+ border: 4px solid orange;
+ }
+
+ #tree {
+ position: absolute;
+ top: 375px;
+ }
+ </style>
+ <script>
+ if (window.testRunner) {
+ testRunner.dumpAsText();
+ window.internals.settings.setScrollingTreeIncludesFrames(true);
+ }
+
+ function startTest()
+ {
+ if (window.internals)
+ document.getElementById('tree').innerText = internals.scrollingStateTreeAsText();
+ }
+
+ window.addEventListener('load', startTest, false);
+ </script>
+</head>
+<body>
+
+ <div id="container">
+ <iframe src="resources/doc-with-sticky.html" width="500" height="300"></iframe>
+ </div>
+<pre id="tree">Scrolling tree goes here</pre>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingscrollingframesresourcesdocwithstickyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/doc-with-sticky.html (0 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/doc-with-sticky.html         (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/scrolling/frames/resources/doc-with-sticky.html        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -0,0 +1,35 @@
</span><ins>+<!DOCTYPE html>
+
+<html>
+<head>
+ <style>
+ .box {
+ height: 100px;
+ width: 100px;
+ background-color: blue;
+ }
+
+ .spacer {
+ height: 400px;
+ margin: 10px;
+ background-color: silver;
+ }
+ .sticky {
+ position: -webkit-sticky;
+ top: 10px;
+ }
+
+ .composited {
+ -webkit-transform: translateZ(0);
+ }
+ </style>
+</head>
+<body>
+ <div class="spacer"></div>
+ <div class="spacer"></div>
+ <div class="sticky box"></div>
+ <div class="spacer"></div>
+ <div class="spacer"></div>
+ <div class="composited box"></div>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/ChangeLog        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -1,3 +1,90 @@
</span><ins>+2014-06-09 Simon Fraser <simon.fraser@apple.com>
+
+ Work towards having frames in the scrolling tree
+ https://bugs.webkit.org/show_bug.cgi?id=133665
+
+ Reviewed by Tim Horton.
+
+ Optionally (based on Setting) create nodes in the scrolling tree for frames which
+ contain async-scrollable content. This will be used on iOS/WK2 to support accelerated
+ overflow-scroll in iframes. The setting allows for testing on OS X.
+
+ The change breaks an assumption in ScrollingCoordinator/AsyncScrollingCoordinator
+ that we're always dealing with the main frame, and changes logic in RenderLayerCompositor
+ so that we can connect the scrolling tree across frame boundaries. RenderLayerCompositor
+ maintains a m_subframeScrollLayersNeedReattach flag that gets set whenever we add or remove
+ scroll-coordinated layers in the current frame. When set, after updating compositing
+ layers we walk child frames, and, if they have scrolling nodes, re-attach them to the
+ scrolling tree (which will find the new ancestor node).
+
+ Tests: platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame-in-fixed.html
+ platform/mac-wk2/tiled-drawing/scrolling/frames/coordinated-frame.html
+
+ * WebCore.exp.in:
+ * page/FrameView.cpp:
+ (WebCore::FrameView::scrollLayerID): Use the new "for role" way of getting the node ID.
+ * page/Settings.cpp:
+ * page/Settings.in: Add scrollingTreeIncludesFrames.
+ * page/scrolling/AsyncScrollingCoordinator.cpp:
+ (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated):
+ (WebCore::AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged): Only set
+ the region for the main frame.
+ (WebCore::AsyncScrollingCoordinator::frameViewForScrollingNode): updateScrollPositionAfterAsyncScroll()
+ needs to know which FrameView a given nodeID is hosted in; doing a walk of the frame tree for
+ non-main frames seems to be the safest way.
+ (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
+ (WebCore::AsyncScrollingCoordinator::syncChildPositions):
+ * page/scrolling/AsyncScrollingCoordinator.h:
+ * page/scrolling/ScrollingCoordinator.cpp:
+ (WebCore::ScrollingCoordinator::coordinatesScrollingForFrameView): Consult the new setting.
+ (WebCore::ScrollingCoordinator::frameViewHasSlowRepaintObjectsDidChange):
+ (WebCore::ScrollingCoordinator::frameViewFixedObjectsDidChange):
+ (WebCore::ScrollingCoordinator::frameViewRootLayerDidChange):
+ (WebCore::ScrollingCoordinator::synchronousScrollingReasons):
+ (WebCore::ScrollingCoordinator::updateSynchronousScrollingReasons):
+ (WebCore::ScrollingCoordinator::setForceSynchronousScrollLayerPositionUpdates):
+ (WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously):
+ (WebCore::ScrollingCoordinator::replaySessionStateDidChange):
+ (WebCore::ScrollingCoordinator::synchronousScrollingReasonsAsText):
+ * page/scrolling/ScrollingCoordinator.h:
+ (WebCore::ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously): Deleted.
+ * rendering/RenderLayerBacking.h: Rather than separate functions to get the two scrolling
+ node IDs, having one scrollingNodeIDForRole() makes calling code cleaner.
+ * rendering/RenderLayerCompositor.cpp:
+ (WebCore::RenderLayerCompositor::RenderLayerCompositor):
+ (WebCore::RenderLayerCompositor::updateCompositingLayers): call reattachSubframeScrollLayers()
+ after a compositing tree update.
+ (WebCore::RenderLayerCompositor::isAsyncScrollableStickyLayer): Deals with the various configurations
+ in which we can do async scrolling of sticky elements.
+ (WebCore::RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer):
+ (WebCore::useCoordinatedScrollingForLayer):
+ (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
+ (WebCore::RenderLayerCompositor::requiresCompositingForScrolling): Moved.
+ (WebCore::RenderLayerCompositor::notifyIFramesOfCompositingChange): This is a bug fix;
+ we only need to notify child frames, not all descendant frames.
+ (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus):
+ (WebCore::RenderLayerCompositor::removeFromScrollCoordinatedLayers):
+ (WebCore::enclosingScrollingNodeID):
+ (WebCore::scrollCoordinatedAncestorInParentOfFrame):
+ (WebCore::RenderLayerCompositor::reattachSubframeScrollLayers):
+ (WebCore::RenderLayerCompositor::attachScrollingNode):
+ (WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame):
+ (WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer):
+ (WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
+ (WebCore::RenderLayerCompositor::registerAllViewportConstrainedLayers):
+ (WebCore::RenderLayerCompositor::willRemoveScrollingLayer):
+ (WebCore::isStickyInAcceleratedScrollingLayerOrViewport): Deleted.
+ (WebCore::isViewportConstrainedFixedOrStickyLayer): Deleted.
+ (WebCore::isMainFrameScrollingOrOverflowScrolling): Deleted.
+ (WebCore::nearestScrollCoordinatedAncestor): Deleted.
+ * rendering/RenderLayerCompositor.h:
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::setSelection): Added comment.
+ * testing/InternalSettings.cpp:
+ (WebCore::InternalSettings::setScrollingTreeIncludesFrames):
+ * testing/InternalSettings.h: Removed some useless parameter names.
+ * testing/InternalSettings.idl: Added setScrollingTreeIncludesFrames() setting.
+
</ins><span class="cx"> 2014-06-09 Benjamin Poulain <bpoulain@apple.com>
</span><span class="cx">
</span><span class="cx"> Improve CSSPrimitiveValue::customCSSText for ARMv7
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -1521,6 +1521,7 @@
</span><span class="cx"> __ZNK7WebCore10RenderText16firstRunLocationEv
</span><span class="cx"> __ZNK7WebCore10RenderText16linesBoundingBoxEv
</span><span class="cx"> __ZNK7WebCore10RenderView12documentRectEv
</span><ins>+__ZNK7WebCore10RenderView15usesCompositingEv
</ins><span class="cx"> __ZNK7WebCore10RenderView20unscaledDocumentRectEv
</span><span class="cx"> __ZNK7WebCore10ScrollView12contentsSizeEv
</span><span class="cx"> __ZNK7WebCore10ScrollView12documentViewEv
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/page/FrameView.cpp        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -804,7 +804,7 @@
</span><span class="cx"> if (!backing)
</span><span class="cx"> return 0;
</span><span class="cx">
</span><del>- return backing->scrollingNodeID();
</del><ins>+ return backing->scrollingNodeIDForRole(FrameScrollingNode);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ScrollableArea* FrameView::scrollableAreaForScrollLayerID(uint64_t nodeID) const
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Settings.cpp (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Settings.cpp        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/page/Settings.cpp        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -127,6 +127,7 @@
</span><span class="cx"> static const bool defaultMediaPlaybackAllowsInline = false;
</span><span class="cx"> static const bool defaultMediaPlaybackRequiresUserGesture = true;
</span><span class="cx"> static const bool defaultShouldRespectImageOrientation = true;
</span><ins>+static const bool defaultScrollingTreeIncludesFrames = true;
</ins><span class="cx"> #else
</span><span class="cx"> static const bool defaultFixedPositionCreatesStackingContext = false;
</span><span class="cx"> static const bool defaultFixedBackgroundsPaintRelativeToDocument = false;
</span><span class="lines">@@ -134,6 +135,7 @@
</span><span class="cx"> static const bool defaultMediaPlaybackAllowsInline = true;
</span><span class="cx"> static const bool defaultMediaPlaybackRequiresUserGesture = false;
</span><span class="cx"> static const bool defaultShouldRespectImageOrientation = false;
</span><ins>+static const bool defaultScrollingTreeIncludesFrames = false;
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> static const double defaultIncrementalRenderingSuppressionTimeoutInSeconds = 5;
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Settings.in (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Settings.in        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/page/Settings.in        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -132,6 +132,7 @@
</span><span class="cx"> shouldDisplayCaptions initial=false, conditional=VIDEO_TRACK
</span><span class="cx"> shouldDisplayTextDescriptions initial=false, conditional=VIDEO_TRACK
</span><span class="cx"> scrollingCoordinatorEnabled initial=false
</span><ins>+scrollingTreeIncludesFrames initial=defaultScrollingTreeIncludesFrames
</ins><span class="cx"> scrollAnimatorEnabled initial=true, conditional=SMOOTH_SCROLLING
</span><span class="cx"> notificationsEnabled initial=true
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -72,7 +72,8 @@
</span><span class="cx"> // frame view whose layout was updated is not the main frame.
</span><span class="cx"> // In the future, we may want to have the ability to set non-fast scrolling regions for more than
</span><span class="cx"> // just the root node. But right now, this concept only applies to the root.
</span><del>- m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint()));
</del><ins>+ if (frameView->frame().isMainFrame())
+ m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&frameView->frame(), IntPoint()));
</ins><span class="cx">
</span><span class="cx"> if (!coordinatesScrollingForFrameView(frameView))
</span><span class="cx"> return;
</span><span class="lines">@@ -105,12 +106,13 @@
</span><span class="cx"> node->setScrollableAreaParameters(scrollParameters);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged(FrameView*)
</del><ins>+void AsyncScrollingCoordinator::frameViewNonFastScrollableRegionChanged(FrameView* frameView)
</ins><span class="cx"> {
</span><span class="cx"> if (!m_scrollingStateTree->rootStateNode())
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&m_page->mainFrame(), IntPoint()));
</del><ins>+ if (frameView->frame().isMainFrame())
+ m_scrollingStateTree->rootStateNode()->setNonFastScrollableRegion(computeNonFastScrollableRegion(&frameView->frame(), IntPoint()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AsyncScrollingCoordinator::frameViewRootLayerDidChange(FrameView* frameView)
</span><span class="lines">@@ -193,6 +195,35 @@
</span><span class="cx"> updateScrollPositionAfterAsyncScroll(m_scheduledScrollUpdate.nodeID, m_scheduledScrollUpdate.scrollPosition, m_scheduledScrollUpdate.isProgrammaticScroll, m_scheduledScrollUpdate.updateLayerPositionAction);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+FrameView* AsyncScrollingCoordinator::frameViewForScrollingNode(ScrollingNodeID scrollingNodeID) const
+{
+ if (scrollingNodeID == m_scrollingStateTree->rootStateNode()->scrollingNodeID())
+ return m_page->mainFrame().view();
+
+ ScrollingStateNode* stateNode = m_scrollingStateTree->stateNodeForID(scrollingNodeID);
+ if (!stateNode)
+ return nullptr;
+
+ // Find the enclosing frame scrolling node.
+ ScrollingStateNode* parentNode = stateNode;
+ while (parentNode && parentNode->nodeType() != FrameScrollingNode)
+ parentNode = parentNode->parent();
+
+ if (!parentNode)
+ return nullptr;
+
+ // Walk the frame tree to find the matching FrameView. This is not ideal, but avoids back pointers to FrameViews
+ // from ScrollingTreeStateNodes.
+ for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+ if (FrameView* view = frame->view()) {
+ if (view->scrollLayerID() == parentNode->scrollingNodeID())
+ return view;
+ }
+ }
+
+ return nullptr;
+}
+
</ins><span class="cx"> void AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(ScrollingNodeID scrollingNodeID, const FloatPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="lines">@@ -200,11 +231,10 @@
</span><span class="cx"> if (!m_page)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- FrameView* frameView = m_page->mainFrame().view();
</del><ins>+ FrameView* frameView = frameViewForScrollingNode(scrollingNodeID);
</ins><span class="cx"> if (!frameView)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- // Main frame.
</del><span class="cx"> if (scrollingNodeID == frameView->scrollLayerID()) {
</span><span class="cx"> bool oldProgrammaticScroll = frameView->inProgrammaticScroll();
</span><span class="cx"> frameView->setInProgrammaticScroll(programmaticScroll);
</span><span class="lines">@@ -316,11 +346,8 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // FIXME: We'll have to traverse deeper into the tree at some point.
</span><del>- size_t size = children->size();
- for (size_t i = 0; i < size; ++i) {
- ScrollingStateNode* child = children->at(i).get();
</del><ins>+ for (auto& child : *children)
</ins><span class="cx"> child->syncLayerPositionForViewportRect(viewportRect);
</span><del>- }
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void AsyncScrollingCoordinator::ensureRootStateNodeForFrameView(FrameView* frameView)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx">
</span><span class="cx"> void updateScrollPositionAfterAsyncScroll(ScrollingNodeID, const FloatPoint&, bool programmaticScroll, SetOrSyncScrollingLayerPosition);
</span><span class="cx">
</span><ins>+ virtual String scrollingStateTreeAsText() const override;
+
</ins><span class="cx"> private:
</span><span class="cx"> virtual bool isAsyncScrollingCoordinator() const override { return true; }
</span><span class="cx">
</span><span class="lines">@@ -91,7 +93,6 @@
</span><span class="cx"> virtual void updateFrameScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* scrolledContentsLayer, GraphicsLayer* counterScrollingLayer, GraphicsLayer* insetClipLayer, const ScrollingGeometry* = nullptr);
</span><span class="cx"> virtual void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* scrolledContentsLayer, const ScrollingGeometry* = nullptr);
</span><span class="cx">
</span><del>- virtual String scrollingStateTreeAsText() const override;
</del><span class="cx"> virtual bool isRubberBandInProgress() const override;
</span><span class="cx"> virtual void setScrollPinningBehavior(ScrollPinningBehavior) override;
</span><span class="cx">
</span><span class="lines">@@ -107,6 +108,8 @@
</span><span class="cx"> void updateMainFrameScrollLayerPosition();
</span><span class="cx">
</span><span class="cx"> void updateScrollPositionAfterAsyncScrollTimerFired(Timer<AsyncScrollingCoordinator>*);
</span><ins>+
+ FrameView* frameViewForScrollingNode(ScrollingNodeID) const;
</ins><span class="cx">
</span><span class="cx"> Timer<AsyncScrollingCoordinator> m_updateNodeScrollPositionTimer;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include "RenderLayerCompositor.h"
</span><span class="cx"> #include "RenderView.h"
</span><span class="cx"> #include "ScrollAnimator.h"
</span><ins>+#include "Settings.h"
</ins><span class="cx"> #include <wtf/MainThread.h>
</span><span class="cx"> #include <wtf/text/StringBuilder.h>
</span><span class="cx">
</span><span class="lines">@@ -86,11 +87,9 @@
</span><span class="cx"> ASSERT(isMainThread());
</span><span class="cx"> ASSERT(m_page);
</span><span class="cx">
</span><del>- // We currently only handle the main frame.
- if (!frameView->frame().isMainFrame())
</del><ins>+ if (!frameView->frame().isMainFrame() && !m_page->settings().scrollingTreeIncludesFrames())
</ins><span class="cx"> return false;
</span><span class="cx">
</span><del>- // We currently only support composited mode.
</del><span class="cx"> RenderView* renderView = m_page->mainFrame().contentRenderer();
</span><span class="cx"> if (!renderView)
</span><span class="cx"> return false;
</span><span class="lines">@@ -181,7 +180,7 @@
</span><span class="cx"> if (!coordinatesScrollingForFrameView(frameView))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- updateSynchronousScrollingReasons();
</del><ins>+ updateSynchronousScrollingReasons(frameView);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ScrollingCoordinator::frameViewFixedObjectsDidChange(FrameView* frameView)
</span><span class="lines">@@ -192,7 +191,7 @@
</span><span class="cx"> if (!coordinatesScrollingForFrameView(frameView))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- updateSynchronousScrollingReasons();
</del><ins>+ updateSynchronousScrollingReasons(frameView);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> GraphicsLayer* ScrollingCoordinator::scrollLayerForScrollableArea(ScrollableArea* scrollableArea)
</span><span class="lines">@@ -285,7 +284,7 @@
</span><span class="cx">
</span><span class="cx"> frameViewLayoutUpdated(frameView);
</span><span class="cx"> recomputeWheelEventHandlerCountForFrameView(frameView);
</span><del>- updateSynchronousScrollingReasons();
</del><ins>+ updateSynchronousScrollingReasons(frameView);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="lines">@@ -322,9 +321,8 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-SynchronousScrollingReasons ScrollingCoordinator::synchronousScrollingReasons() const
</del><ins>+SynchronousScrollingReasons ScrollingCoordinator::synchronousScrollingReasons(FrameView* frameView) const
</ins><span class="cx"> {
</span><del>- FrameView* frameView = m_page->mainFrame().view();
</del><span class="cx"> if (!frameView)
</span><span class="cx"> return static_cast<SynchronousScrollingReasons>(0);
</span><span class="cx">
</span><span class="lines">@@ -343,15 +341,20 @@
</span><span class="cx"> synchronousScrollingReasons |= HasViewportConstrainedObjectsWithoutSupportingFixedLayers;
</span><span class="cx"> if (supportsFixedPositionLayers() && hasVisibleSlowRepaintViewportConstrainedObjects(frameView))
</span><span class="cx"> synchronousScrollingReasons |= HasNonLayerViewportConstrainedObjects;
</span><del>- if (m_page->mainFrame().document() && m_page->mainFrame().document()->isImageDocument())
</del><ins>+ if (frameView->frame().mainFrame().document() && frameView->frame().document()->isImageDocument())
</ins><span class="cx"> synchronousScrollingReasons |= IsImageDocument;
</span><span class="cx">
</span><span class="cx"> return synchronousScrollingReasons;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void ScrollingCoordinator::updateSynchronousScrollingReasons()
</del><ins>+void ScrollingCoordinator::updateSynchronousScrollingReasons(FrameView* frameView)
</ins><span class="cx"> {
</span><del>- setSynchronousScrollingReasons(synchronousScrollingReasons());
</del><ins>+ // FIXME: Once we support async scrolling of iframes, we'll have to track the synchronous scrolling
+ // reasons per frame (maybe on scrolling tree nodes).
+ if (!frameView->frame().isMainFrame())
+ return;
+
+ setSynchronousScrollingReasons(synchronousScrollingReasons(frameView));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void ScrollingCoordinator::setForceSynchronousScrollLayerPositionUpdates(bool forceSynchronousScrollLayerPositionUpdates)
</span><span class="lines">@@ -360,13 +363,19 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> m_forceSynchronousScrollLayerPositionUpdates = forceSynchronousScrollLayerPositionUpdates;
</span><del>- updateSynchronousScrollingReasons();
</del><ins>+ updateSynchronousScrollingReasons(m_page->mainFrame().view());
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+bool ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously() const
+{
+ return synchronousScrollingReasons(m_page->mainFrame().view());
+}
+
</ins><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><span class="cx"> void ScrollingCoordinator::replaySessionStateDidChange()
</span><span class="cx"> {
</span><del>- updateSynchronousScrollingReasons();
</del><ins>+ // FIXME: Once we support async scrolling of iframes, this should go through all subframes.
+ updateSynchronousScrollingReasons(m_page->mainFrame().view());
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="lines">@@ -403,7 +412,7 @@
</span><span class="cx">
</span><span class="cx"> String ScrollingCoordinator::synchronousScrollingReasonsAsText() const
</span><span class="cx"> {
</span><del>- return synchronousScrollingReasonsAsText(synchronousScrollingReasons());
</del><ins>+ return synchronousScrollingReasonsAsText(synchronousScrollingReasons(m_page->mainFrame().view()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -110,7 +110,7 @@
</span><span class="cx"> virtual bool isRemoteScrollingCoordinator() const { return false; }
</span><span class="cx">
</span><span class="cx"> // Return whether this scrolling coordinator handles scrolling for the given frame view.
</span><del>- bool coordinatesScrollingForFrameView(FrameView*) const;
</del><ins>+ virtual bool coordinatesScrollingForFrameView(FrameView*) const;
</ins><span class="cx">
</span><span class="cx"> // Should be called whenever the given frame view has been laid out.
</span><span class="cx"> virtual void frameViewLayoutUpdated(FrameView*) { }
</span><span class="lines">@@ -183,8 +183,8 @@
</span><span class="cx"> IsImageDocument = 1 << 4
</span><span class="cx"> };
</span><span class="cx">
</span><del>- SynchronousScrollingReasons synchronousScrollingReasons() const;
- bool shouldUpdateScrollLayerPositionSynchronously() const { return synchronousScrollingReasons(); }
</del><ins>+ SynchronousScrollingReasons synchronousScrollingReasons(FrameView*) const;
+ bool shouldUpdateScrollLayerPositionSynchronously() const;
</ins><span class="cx">
</span><span class="cx"> virtual void willDestroyScrollableArea(ScrollableArea*) { }
</span><span class="cx"> virtual void scrollableAreaScrollLayerDidChange(ScrollableArea*) { }
</span><span class="lines">@@ -218,7 +218,7 @@
</span><span class="cx"> virtual void setSynchronousScrollingReasons(SynchronousScrollingReasons) { }
</span><span class="cx">
</span><span class="cx"> virtual bool hasVisibleSlowRepaintViewportConstrainedObjects(FrameView*) const;
</span><del>- void updateSynchronousScrollingReasons();
</del><ins>+ void updateSynchronousScrollingReasons(FrameView*);
</ins><span class="cx">
</span><span class="cx"> bool m_forceSynchronousScrollLayerPositionUpdates;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.h (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.h        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.h        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -108,13 +108,34 @@
</span><span class="cx"> GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); }
</span><span class="cx">
</span><span class="cx"> void detachFromScrollingCoordinator();
</span><del>-
- ScrollingNodeID viewportConstrainedNodeID() const { return m_viewportConstrainedNodeID; }
- void setViewportConstrainedNodeID(ScrollingNodeID nodeID) { m_viewportConstrainedNodeID = nodeID; }
-
- ScrollingNodeID scrollingNodeID() const { return m_scrollingNodeID; }
- void setScrollingNodeID(ScrollingNodeID nodeID) { m_scrollingNodeID = nodeID; }
</del><span class="cx">
</span><ins>+ ScrollingNodeID scrollingNodeIDForRole(ScrollingNodeType nodeType) const
+ {
+ switch (nodeType) {
+ case FrameScrollingNode:
+ case OverflowScrollingNode:
+ return m_scrollingNodeID;
+ case FixedNode:
+ case StickyNode:
+ return m_viewportConstrainedNodeID;
+ }
+ return 0;
+ }
+
+ void setScrollingNodeIDForRole(ScrollingNodeID nodeID, ScrollingNodeType nodeType)
+ {
+ switch (nodeType) {
+ case FrameScrollingNode:
+ case OverflowScrollingNode:
+ m_scrollingNodeID = nodeID;
+ break;
+ case FixedNode:
+ case StickyNode:
+ m_viewportConstrainedNodeID = nodeID;
+ break;
+ }
+ }
+
</ins><span class="cx"> ScrollingNodeID scrollingNodeIDForChildren() const { return m_scrollingNodeID ? m_scrollingNodeID : m_viewportConstrainedNodeID; }
</span><span class="cx">
</span><span class="cx"> bool hasMaskLayer() const { return m_maskLayer != 0; }
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -279,6 +279,7 @@
</span><span class="cx"> , m_shouldFlushOnReattach(false)
</span><span class="cx"> , m_forceCompositingMode(false)
</span><span class="cx"> , m_inPostLayoutUpdate(false)
</span><ins>+ , m_subframeScrollLayersNeedReattach(false)
</ins><span class="cx"> , m_isTrackingRepaints(false)
</span><span class="cx"> , m_layersWithTiledBackingCount(0)
</span><span class="cx"> , m_rootLayerAttachment(RootLayerUnattached)
</span><span class="lines">@@ -729,10 +730,13 @@
</span><span class="cx"> else if (m_rootContentLayer)
</span><span class="cx"> m_rootContentLayer->setChildren(childList);
</span><span class="cx"> }
</span><ins>+
+ reattachSubframeScrollLayers();
</ins><span class="cx"> } else if (needGeometryUpdate) {
</span><span class="cx"> // We just need to do a geometry update. This is only used for position:fixed scrolling;
</span><span class="cx"> // most of the time, geometry is updated via RenderLayer::styleChanged().
</span><span class="cx"> updateLayerTreeGeometry(*updateRoot, 0);
</span><ins>+ ASSERT(!isFullUpdate || !m_subframeScrollLayersNeedReattach);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> #if !LOG_DISABLED
</span><span class="lines">@@ -2523,21 +2527,6 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if PLATFORM(IOS)
-bool RenderLayerCompositor::requiresCompositingForScrolling(const RenderLayer& layer) const
-{
- if (!layer.hasAcceleratedTouchScrolling())
- return false;
-
- if (!m_inPostLayoutUpdate) {
- m_reevaluateCompositingAfterLayout = true;
- return layer.isComposited();
- }
-
- return layer.hasTouchScrollableOverflow();
-}
-#endif
-
</del><span class="cx"> bool RenderLayerCompositor::requiresCompositingForFilters(RenderLayerModelObject& renderer) const
</span><span class="cx"> {
</span><span class="cx"> #if ENABLE(CSS_FILTERS)
</span><span class="lines">@@ -2551,32 +2540,42 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#if PLATFORM(IOS)
-static bool isStickyInAcceleratedScrollingLayerOrViewport(const RenderLayer& layer, const RenderLayer** enclosingAcceleratedOverflowLayer = 0)
</del><ins>+bool RenderLayerCompositor::isAsyncScrollableStickyLayer(const RenderLayer& layer, const RenderLayer** enclosingAcceleratedOverflowLayer) const
</ins><span class="cx"> {
</span><span class="cx"> ASSERT(layer.renderer().isStickyPositioned());
</span><span class="cx">
</span><span class="cx"> RenderLayer* enclosingOverflowLayer = layer.enclosingOverflowClipLayer(ExcludeSelf);
</span><ins>+
+#if PLATFORM(IOS)
</ins><span class="cx"> if (enclosingOverflowLayer && enclosingOverflowLayer->hasTouchScrollableOverflow()) {
</span><span class="cx"> if (enclosingAcceleratedOverflowLayer)
</span><span class="cx"> *enclosingAcceleratedOverflowLayer = enclosingOverflowLayer;
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><del>-
- return !enclosingOverflowLayer;
-}
</del><ins>+#else
+ UNUSED_PARAM(enclosingAcceleratedOverflowLayer);
</ins><span class="cx"> #endif
</span><ins>+ // If the layer is inside normal overflow, it's not async-scrollable.
+ if (enclosingOverflowLayer)
+ return false;
</ins><span class="cx">
</span><del>-static bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer& layer)
-{
</del><ins>+ // No overflow ancestor, so see if the frame supports async scrolling.
+ if (hasCoordinatedScrolling())
+ return true;
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>- if (layer.renderer().isStickyPositioned())
- return isStickyInAcceleratedScrollingLayerOrViewport(layer);
</del><ins>+ // iOS WK1 has fixed/sticky support in the main frame via WebFixedPositionContent.
+ return m_renderView.frameView().frame().isMainFrame();
</ins><span class="cx"> #else
</span><del>- if (layer.renderer().isStickyPositioned())
- return !layer.enclosingOverflowClipLayer(ExcludeSelf);
</del><ins>+ return false;
</ins><span class="cx"> #endif
</span><ins>+}
</ins><span class="cx">
</span><ins>+bool RenderLayerCompositor::isViewportConstrainedFixedOrStickyLayer(const RenderLayer& layer) const
+{
+ if (layer.renderer().isStickyPositioned())
+ return isAsyncScrollableStickyLayer(layer);
+
</ins><span class="cx"> if (layer.renderer().style().position() != FixedPosition)
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="lines">@@ -2589,9 +2588,9 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static bool isMainFrameScrollingOrOverflowScrolling(RenderView& view, const RenderLayer& layer)
</del><ins>+static bool useCoordinatedScrollingForLayer(RenderView& view, const RenderLayer& layer)
</ins><span class="cx"> {
</span><del>- if (layer.isRootLayer() && !view.document().ownerElement())
</del><ins>+ if (layer.isRootLayer() && view.frameView().frame().isMainFrame())
</ins><span class="cx"> return true;
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="lines">@@ -2624,7 +2623,7 @@
</span><span class="cx"> return false;
</span><span class="cx">
</span><span class="cx"> if (isSticky)
</span><del>- return hasCoordinatedScrolling() && isViewportConstrainedFixedOrStickyLayer(layer);
</del><ins>+ return isAsyncScrollableStickyLayer(layer);
</ins><span class="cx">
</span><span class="cx"> auto container = renderer.container();
</span><span class="cx"> // If the renderer is not hooked up yet then we have to wait until it is.
</span><span class="lines">@@ -2674,6 +2673,21 @@
</span><span class="cx"> return layer.needsCompositedScrolling();
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#if PLATFORM(IOS)
+bool RenderLayerCompositor::requiresCompositingForScrolling(const RenderLayer& layer) const
+{
+ if (!layer.hasAcceleratedTouchScrolling())
+ return false;
+
+ if (!m_inPostLayoutUpdate) {
+ m_reevaluateCompositingAfterLayout = true;
+ return layer.isComposited();
+ }
+
+ return layer.hasTouchScrollableOverflow();
+}
+#endif
+
</ins><span class="cx"> bool RenderLayerCompositor::isRunningAcceleratedTransformAnimation(RenderLayerModelObject& renderer) const
</span><span class="cx"> {
</span><span class="cx"> if (!(m_compositingTriggers & ChromeClient::AnimationTrigger))
</span><span class="lines">@@ -3426,9 +3440,7 @@
</span><span class="cx"> // to use a synthetic style change to get the iframes into RenderLayers in order to allow them to composite.
</span><span class="cx"> void RenderLayerCompositor::notifyIFramesOfCompositingChange()
</span><span class="cx"> {
</span><del>- Frame& frame = m_renderView.frameView().frame();
-
- for (Frame* child = frame.tree().firstChild(); child; child = child->tree().traverseNext(&frame)) {
</del><ins>+ for (Frame* child = m_renderView.frameView().frame().tree().firstChild(); child; child = child->tree().nextSibling()) {
</ins><span class="cx"> if (child->document() && child->document()->ownerElement())
</span><span class="cx"> child->document()->ownerElement()->scheduleSetNeedsStyleRecalc(SyntheticStyleChange);
</span><span class="cx"> }
</span><span class="lines">@@ -3493,11 +3505,13 @@
</span><span class="cx"> if (isViewportConstrainedFixedOrStickyLayer(layer))
</span><span class="cx"> coordinationReasons |= FixedOrSticky;
</span><span class="cx">
</span><del>- if (isMainFrameScrollingOrOverflowScrolling(m_renderView, layer))
</del><ins>+ if (useCoordinatedScrollingForLayer(m_renderView, layer))
</ins><span class="cx"> coordinationReasons |= Scrolling;
</span><del>-
</del><ins>+
</ins><span class="cx"> if (coordinationReasons) {
</span><del>- m_scrollCoordinatedLayers.add(&layer);
</del><ins>+ if (m_scrollCoordinatedLayers.add(&layer).isNewEntry)
+ m_subframeScrollLayersNeedReattach = true;
+
</ins><span class="cx"> updateScrollCoordinatedLayer(layer, coordinationReasons);
</span><span class="cx"> } else
</span><span class="cx"> removeFromScrollCoordinatedLayers(layer);
</span><span class="lines">@@ -3508,6 +3522,8 @@
</span><span class="cx"> if (!m_scrollCoordinatedLayers.contains(&layer))
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ m_subframeScrollLayersNeedReattach = true;
+
</ins><span class="cx"> m_scrollCoordinatedLayers.remove(&layer);
</span><span class="cx"> m_scrollCoordinatedLayersNeedingUpdate.remove(&layer);
</span><span class="cx">
</span><span class="lines">@@ -3571,30 +3587,99 @@
</span><span class="cx"> return constraints;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static RenderLayerBacking* nearestScrollCoordinatedAncestor(RenderLayer& layer)
</del><ins>+static ScrollingNodeID enclosingScrollingNodeID(RenderLayer& layer, IncludeSelfOrNot includeSelf)
</ins><span class="cx"> {
</span><del>- RenderLayer* ancestor = layer.parent();
- while (ancestor) {
- if (RenderLayerBacking* backing = ancestor->backing()) {
- if (backing->scrollingNodeIDForChildren())
- return backing;
</del><ins>+ RenderLayer* currLayer = includeSelf == IncludeSelf ? &layer : layer.parent();
+ while (currLayer) {
+ if (RenderLayerBacking* backing = currLayer->backing()) {
+ if (ScrollingNodeID nodeID = backing->scrollingNodeIDForChildren())
+ return nodeID;
</ins><span class="cx"> }
</span><del>- ancestor = ancestor->parent();
</del><ins>+ currLayer = currLayer->parent();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- return nullptr;
</del><ins>+ return 0;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, ScrollCoordinationReasons reasons)
</del><ins>+static ScrollingNodeID scrollCoordinatedAncestorInParentOfFrame(Frame& frame)
</ins><span class="cx"> {
</span><del>- // FIXME: support scrolling layers in iframes.
- if (m_renderView.document().ownerElement())
</del><ins>+ if (!frame.document() || !frame.view())
+ return 0;
+
+ // Find the frame's enclosing layer in our render tree.
+ HTMLFrameOwnerElement* ownerElement = frame.document()->ownerElement();
+ RenderElement* frameRenderer = ownerElement ? ownerElement->renderer() : nullptr;
+ if (!frameRenderer)
+ return 0;
+
+ RenderLayer* layerInParentDocument = frameRenderer->enclosingLayer();
+ if (!layerInParentDocument)
+ return 0;
+
+ return enclosingScrollingNodeID(*layerInParentDocument, IncludeSelf);
+}
+
+void RenderLayerCompositor::reattachSubframeScrollLayers()
+{
+ if (!m_subframeScrollLayersNeedReattach)
</ins><span class="cx"> return;
</span><ins>+
+ m_subframeScrollLayersNeedReattach = false;
</ins><span class="cx">
</span><span class="cx"> ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
</span><del>- if (!scrollingCoordinator)
</del><ins>+
+ for (Frame* child = m_renderView.frameView().frame().tree().firstChild(); child; child = child->tree().nextSibling()) {
+ if (!child->document() || !child->view())
+ continue;
+
+ // Ignore frames that are not scroll-coordinated.
+ FrameView* childFrameView = child->view();
+ ScrollingNodeID frameScrollingNodeID = childFrameView->scrollLayerID();
+ if (!frameScrollingNodeID)
+ continue;
+
+ ScrollingNodeID parentNodeID = scrollCoordinatedAncestorInParentOfFrame(*child);
+ if (!parentNodeID)
+ continue;
+
+ scrollingCoordinator->attachToStateTree(FrameScrollingNode, frameScrollingNodeID, parentNodeID);
+ }
+}
+
+ScrollingNodeID RenderLayerCompositor::attachScrollingNode(RenderLayer& layer, ScrollingNodeType nodeType, ScrollingNodeID parentNodeID)
+{
+ ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
+ RenderLayerBacking* backing = layer.backing();
+
+ ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(nodeType);
+ if (!nodeID)
+ nodeID = scrollingCoordinator->uniqueScrollLayerID();
+
+ nodeID = scrollingCoordinator->attachToStateTree(nodeType, nodeID, parentNodeID);
+ if (!nodeID)
+ return 0;
+
+ backing->setScrollingNodeIDForRole(nodeID, nodeType);
+ m_scrollingNodeToLayerMap.add(nodeID, &layer);
+
+ return nodeID;
+}
+
+void RenderLayerCompositor::updateScrollCoordinationForThisFrame(ScrollingNodeID parentNodeID)
+{
+ ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
+ ASSERT(scrollingCoordinator->coordinatesScrollingForFrameView(&m_renderView.frameView()));
+
+ ScrollingNodeID nodeID = attachScrollingNode(*m_renderView.layer(), FrameScrollingNode, parentNodeID);
+ scrollingCoordinator->updateFrameScrollingNode(nodeID, m_scrollLayer.get(), m_rootContentLayer.get(), fixedRootBackgroundLayer(), clipLayer());
+}
+
+void RenderLayerCompositor::updateScrollCoordinatedLayer(RenderLayer& layer, ScrollCoordinationReasons reasons)
+{
+ ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator();
+ if (!scrollingCoordinator || !scrollingCoordinator->coordinatesScrollingForFrameView(&m_renderView.frameView()))
</ins><span class="cx"> return;
</span><del>-
</del><ins>+
</ins><span class="cx"> bool isRootLayer = &layer == m_renderView.layer();
</span><span class="cx">
</span><span class="cx"> // FIXME: Remove supportsFixedPositionLayers() since all platforms support them now.
</span><span class="lines">@@ -3608,19 +3693,23 @@
</span><span class="cx"> if (!backing)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- RenderLayerBacking* parent = nearestScrollCoordinatedAncestor(layer);
- if (!parent && !isRootLayer)
</del><ins>+ if (!m_renderView.frame().isMainFrame()) {
+ ScrollingNodeID parentDocumentHostingNodeID = scrollCoordinatedAncestorInParentOfFrame(m_renderView.frame());
+ if (!parentDocumentHostingNodeID)
+ return;
+
+ updateScrollCoordinationForThisFrame(parentDocumentHostingNodeID);
+ if (!(reasons & FixedOrSticky) && isRootLayer)
+ return;
+ }
+
+ ScrollingNodeID parentNodeID = enclosingScrollingNodeID(layer, ExcludeSelf);
+ if (!parentNodeID && !isRootLayer)
</ins><span class="cx"> return;
</span><del>-
- ScrollingNodeID parentNodeID = parent ? parent->scrollingNodeIDForChildren() : 0;
</del><span class="cx">
</span><span class="cx"> // Always call this even if the backing is already attached because the parent may have changed.
</span><span class="cx"> // If a node plays both roles, fixed/sticky is always the ancestor node of scrolling.
</span><span class="cx"> if (reasons & FixedOrSticky) {
</span><del>- ScrollingNodeID nodeID = backing->viewportConstrainedNodeID();
- if (!nodeID)
- nodeID = scrollingCoordinator->uniqueScrollLayerID();
-
</del><span class="cx"> ScrollingNodeType nodeType = FrameScrollingNode;
</span><span class="cx"> if (layer.renderer().style().position() == FixedPosition)
</span><span class="cx"> nodeType = FixedNode;
</span><span class="lines">@@ -3629,12 +3718,10 @@
</span><span class="cx"> else
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><span class="cx">
</span><del>- nodeID = scrollingCoordinator->attachToStateTree(nodeType, nodeID, parentNodeID);
</del><ins>+ ScrollingNodeID nodeID = attachScrollingNode(layer, nodeType, parentNodeID);
</ins><span class="cx"> if (!nodeID)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- backing->setViewportConstrainedNodeID(nodeID);
-
</del><span class="cx"> switch (nodeType) {
</span><span class="cx"> case FixedNode:
</span><span class="cx"> scrollingCoordinator->updateViewportConstrainedNode(nodeID, computeFixedViewportConstraints(layer), backing->graphicsLayer());
</span><span class="lines">@@ -3651,35 +3738,20 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (reasons & Scrolling) {
</span><del>- ScrollingNodeID nodeID = backing->scrollingNodeID();
- if (!nodeID)
- nodeID = scrollingCoordinator->uniqueScrollLayerID();
</del><ins>+ if (isRootLayer)
+ updateScrollCoordinationForThisFrame(parentNodeID);
+ else {
+ ScrollingNodeType nodeType = isRootLayer ? FrameScrollingNode : OverflowScrollingNode;
+ ScrollingNodeID nodeID = attachScrollingNode(layer, nodeType, parentNodeID);
+ if (!nodeID)
+ return;
</ins><span class="cx">
</span><del>- nodeID = scrollingCoordinator->attachToStateTree(isRootLayer ? FrameScrollingNode : OverflowScrollingNode, nodeID, parentNodeID);
- if (!nodeID)
- return;
-
- backing->setScrollingNodeID(nodeID);
- m_scrollingNodeToLayerMap.add(nodeID, &layer);
-
- GraphicsLayer* scrollingLayer = backing->scrollingLayer();
- GraphicsLayer* scrolledContentsLayer = backing->scrollingContentsLayer();
- GraphicsLayer* counterScrollingLayer = nullptr;
- GraphicsLayer* insetClipLayer = nullptr;
-
- if (isRootLayer) {
- scrollingLayer = m_scrollLayer.get();
- scrolledContentsLayer = m_rootContentLayer.get();
- counterScrollingLayer = fixedRootBackgroundLayer();
- insetClipLayer = clipLayer();
- scrollingCoordinator->updateFrameScrollingNode(nodeID, scrollingLayer, scrolledContentsLayer, counterScrollingLayer, insetClipLayer);
- } else {
</del><span class="cx"> ScrollingCoordinator::ScrollingGeometry scrollingGeometry;
</span><span class="cx"> scrollingGeometry.scrollOrigin = layer.scrollOrigin();
</span><span class="cx"> scrollingGeometry.scrollPosition = layer.scrollPosition();
</span><span class="cx"> scrollingGeometry.scrollableAreaSize = layer.visibleSize();
</span><span class="cx"> scrollingGeometry.contentSize = layer.contentsSize();
</span><del>- scrollingCoordinator->updateOverflowScrollingNode(nodeID, scrollingLayer, scrolledContentsLayer, &scrollingGeometry);
</del><ins>+ scrollingCoordinator->updateOverflowScrollingNode(nodeID, backing->scrollingLayer(), backing->scrollingContentsLayer(), &scrollingGeometry);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -3690,10 +3762,13 @@
</span><span class="cx"> if (!backing)
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- backing->detachFromScrollingCoordinator();
</del><ins>+ if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(FrameScrollingNode))
+ m_scrollingNodeToLayerMap.remove(nodeID);
</ins><span class="cx">
</span><del>- if (ScrollingNodeID nodeID = backing->scrollingNodeID())
</del><ins>+ if (ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(FixedNode))
</ins><span class="cx"> m_scrollingNodeToLayerMap.remove(nodeID);
</span><ins>+
+ backing->detachFromScrollingCoordinator();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ScrollableArea* RenderLayerCompositor::scrollableAreaForScrollLayerID(ScrollingNodeID nodeID) const
</span><span class="lines">@@ -3728,7 +3803,7 @@
</span><span class="cx"> if (layer.renderer().isStickyPositioned()) {
</span><span class="cx"> constraints = std::make_unique<StickyPositionViewportConstraints>(computeStickyViewportConstraints(layer));
</span><span class="cx"> const RenderLayer* enclosingTouchScrollableLayer = nullptr;
</span><del>- if (isStickyInAcceleratedScrollingLayerOrViewport(layer, &enclosingTouchScrollableLayer) && enclosingTouchScrollableLayer) {
</del><ins>+ if (isAsyncScrollableStickyLayer(layer, &enclosingTouchScrollableLayer) && enclosingTouchScrollableLayer) {
</ins><span class="cx"> ASSERT(enclosingTouchScrollableLayer->isComposited());
</span><span class="cx"> stickyContainerMap.add(layer.backing()->graphicsLayer()->platformLayer(), enclosingTouchScrollableLayer->backing()->scrollingLayer()->platformLayer());
</span><span class="cx"> }
</span><span class="lines">@@ -3791,7 +3866,7 @@
</span><span class="cx"> RenderLayerBacking* backing = layer.backing();
</span><span class="cx">
</span><span class="cx"> if (backing)
</span><del>- scrollingCoordinator->detachFromStateTree(backing->scrollingNodeID());
</del><ins>+ backing->detachFromScrollingCoordinator();
</ins><span class="cx">
</span><span class="cx"> // For Coordinated Graphics.
</span><span class="cx"> scrollingCoordinator->scrollableAreaScrollLayerDidChange(&layer);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -395,7 +395,6 @@
</span><span class="cx"> PassRefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const;
</span><span class="cx"> #endif
</span><span class="cx">
</span><del>- // Whether a running transition or animation enforces the need for a compositing layer.
</del><span class="cx"> bool requiresCompositingForAnimation(RenderLayerModelObject&) const;
</span><span class="cx"> bool requiresCompositingForTransform(RenderLayerModelObject&) const;
</span><span class="cx"> bool requiresCompositingForBackfaceVisibility(RenderLayerModelObject&) const;
</span><span class="lines">@@ -424,9 +423,12 @@
</span><span class="cx"> };
</span><span class="cx"> typedef unsigned ScrollCoordinationReasons;
</span><span class="cx">
</span><ins>+ void updateScrollCoordinationForThisFrame(ScrollingNodeID);
+ ScrollingNodeID attachScrollingNode(RenderLayer&, ScrollingNodeType, ScrollingNodeID parentNodeID);
</ins><span class="cx"> void updateScrollCoordinatedLayer(RenderLayer&, ScrollCoordinationReasons);
</span><span class="cx"> void detachScrollCoordinatedLayer(RenderLayer&);
</span><del>-
</del><ins>+ void reattachSubframeScrollLayers();
+
</ins><span class="cx"> FixedPositionViewportConstraints computeFixedViewportConstraints(RenderLayer&) const;
</span><span class="cx"> StickyPositionViewportConstraints computeStickyViewportConstraints(RenderLayer&) const;
</span><span class="cx">
</span><span class="lines">@@ -439,7 +441,12 @@
</span><span class="cx"> bool requiresContentShadowLayer() const;
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+ // True if the FrameView uses a ScrollingCoordinator.
</ins><span class="cx"> bool hasCoordinatedScrolling() const;
</span><ins>+
+ bool isAsyncScrollableStickyLayer(const RenderLayer&, const RenderLayer** enclosingAcceleratedOverflowLayer = nullptr) const;
+ bool isViewportConstrainedFixedOrStickyLayer(const RenderLayer&) const;
+
</ins><span class="cx"> bool shouldCompositeOverflowControls() const;
</span><span class="cx">
</span><span class="cx"> void scheduleLayerFlushNow();
</span><span class="lines">@@ -480,6 +487,7 @@
</span><span class="cx"> bool m_shouldFlushOnReattach;
</span><span class="cx"> bool m_forceCompositingMode;
</span><span class="cx"> bool m_inPostLayoutUpdate; // true when it's OK to trust layout information (e.g. layer sizes and positions)
</span><ins>+ bool m_subframeScrollLayersNeedReattach;
</ins><span class="cx">
</span><span class="cx"> bool m_isTrackingRepaints; // Used for testing.
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderView.cpp (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderView.cpp        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/rendering/RenderView.cpp        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -839,6 +839,7 @@
</span><span class="cx"> if ((start && !end) || (end && !start))
</span><span class="cx"> return;
</span><span class="cx">
</span><ins>+ // FIXME: view() is just *this here.
</ins><span class="cx"> bool caretChanged = m_selectionWasCaret != view().frame().selection().isCaret();
</span><span class="cx"> m_selectionWasCaret = view().frame().selection().isCaret();
</span><span class="cx"> // Just return if the selection hasn't changed.
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.cpp (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.cpp        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/testing/InternalSettings.cpp        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -486,4 +486,10 @@
</span><span class="cx"> settings()->setShouldConvertPositionStyleOnCopy(convert);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void InternalSettings::setScrollingTreeIncludesFrames(bool enabled, ExceptionCode& ec)
+{
+ InternalSettingsGuardForSettings();
+ settings()->setScrollingTreeIncludesFrames(enabled);
</ins><span class="cx"> }
</span><ins>+
+}
</ins></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.h (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.h        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/testing/InternalSettings.h        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -100,8 +100,8 @@
</span><span class="cx"> virtual ~InternalSettings();
</span><span class="cx"> void resetToConsistentState();
</span><span class="cx">
</span><del>- void setUsesOverlayScrollbars(bool enabled, ExceptionCode&);
- void setTouchEventEmulationEnabled(bool enabled, ExceptionCode&);
</del><ins>+ void setUsesOverlayScrollbars(bool, ExceptionCode&);
+ void setTouchEventEmulationEnabled(bool, ExceptionCode&);
</ins><span class="cx"> void setStandardFontFamily(const String& family, const String& script, ExceptionCode&);
</span><span class="cx"> void setSerifFontFamily(const String& family, const String& script, ExceptionCode&);
</span><span class="cx"> void setSansSerifFontFamily(const String& family, const String& script, ExceptionCode&);
</span><span class="lines">@@ -113,26 +113,26 @@
</span><span class="cx"> void setTextAutosizingWindowSizeOverride(int width, int height, ExceptionCode&);
</span><span class="cx"> void setTextAutosizingFontScaleFactor(float fontScaleFactor, ExceptionCode&);
</span><span class="cx"> void setMediaTypeOverride(const String& mediaType, ExceptionCode&);
</span><del>- void setCSSExclusionsEnabled(bool enabled, ExceptionCode&);
- void setCSSShapesEnabled(bool enabled, ExceptionCode&);
</del><ins>+ void setCSSExclusionsEnabled(bool, ExceptionCode&);
+ void setCSSShapesEnabled(bool, ExceptionCode&);
</ins><span class="cx"> void setCanStartMedia(bool, ExceptionCode&);
</span><span class="cx"> void setEditingBehavior(const String&, ExceptionCode&);
</span><span class="cx"> void setShouldDisplayTrackKind(const String& kind, bool enabled, ExceptionCode&);
</span><span class="cx"> bool shouldDisplayTrackKind(const String& kind, ExceptionCode&);
</span><span class="cx"> void setStorageBlockingPolicy(const String&, ExceptionCode&);
</span><span class="cx"> void setLangAttributeAwareFormControlUIEnabled(bool);
</span><del>- void setImagesEnabled(bool enabled, ExceptionCode&);
</del><ins>+ void setImagesEnabled(bool, ExceptionCode&);
</ins><span class="cx"> void setMinimumTimerInterval(double intervalInSeconds, ExceptionCode&);
</span><span class="cx"> void setDefaultVideoPosterURL(const String& url, ExceptionCode&);
</span><span class="cx"> void setTimeWithoutMouseMovementBeforeHidingControls(double time, ExceptionCode&);
</span><del>- void setUseLegacyBackgroundSizeShorthandBehavior(bool enabled, ExceptionCode&);
- void setAutoscrollForDragAndDropEnabled(bool enabled, ExceptionCode&);
- void setFontFallbackPrefersPictographs(bool preferPictographs, ExceptionCode&);
</del><ins>+ void setUseLegacyBackgroundSizeShorthandBehavior(bool, ExceptionCode&);
+ void setAutoscrollForDragAndDropEnabled(bool, ExceptionCode&);
+ void setFontFallbackPrefersPictographs(bool, ExceptionCode&);
</ins><span class="cx"> void setPluginReplacementEnabled(bool);
</span><del>- void setBackgroundShouldExtendBeyondPage(bool hasExtendedBackground, ExceptionCode&);
- void setShouldConvertPositionStyleOnCopy(bool convert, ExceptionCode&);
</del><ins>+ void setBackgroundShouldExtendBeyondPage(bool, ExceptionCode&);
+ void setShouldConvertPositionStyleOnCopy(bool, ExceptionCode&);
+ void setScrollingTreeIncludesFrames(bool, ExceptionCode&);
</ins><span class="cx">
</span><del>-
</del><span class="cx"> private:
</span><span class="cx"> explicit InternalSettings(Page*);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoretestingInternalSettingsidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/testing/InternalSettings.idl (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/testing/InternalSettings.idl        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebCore/testing/InternalSettings.idl        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx"> [RaisesException] void setUseLegacyBackgroundSizeShorthandBehavior(boolean enabled);
</span><span class="cx"> [RaisesException] void setAutoscrollForDragAndDropEnabled(boolean enabled);
</span><span class="cx"> [RaisesException] void setBackgroundShouldExtendBeyondPage(boolean hasExtendedBackground);
</span><ins>+ [RaisesException] void setScrollingTreeIncludesFrames(boolean enabled);
</ins><span class="cx">
</span><span class="cx"> [RaisesException] void setMinimumTimerInterval(unrestricted double intervalInSeconds);
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebKit2/ChangeLog        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2014-06-09 Simon Fraser <simon.fraser@apple.com>
+
+ Work towards having frames in the scrolling tree
+ https://bugs.webkit.org/show_bug.cgi?id=133665
+
+ Reviewed by Tim Horton.
+
+ Override coordinatesScrollingForFrameView() to always return true for composited
+ frames, for iOS WK2 (eventually this class will have to be specialized for iOS and OS X).
+
+ * WebProcess/Scrolling/RemoteScrollingCoordinator.h:
+ * WebProcess/Scrolling/RemoteScrollingCoordinator.mm:
+ (WebKit::RemoteScrollingCoordinator::coordinatesScrollingForFrameView):
+
</ins><span class="cx"> 2014-06-09 Anders Carlsson <andersca@apple.com>
</span><span class="cx">
</span><span class="cx"> Give callbacks real status codes
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessScrollingRemoteScrollingCoordinatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.h        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx"> virtual bool isRemoteScrollingCoordinator() const override { return true; }
</span><span class="cx">
</span><span class="cx"> // ScrollingCoordinator
</span><ins>+ virtual bool coordinatesScrollingForFrameView(WebCore::FrameView*) const override;
</ins><span class="cx"> virtual void scheduleTreeStateCommit() override;
</span><span class="cx">
</span><span class="cx"> virtual PassOwnPtr<WebCore::ScrollingTreeNode> createScrollingTreeNode(WebCore::ScrollingNodeType, WebCore::ScrollingNodeID) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessScrollingRemoteScrollingCoordinatormm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm (169732 => 169733)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm        2014-06-10 00:26:48 UTC (rev 169732)
+++ trunk/Source/WebKit2/WebProcess/Scrolling/RemoteScrollingCoordinator.mm        2014-06-10 00:37:06 UTC (rev 169733)
</span><span class="lines">@@ -74,6 +74,12 @@
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool RemoteScrollingCoordinator::coordinatesScrollingForFrameView(FrameView* frameView) const
+{
+ RenderView* renderView = frameView->renderView();
+ return renderView && renderView->usesCompositing();
+}
+
</ins><span class="cx"> bool RemoteScrollingCoordinator::isRubberBandInProgress() const
</span><span class="cx"> {
</span><span class="cx"> // FIXME: need to maintain state in the web process?
</span></span></pre>
</div>
</div>
</body>
</html>