<!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>[169411] 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/169411">169411</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-05-27 21:44:56 -0700 (Tue, 27 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS WK2] Fix behavior of position:sticky inside accelerated overflow-scroll
https://bugs.webkit.org/show_bug.cgi?id=133334
&lt;rdar://problem/16462535&gt;

Reviewed by Tim Horton.

When the scroll position changes in an accelerated overflow-scroll element, we have
to update child nodes in the scrolling tree for position:sticky. That requires a
more generic ability to update the scrolling tree after some arbitrary zoom or
scroll. To do this, we need to know the current fixed position rect, rather than
having it passed in.

So make the fixed position rect available from ScrollingTree, and make it possible
to get the current scrollPosition() from any ScrollingTreeScrollingNode.

Also, implement updateLayersAfterDelegatedScroll() in ScrollingTreeOverflowScrollingNodeIOS,
and have it update descendant layers.

Finally, fix ScrollingTreeOverflowScrollingNode to use the correct rectangle for its
constraints math, using the scroll position of the parent node if appropriate.

Source/WebCore:
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
(WebCore::ScrollingTreeFrameScrollingNodeIOS::updateChildNodesAfterScroll):
* page/scrolling/ios/ScrollingTreeIOS.cpp:
(WebCore::ScrollingTreeIOS::fixedPositionRect):
* page/scrolling/ios/ScrollingTreeIOS.h:
* page/scrolling/mac/ScrollingTreeStickyNode.mm:
(WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):

Source/WebKit2:
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
* UIProcess/Scrolling/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::fixedPositionRect):
* UIProcess/Scrolling/RemoteScrollingTree.h:
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
* UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll):
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll):
* UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeh">trunk/Source/WebCore/page/scrolling/ScrollingTree.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeScrollingNodeh">trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingiosScrollingTreeFrameScrollingNodeIOSmm">trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm</a></li>
<li><a href="#trunkSourceWebCorepagescrollingiosScrollingTreeIOScpp">trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingiosScrollingTreeIOSh">trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeFixedNodemm">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeStickyNodemm">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxyh">trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingRemoteScrollingTreecpp">trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingRemoteScrollingTreeh">trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSh">trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSmm">trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosRemoteScrollingCoordinatorProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebCore/ChangeLog        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -1,5 +1,38 @@
</span><span class="cx"> 2014-05-27  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        [iOS WK2] Fix behavior of position:sticky inside accelerated overflow-scroll
+        https://bugs.webkit.org/show_bug.cgi?id=133334
+        &lt;rdar://problem/16462535&gt;
+
+        Reviewed by Tim Horton.
+
+        When the scroll position changes in an accelerated overflow-scroll element, we have
+        to update child nodes in the scrolling tree for position:sticky. That requires a
+        more generic ability to update the scrolling tree after some arbitrary zoom or
+        scroll. To do this, we need to know the current fixed position rect, rather than
+        having it passed in.
+        
+        So make the fixed position rect available from ScrollingTree, and make it possible
+        to get the current scrollPosition() from any ScrollingTreeScrollingNode.
+        
+        Also, implement updateLayersAfterDelegatedScroll() in ScrollingTreeOverflowScrollingNodeIOS,
+        and have it update descendant layers.
+        
+        Finally, fix ScrollingTreeOverflowScrollingNode to use the correct rectangle for its
+        constraints math, using the scroll position of the parent node if appropriate.
+
+        * page/scrolling/ScrollingTree.h:
+        * page/scrolling/ScrollingTreeScrollingNode.h:
+        * page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm:
+        (WebCore::ScrollingTreeFrameScrollingNodeIOS::updateChildNodesAfterScroll):
+        * page/scrolling/ios/ScrollingTreeIOS.cpp:
+        (WebCore::ScrollingTreeIOS::fixedPositionRect):
+        * page/scrolling/ios/ScrollingTreeIOS.h:
+        * page/scrolling/mac/ScrollingTreeStickyNode.mm:
+        (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange):
+
+2014-05-27  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx">         Do some renaming in the scrolling tree
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=133333
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -87,6 +87,10 @@
</span><span class="cx">     virtual void scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatPoint&amp; scrollPosition, bool inUserInteration);
</span><span class="cx"> 
</span><span class="cx">     FloatPoint mainFrameScrollPosition();
</span><ins>+    
+#if PLATFORM(IOS)
+    virtual FloatRect fixedPositionRect() = 0;
+#endif
</ins><span class="cx"> 
</span><span class="cx">     bool isPointInNonFastScrollableRegion(IntPoint);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeScrollingNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -56,6 +56,8 @@
</span><span class="cx">     virtual void updateLayersAfterViewportChange(const FloatRect&amp; fixedPositionRect, double scale) = 0;
</span><span class="cx">     virtual void updateLayersAfterDelegatedScroll(const FloatPoint&amp;) { }
</span><span class="cx"> 
</span><ins>+    virtual FloatPoint scrollPosition() const = 0;
+
</ins><span class="cx"> protected:
</span><span class="cx">     ScrollingTreeScrollingNode(ScrollingTree&amp;, ScrollingNodeType, ScrollingNodeID);
</span><span class="cx"> 
</span><span class="lines">@@ -64,8 +66,6 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setScrollLayerPosition(const FloatPoint&amp;) = 0;
</span><span class="cx"> 
</span><del>-    virtual FloatPoint scrollPosition() const = 0;
-
</del><span class="cx">     FloatPoint lastCommittedScrollPosition() const { return m_lastCommittedScrollPosition; }
</span><span class="cx">     const FloatSize&amp; scrollableAreaSize() const { return m_scrollableAreaSize; }
</span><span class="cx">     const FloatSize&amp; totalContentsSize() const { return m_totalContentsSize; }
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingiosScrollingTreeFrameScrollingNodeIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -134,9 +134,8 @@
</span><span class="cx">     if (!m_children)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    size_t size = m_children-&gt;size();
-    for (size_t i = 0; i &lt; size; ++i)
-        m_children-&gt;at(i)-&gt;updateLayersAfterAncestorChange(*this, fixedPositionRect, FloatSize());
</del><ins>+    for (auto&amp; child : *m_children)
+        child-&gt;updateLayersAfterAncestorChange(*this, fixedPositionRect, FloatSize());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollingTreeFrameScrollingNodeIOS::updateLayersAfterDelegatedScroll(const FloatPoint&amp; scrollPosition)
</span><span class="lines">@@ -171,13 +170,10 @@
</span><span class="cx">     if (!m_children)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    viewportRect.setLocation(scrollOffset);
-
-    FloatRect viewportConstrainedObjectsRect = FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(viewportRect), roundedLayoutSize(totalContentsSize()), frameScaleFactor(), false, behaviorForFixed);
-
-    size_t size = m_children-&gt;size();
-    for (size_t i = 0; i &lt; size; ++i)
-        m_children-&gt;at(i)-&gt;updateLayersAfterAncestorChange(*this, fixedPositionRect, FloatSize());
</del><ins>+    FloatRect fixedPositionRect = scrollingTree().fixedPositionRect();
+    
+    for (auto&amp; child : *m_children)
+        child-&gt;updateLayersAfterAncestorChange(*this, fixedPositionRect, FloatSize());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FloatPoint ScrollingTreeFrameScrollingNodeIOS::minimumScrollPosition() const
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingiosScrollingTreeIOScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -97,6 +97,14 @@
</span><span class="cx">     return m_scrollingCoordinator-&gt;createScrollingTreeNode(nodeType, nodeID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+FloatRect ScrollingTreeIOS::fixedPositionRect()
+{
+    // When ScrollingTreeIOS starts being used for WK1 on iOS, this needs to get the customFixedPositionRect from
+    // the ScrollingCoordinator.
+    ASSERT_NOT_REACHED();
+    return FloatRect();
+}
+
</ins><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // ENABLE(ASYNC_SCROLLING)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingiosScrollingTreeIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.h        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -58,6 +58,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void scrollingTreeNodeDidScroll(ScrollingNodeID, const FloatPoint&amp; scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) override;
</span><span class="cx"> 
</span><ins>+    virtual FloatRect fixedPositionRect() override;
+
</ins><span class="cx">     RefPtr&lt;AsyncScrollingCoordinator&gt; m_scrollingCoordinator;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeFixedNodemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -79,9 +79,8 @@
</span><span class="cx"> 
</span><span class="cx">     FloatSize newDelta = layerPosition - m_constraints.layerPositionAtLastLayout() + cumulativeDelta;
</span><span class="cx"> 
</span><del>-    size_t size = m_children-&gt;size();
-    for (size_t i = 0; i &lt; size; ++i)
-        m_children-&gt;at(i)-&gt;updateLayersAfterAncestorChange(changedNode, fixedPositionRect, newDelta);
</del><ins>+    for (auto&amp; child : *m_children)
+        child-&gt;updateLayersAfterAncestorChange(changedNode, fixedPositionRect, newDelta);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeStickyNodemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ScrollingStateStickyNode.h&quot;
</span><span class="cx"> #include &quot;ScrollingTree.h&quot;
</span><ins>+#include &quot;ScrollingTreeOverflowScrollingNode.h&quot;
</ins><span class="cx"> #include &lt;QuartzCore/CALayer.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -66,8 +67,12 @@
</span><span class="cx"> 
</span><span class="cx"> void ScrollingTreeStickyNode::updateLayersAfterAncestorChange(const ScrollingTreeNode&amp; changedNode, const FloatRect&amp; fixedPositionRect, const FloatSize&amp; cumulativeDelta)
</span><span class="cx"> {
</span><del>-    FloatPoint layerPosition = m_constraints.layerPositionForConstrainingRect(fixedPositionRect);
</del><ins>+    FloatRect constrainingRect = fixedPositionRect;
+    if (parent()-&gt;isOverflowScrollingNode())
+        constrainingRect = FloatRect(toScrollingTreeOverflowScrollingNode(parent())-&gt;scrollPosition(), m_constraints.constrainingRectAtLastLayout().size());
</ins><span class="cx"> 
</span><ins>+    FloatPoint layerPosition = m_constraints.layerPositionForConstrainingRect(constrainingRect);
+
</ins><span class="cx">     // FIXME: Subtracting the cumulativeDelta is not totally sufficient to get the new position right for nested
</span><span class="cx">     // sticky objects. We probably need a way to modify the containingBlockRect in the ViewportContraints
</span><span class="cx">     // to get this right in all cases.
</span><span class="lines">@@ -83,9 +88,8 @@
</span><span class="cx"> 
</span><span class="cx">     FloatSize newDelta = layerPosition - m_constraints.layerPositionAtLastLayout() + cumulativeDelta;
</span><span class="cx"> 
</span><del>-    size_t size = m_children-&gt;size();
-    for (size_t i = 0; i &lt; size; ++i)
-        m_children-&gt;at(i)-&gt;updateLayersAfterAncestorChange(changedNode, fixedPositionRect, newDelta);
</del><ins>+    for (auto&amp; child : *m_children)
+        child-&gt;updateLayersAfterAncestorChange(changedNode, fixedPositionRect, newDelta);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -1,5 +1,39 @@
</span><span class="cx"> 2014-05-27  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        [iOS WK2] Fix behavior of position:sticky inside accelerated overflow-scroll
+        https://bugs.webkit.org/show_bug.cgi?id=133334
+        &lt;rdar://problem/16462535&gt;
+
+        Reviewed by Tim Horton.
+
+        When the scroll position changes in an accelerated overflow-scroll element, we have
+        to update child nodes in the scrolling tree for position:sticky. That requires a
+        more generic ability to update the scrolling tree after some arbitrary zoom or
+        scroll. To do this, we need to know the current fixed position rect, rather than
+        having it passed in.
+        
+        So make the fixed position rect available from ScrollingTree, and make it possible
+        to get the current scrollPosition() from any ScrollingTreeScrollingNode.
+        
+        Also, implement updateLayersAfterDelegatedScroll() in ScrollingTreeOverflowScrollingNodeIOS,
+        and have it update descendant layers.
+        
+        Finally, fix ScrollingTreeOverflowScrollingNode to use the correct rectangle for its
+        constraints math, using the scroll position of the parent node if appropriate.
+
+        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
+        * UIProcess/Scrolling/RemoteScrollingTree.cpp:
+        (WebKit::RemoteScrollingTree::fixedPositionRect):
+        * UIProcess/Scrolling/RemoteScrollingTree.h:
+        * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h:
+        * UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm:
+        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll):
+        (WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll):
+        * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm:
+        (WebKit::RemoteScrollingCoordinatorProxy::customFixedPositionRect):
+
+2014-05-27  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx">         Do some renaming in the scrolling tree
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=133333
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -72,6 +72,10 @@
</span><span class="cx">     void setPropagatesMainFrameScrolls(bool propagatesMainFrameScrolls) { m_propagatesMainFrameScrolls = propagatesMainFrameScrolls; }
</span><span class="cx">     bool propagatesMainFrameScrolls() const { return m_propagatesMainFrameScrolls; }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    WebCore::FloatRect customFixedPositionRect() const;
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     void connectStateNodeLayers(WebCore::ScrollingStateTree&amp;, const RemoteLayerTreeHost&amp;, bool&amp; fixedOrStickyLayerChanged);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.cpp        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -77,6 +77,13 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+WebCore::FloatRect RemoteScrollingTree::fixedPositionRect()
+{
+    return m_scrollingCoordinatorProxy.customFixedPositionRect();
+}
+#endif
+
</ins><span class="cx"> void RemoteScrollingTree::scrollingTreeNodeDidScroll(ScrollingNodeID nodeID, const FloatPoint&amp; scrollPosition, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
</span><span class="cx"> {
</span><span class="cx">     m_scrollingCoordinatorProxy.scrollingTreeNodeDidScroll(nodeID, scrollPosition, scrollingLayerPositionAction);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingTree.h        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -56,6 +56,10 @@
</span><span class="cx">     virtual void handleWheelEventPhase(WebCore::PlatformWheelEventPhase) override;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    virtual WebCore::FloatRect fixedPositionRect() override;
+#endif
+
</ins><span class="cx">     virtual PassOwnPtr&lt;WebCore::ScrollingTreeNode&gt; createNode(WebCore::ScrollingNodeType, WebCore::ScrollingNodeID);
</span><span class="cx">     
</span><span class="cx">     RemoteScrollingCoordinatorProxy&amp; m_scrollingCoordinatorProxy;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.h        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -55,6 +55,8 @@
</span><span class="cx">     virtual void setScrollLayerPosition(const WebCore::FloatPoint&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     virtual void updateLayersAfterViewportChange(const WebCore::FloatRect&amp; fixedPositionRect, double scale) { }
</span><ins>+    virtual void updateLayersAfterDelegatedScroll(const WebCore::FloatPoint&amp; scrollPosition) override;
+
</ins><span class="cx">     virtual void handleWheelEvent(const WebCore::PlatformWheelEvent&amp;) override { }
</span><span class="cx"> 
</span><span class="cx">     void updateChildNodesAfterScroll(const WebCore::FloatPoint&amp;);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingiosScrollingTreeOverflowScrollingNodeIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/ios/ScrollingTreeOverflowScrollingNodeIOS.mm        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -174,12 +174,21 @@
</span><span class="cx">     updateChildNodesAfterScroll(scrollPosition);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll(const FloatPoint&amp;)
</del><ins>+void ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll(const FloatPoint&amp; scrollPosition)
</ins><span class="cx"> {
</span><ins>+    updateChildNodesAfterScroll(scrollPosition);
+}
+
+void ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll(const FloatPoint&amp; scrollPosition)
+{
</ins><span class="cx">     if (!m_children)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // FIXME: this needs to adjust child fixed/sticky nodes.
</del><ins>+    FloatRect fixedPositionRect = scrollingTree().fixedPositionRect();
+
+    size_t size = m_children-&gt;size();
+    for (size_t i = 0; i &lt; size; ++i)
+        m_children-&gt;at(i)-&gt;updateLayersAfterAncestorChange(*this, fixedPositionRect, FloatSize());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll(const FloatPoint&amp; scrollPosition, bool inUserInteration)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosRemoteScrollingCoordinatorProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm (169410 => 169411)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm        2014-05-28 04:44:54 UTC (rev 169410)
+++ trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm        2014-05-28 04:44:56 UTC (rev 169411)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;LayerRepresentation.h&quot;
</span><span class="cx"> #include &quot;RemoteLayerTreeHost.h&quot;
</span><ins>+#include &quot;WebPageProxy.h&quot;
</ins><span class="cx"> #include &lt;WebCore/ScrollingStateFrameScrollingNode.h&gt;
</span><span class="cx"> #include &lt;WebCore/ScrollingStateOverflowScrollingNode.h&gt;
</span><span class="cx"> #include &lt;WebCore/ScrollingStateTree.h&gt;
</span><span class="lines">@@ -92,6 +93,11 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+FloatRect RemoteScrollingCoordinatorProxy::customFixedPositionRect() const
+{
+    return m_webPageProxy.computeCustomFixedPositionRect(m_webPageProxy.unobscuredContentRect(), m_webPageProxy.displayedContentScale());
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>