<!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>[165652] 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/165652">165652</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-03-14 14:50:57 -0700 (Fri, 14 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS WK2] Improve behavior of fixed elments on zooming
https://bugs.webkit.org/show_bug.cgi?id=130253

Reviewed by Beth Dakin.

Correctly reposition right- and bottom-relative position:fixed
elements on zooming in WK2 iOS by telling the scrolling tree
about zoom-related viewport changes.

Source/WebCore:

* WebCore.exp.in:
* page/FrameView.cpp:
(WebCore::FrameView::rectForViewportConstrainedObjects):
(WebCore::FrameView::viewportConstrainedObjectsRect): We need to be able to
recompute the fixed position rect from the scrolling tree on iOS, so we need
a static function, similar to scrollOffsetForFixedPosition(), that computes
the constrained viewport.
* page/FrameView.h:
* page/Page.cpp:
(WebCore::Page::setPageScaleFactor): When scrolling (and, by implication, zooming)
is delegated, then setPageScaleFactor() should not affect the scroll position.
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): Go back to just
passing the visibleContentRect() for iOS.
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Entrypoint to
the scrolling tree, called when the viewport is changed by zooming.
* page/scrolling/ScrollingTree.h:
* page/scrolling/ScrollingTreeScrollingNode.h:
* page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h:
* page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm:
(WebCore::ScrollingTreeScrollingNodeIOS::setScrollLayerPosition): Use the
new FrameView::rectForViewportConstrainedObjects() to compute the correct viewport
for fixed/sticky child nodes.
(WebCore::ScrollingTreeScrollingNodeIOS::updateForViewport):
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::updateForViewport):

Source/WebKit2:

* Shared/mac/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
Drive-by cleanup; typedef the flags field to an unsigned, to avoid ugly casting.
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::updateScrollingTree): Pass out a flag to say
if the update contained a new fixed or sticky layer.
(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
(WebKit::RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling):
Call into the new ScrolingTree::viewportChangedViaDelegatedScrolling().
* UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
* UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm: If we got a new fixed
or sticky layer, set fixedOrStickyLayerChanged to true.
(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto.
* UIProcess/ios/WKContentView.mm:
(-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]):
Remember both the old zoomScale and the filteredScale, since the fixed position rect
should be computed using the unfiltered scale.
Some FloatRect -&gt; CGRect changes.
Now call viewportChangedViaDelegatedScrolling() on the scrolling coordinator.
(-[WKContentView fixedPositionRectFromExposedRect:scale:]): Call the
FrameView function to compute the iOS fixed position rect.
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): If the update
got a new fixed or sticky layer, run the scrolling tree logic to make sure
it gets into the right place.
* UIProcess/mac/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree): If we logged here,
we'd log twice if the tiled scrolling indicator was enabled, so
hoisted the logging out into the caller.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</a></li>
<li><a href="#trunkSourceWebCorepagePagecpp">trunk/Source/WebCore/page/Page.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp">trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreecpp">trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeh">trunk/Source/WebCore/page/scrolling/ScrollingTree.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingScrollingTreeScrollingNodeh">trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingiosScrollingTreeScrollingNodeIOSh">trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingiosScrollingTreeScrollingNodeIOSmm">trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeScrollingNodeMach">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h</a></li>
<li><a href="#trunkSourceWebCorepagescrollingmacScrollingTreeScrollingNodeMacmm">trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxycpp">trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxyh">trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosRemoteScrollingCoordinatorProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxymm">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeHostmm">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/ChangeLog        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2014-03-14  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Improve behavior of fixed elments on zooming
+        https://bugs.webkit.org/show_bug.cgi?id=130253
+
+        Reviewed by Beth Dakin.
+
+        Correctly reposition right- and bottom-relative position:fixed
+        elements on zooming in WK2 iOS by telling the scrolling tree
+        about zoom-related viewport changes.
+
+        * WebCore.exp.in:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::rectForViewportConstrainedObjects):
+        (WebCore::FrameView::viewportConstrainedObjectsRect): We need to be able to
+        recompute the fixed position rect from the scrolling tree on iOS, so we need
+        a static function, similar to scrollOffsetForFixedPosition(), that computes
+        the constrained viewport.
+        * page/FrameView.h:
+        * page/Page.cpp:
+        (WebCore::Page::setPageScaleFactor): When scrolling (and, by implication, zooming)
+        is delegated, then setPageScaleFactor() should not affect the scroll position.
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): Go back to just
+        passing the visibleContentRect() for iOS.
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::viewportChangedViaDelegatedScrolling): Entrypoint to
+        the scrolling tree, called when the viewport is changed by zooming.
+        * page/scrolling/ScrollingTree.h:
+        * page/scrolling/ScrollingTreeScrollingNode.h:
+        * page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h:
+        * page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm:
+        (WebCore::ScrollingTreeScrollingNodeIOS::setScrollLayerPosition): Use the
+        new FrameView::rectForViewportConstrainedObjects() to compute the correct viewport
+        for fixed/sticky child nodes.
+        (WebCore::ScrollingTreeScrollingNodeIOS::updateForViewport):
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeScrollingNodeMac::updateForViewport):
+
</ins><span class="cx"> 2014-03-14  Dirk Schulze  &lt;krit@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Refactor Path to Path2D and remove currentPath
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -806,6 +806,7 @@
</span><span class="cx"> __ZN7WebCore19TextResourceDecoder6decodeEPKcm
</span><span class="cx"> __ZN7WebCore19TextResourceDecoderC1ERKN3WTF6StringERKNS_12TextEncodingEb
</span><span class="cx"> __ZN7WebCore19TextResourceDecoderD1Ev
</span><ins>+__ZN7WebCore19enclosingLayoutRectERKNS_9FloatRectE
</ins><span class="cx"> __ZN7WebCore19getFileCreationTimeERKN3WTF6StringERl
</span><span class="cx"> __ZN7WebCore19toInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE
</span><span class="cx"> __ZN7WebCore20CachedResourceLoader31garbageCollectDocumentResourcesEv
</span><span class="lines">@@ -2613,6 +2614,7 @@
</span><span class="cx"> __ZN7WebCore9FrameView24renderedCharactersExceedEj
</span><span class="cx"> __ZN7WebCore9FrameView30graphicsLayerForPlatformWidgetEP7WAKView
</span><span class="cx"> __ZN7WebCore9FrameView32setCustomFixedPositionLayoutRectERKNS_7IntRectE
</span><ins>+__ZN7WebCore9FrameView33rectForViewportConstrainedObjectsERKNS_10LayoutRectERKNS_10LayoutSizeEfbNS_30ScrollBehaviorForFixedElementsE
</ins><span class="cx"> __ZN7WebCore9FrameView35setUseCustomFixedPositionLayoutRectEb
</span><span class="cx"> __ZN7WebCore9FrameView36scheduleLayerFlushAllowingThrottlingEv
</span><span class="cx"> __ZN7WebCore9PageGroup17removeVisitedLinkERKNS_3URLE
</span><span class="lines">@@ -2721,8 +2723,8 @@
</span><span class="cx"> __ZN7WebCore13ScrollingTree31willWheelEventStartSwipeGestureERKNS_18PlatformWheelEventE
</span><span class="cx"> __ZN7WebCore13ScrollingTree32isPointInNonFastScrollableRegionENS_8IntPointE
</span><span class="cx"> __ZN7WebCore13ScrollingTree35shouldHandleWheelEventSynchronouslyERKNS_18PlatformWheelEventE
</span><ins>+__ZN7WebCore13ScrollingTree36viewportChangedViaDelegatedScrollingEyRKNS_9FloatRectEd
</ins><span class="cx"> __ZN7WebCore13ScrollingTree37setScrollingPerformanceLoggingEnabledEb
</span><del>-__ZN7WebCore13ScrollingTree42scrollPositionChangedViaDelegatedScrollingEyRKNS_10FloatPointE
</del><span class="cx"> __ZN7WebCore13ScrollingTreeC2Ev
</span><span class="cx"> __ZN7WebCore13ScrollingTreeD1Ev
</span><span class="cx"> __ZN7WebCore13ScrollingTreeD2Ev
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/FrameView.cpp        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -1584,6 +1584,53 @@
</span><span class="cx">     return scrollOffsetForFixedPosition(visibleContentRect, totalContentsSize, scrollPosition, scrollOrigin, frameScaleFactor, fixedElementsLayoutRelativeToFrame(), behaviorForFixed, headerHeight(), footerHeight());
</span><span class="cx"> }
</span><span class="cx">     
</span><ins>+#if PLATFORM(IOS)
+LayoutRect FrameView::rectForViewportConstrainedObjects(const LayoutRect&amp; visibleContentRect, const LayoutSize&amp; totalContentsSize, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements scrollBehavior)
+{
+    if (fixedElementsLayoutRelativeToFrame)
+        return visibleContentRect;
+    
+    // We impose an lower limit on the size (so an upper limit on the scale) of
+    // the rect used to position fixed objects so that they don't crowd into the
+    // center of the screen at larger scales.
+    const float constraintThresholdScale = 1.2;
+
+    float maxPostionedObjectsRectScale = std::min(frameScaleFactor, constraintThresholdScale);
+
+    LayoutRect viewportConstrainedObjectsRect = visibleContentRect;
+
+    if (frameScaleFactor &gt; constraintThresholdScale) {
+        FloatRect contentRect(FloatPoint(), totalContentsSize);
+        FloatRect viewportRect = visibleContentRect;
+        
+        // Scale the rect up from a point that is relative to its position in the viewport.
+        FloatSize sizeDelta = contentRect.size() - viewportRect.size();
+
+        FloatPoint scaleOrigin;
+        scaleOrigin.setX(contentRect.x() + sizeDelta.width() &gt; 0 ? contentRect.width() * (viewportRect.x() - contentRect.x()) / sizeDelta.width() : 0);
+        scaleOrigin.setY(contentRect.y() + sizeDelta.height() &gt; 0 ? contentRect.height() * (viewportRect.y() - contentRect.y()) / sizeDelta.height() : 0);
+        
+        AffineTransform rescaleTransform = AffineTransform::translation(scaleOrigin.x(), scaleOrigin.y());
+        rescaleTransform.scale(frameScaleFactor / maxPostionedObjectsRectScale, frameScaleFactor / maxPostionedObjectsRectScale);
+        rescaleTransform = CGAffineTransformTranslate(rescaleTransform, -scaleOrigin.x(), -scaleOrigin.y());
+
+        viewportConstrainedObjectsRect = enclosingLayoutRect(rescaleTransform.mapRect(visibleContentRect));
+    }
+    
+    if (scrollBehavior == StickToDocumentBounds) {
+        LayoutRect documentBounds(LayoutPoint(), totalContentsSize);
+        viewportConstrainedObjectsRect.intersect(documentBounds);
+    }
+
+    return viewportConstrainedObjectsRect;
+}
+    
+LayoutRect FrameView::viewportConstrainedObjectsRect() const
+{
+    return rectForViewportConstrainedObjects(visibleContentRect(), totalContentsSize(), frame().frameScaleFactor(), fixedElementsLayoutRelativeToFrame(), scrollBehaviorForFixedElements());
+}
+#endif
+    
</ins><span class="cx"> IntPoint FrameView::minimumScrollPosition() const
</span><span class="cx"> {
</span><span class="cx">     IntPoint minimumPosition(ScrollView::minimumScrollPosition());
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.h        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/FrameView.h        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -265,7 +265,13 @@
</span><span class="cx">     LayoutSize scrollOffsetForFixedPosition() const;
</span><span class="cx">     // Static function can be called from another thread.
</span><span class="cx">     static LayoutSize scrollOffsetForFixedPosition(const LayoutRect&amp; visibleContentRect, const LayoutSize&amp; totalContentsSize, const LayoutPoint&amp; scrollPosition, const LayoutPoint&amp; scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements, int headerHeight, int footerHeight);
</span><del>-
</del><ins>+    
+#if PLATFORM(IOS)
+    LayoutRect viewportConstrainedObjectsRect() const;
+    // Static function can be called from another thread.
+    static LayoutRect rectForViewportConstrainedObjects(const LayoutRect&amp; visibleContentRect, const LayoutSize&amp; totalContentsSize, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame, ScrollBehaviorForFixedElements);
+#endif
+    
</ins><span class="cx">     bool fixedElementsLayoutRelativeToFrame() const;
</span><span class="cx"> 
</span><span class="cx">     void disableLayerFlushThrottlingTemporarilyForInteraction();
</span></span></pre></div>
<a id="trunkSourceWebCorepagePagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Page.cpp (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Page.cpp        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/Page.cpp        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -723,7 +723,9 @@
</span><span class="cx">     if (view &amp;&amp; view-&gt;scrollPosition() != origin) {
</span><span class="cx">         if (!m_settings-&gt;delegatesPageScaling() &amp;&amp; document-&gt;renderView() &amp;&amp; document-&gt;renderView()-&gt;needsLayout() &amp;&amp; view-&gt;didFirstLayout())
</span><span class="cx">             view-&gt;layout();
</span><del>-        view-&gt;setScrollPosition(origin);
</del><ins>+        
+        if (!view-&gt;delegatesScrolling())
+            view-&gt;setScrollPosition(origin);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingAsyncScrollingCoordinatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -89,11 +89,7 @@
</span><span class="cx">     node-&gt;setFooterHeight(frameView-&gt;footerHeight());
</span><span class="cx"> 
</span><span class="cx">     node-&gt;setScrollOrigin(frameView-&gt;scrollOrigin());
</span><del>-#if PLATFORM(IOS)
-    node-&gt;setViewportSize(frameView-&gt;viewportConstrainedVisibleContentRect().size());
-#else
</del><span class="cx">     node-&gt;setViewportSize(frameView-&gt;visibleContentRect().size());
</span><del>-#endif
</del><span class="cx">     node-&gt;setTotalContentsSize(frameView-&gt;totalContentsSize());
</span><span class="cx"> 
</span><span class="cx">     ScrollableAreaParameters scrollParameters;
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -98,7 +98,7 @@
</span><span class="cx">         m_rootNode-&gt;handleWheelEvent(wheelEvent);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ScrollingTree::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const FloatPoint&amp; scrollPosition)
</del><ins>+void ScrollingTree::viewportChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const WebCore::FloatRect&amp; viewportRect, double scale)
</ins><span class="cx"> {
</span><span class="cx">     ScrollingTreeNode* node = nodeForID(nodeID);
</span><span class="cx">     if (!node)
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx">     if (node-&gt;nodeType() != ScrollingNode)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    toScrollingTreeScrollingNode(node)-&gt;setScrollPositionWithoutContentEdgeConstraints(scrollPosition);
</del><ins>+    toScrollingTreeScrollingNode(node)-&gt;updateForViewport(viewportRect, scale);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ScrollingTree::commitNewTreeState(PassOwnPtr&lt;ScrollingStateTree&gt; scrollingStateTree)
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">     virtual EventResult tryToHandleWheelEvent(const PlatformWheelEvent&amp;) = 0;
</span><span class="cx">     bool shouldHandleWheelEventSynchronously(const PlatformWheelEvent&amp;);
</span><span class="cx">     
</span><del>-    virtual void scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID, const FloatPoint&amp;);
</del><ins>+    virtual void viewportChangedViaDelegatedScrolling(ScrollingNodeID, const WebCore::FloatRect&amp; viewportRect, double scale);
</ins><span class="cx"> 
</span><span class="cx">     void setMainFrameIsRubberBanding(bool);
</span><span class="cx">     bool isRubberBandInProgress();
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingScrollingTreeScrollingNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -52,7 +52,8 @@
</span><span class="cx">     virtual void handleWheelEvent(const PlatformWheelEvent&amp;) = 0;
</span><span class="cx">     virtual void setScrollPosition(const FloatPoint&amp;) = 0;
</span><span class="cx">     virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&amp;) = 0;
</span><del>-
</del><ins>+    virtual void updateForViewport(const FloatRect&amp; viewportRect, double scale) = 0;
+    
</ins><span class="cx">     SynchronousScrollingReasons synchronousScrollingReasons() const { return m_synchronousScrollingReasons; }
</span><span class="cx">     bool shouldUpdateScrollLayerPositionSynchronously() const { return m_synchronousScrollingReasons; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingiosScrollingTreeScrollingNodeIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.h        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx">     FloatPoint scrollPosition() const;
</span><span class="cx">     virtual void setScrollPosition(const FloatPoint&amp;) override;
</span><span class="cx">     virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&amp;) override;
</span><ins>+    virtual void updateForViewport(const FloatRect&amp; viewportRect, double scale);
</ins><span class="cx"> 
</span><span class="cx">     void setScrollLayerPosition(const FloatPoint&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingiosScrollingTreeScrollingNodeIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/scrolling/ios/ScrollingTreeScrollingNodeIOS.mm        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -160,12 +160,26 @@
</span><span class="cx">     
</span><span class="cx">     if (!m_children)
</span><span class="cx">         return;
</span><ins>+    
+    viewportRect.setLocation(scrollOffset);
+    
+    FloatRect viewportConstrainedObjectsRect = FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(viewportRect), 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;parentScrollPositionDidChange(viewportConstrainedObjectsRect, FloatSize());
+}
</ins><span class="cx"> 
</span><del>-    viewportRect.setLocation(FloatPoint() + scrollOffsetForFixedChildren);
</del><ins>+void ScrollingTreeScrollingNodeIOS::updateForViewport(const FloatRect&amp; viewportRect, double scale)
+{
+    if (!m_children)
+        return;
</ins><span class="cx"> 
</span><ins>+    FloatRect viewportConstrainedObjectsRect = FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(viewportRect), totalContentsSize(), scale, false, scrollBehaviorForFixedElements());
+
</ins><span class="cx">     size_t size = m_children-&gt;size();
</span><span class="cx">     for (size_t i = 0; i &lt; size; ++i)
</span><del>-        m_children-&gt;at(i)-&gt;parentScrollPositionDidChange(viewportRect, FloatSize());
</del><ins>+        m_children-&gt;at(i)-&gt;parentScrollPositionDidChange(viewportConstrainedObjectsRect, FloatSize());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FloatPoint ScrollingTreeScrollingNodeIOS::minimumScrollPosition() const
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeScrollingNodeMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -68,6 +68,7 @@
</span><span class="cx">     FloatPoint scrollPosition() const;
</span><span class="cx">     virtual void setScrollPosition(const FloatPoint&amp;) override;
</span><span class="cx">     virtual void setScrollPositionWithoutContentEdgeConstraints(const FloatPoint&amp;) override;
</span><ins>+    virtual void updateForViewport(const FloatRect&amp; viewportRect, double scale) override;
</ins><span class="cx"> 
</span><span class="cx">     void setScrollLayerPosition(const FloatPoint&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepagescrollingmacScrollingTreeScrollingNodeMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -400,6 +400,23 @@
</span><span class="cx">         m_children-&gt;at(i)-&gt;parentScrollPositionDidChange(viewportRect, FloatSize());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScrollingTreeScrollingNodeMac::updateForViewport(const FloatRect&amp; viewportRect, double scale)
+{
+    // FIXME: correctly handle updates for zooming.
+    UNUSED_PARAM(scale);
+    FloatPoint scrollPosition = viewportRect.location();
+    updateMainFramePinState(scrollPosition);
+
+    if (shouldUpdateScrollLayerPositionSynchronously()) {
+        m_probableMainThreadScrollPosition = scrollPosition;
+        scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition, SetScrollingLayerPosition);
+        return;
+    }
+
+    setScrollLayerPosition(scrollPosition);
+    scrollingTree().scrollingTreeNodeDidScroll(scrollingNodeID(), scrollPosition);
+}
+
</ins><span class="cx"> FloatPoint ScrollingTreeScrollingNodeMac::minimumScrollPosition() const
</span><span class="cx"> {
</span><span class="cx">     IntPoint position;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebKit2/ChangeLog        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2014-03-14  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Improve behavior of fixed elments on zooming
+        https://bugs.webkit.org/show_bug.cgi?id=130253
+
+        Reviewed by Beth Dakin.
+
+        Correctly reposition right- and bottom-relative position:fixed
+        elements on zooming in WK2 iOS by telling the scrolling tree
+        about zoom-related viewport changes.
+
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::notePropertiesChanged):
+        Drive-by cleanup; typedef the flags field to an unsigned, to avoid ugly casting.
+        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp:
+        (WebKit::RemoteScrollingCoordinatorProxy::updateScrollingTree): Pass out a flag to say
+        if the update contained a new fixed or sticky layer.
+        (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
+        (WebKit::RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling):
+        Call into the new ScrolingTree::viewportChangedViaDelegatedScrolling().
+        * UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h:
+        * UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm: If we got a new fixed
+        or sticky layer, set fixedOrStickyLayerChanged to true.
+        (WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers): Ditto.
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView didUpdateVisibleRect:unobscuredRect:scale:inStableState:]):
+        Remember both the old zoomScale and the filteredScale, since the fixed position rect
+        should be computed using the unfiltered scale.
+        Some FloatRect -&gt; CGRect changes.
+        Now call viewportChangedViaDelegatedScrolling() on the scrolling coordinator.
+        (-[WKContentView fixedPositionRectFromExposedRect:scale:]): Call the
+        FrameView function to compute the iOS fixed position rect.
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree): If the update
+        got a new fixed or sticky layer, run the scrolling tree logic to make sure
+        it gets into the right place.
+        * UIProcess/mac/RemoteLayerTreeHost.mm:
+        (WebKit::RemoteLayerTreeHost::updateLayerTree): If we logged here,
+        we'd log twice if the tiled scrolling indicator was enabled, so 
+        hoisted the logging out into the caller.
+
</ins><span class="cx"> 2014-03-14  Landry Breuil  &lt;landry@openbsd.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Use the correct type in webkitSoupRequestInputStreamNew()'s declaration.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> 
</span><span class="cx"> class RemoteLayerTreeTransaction {
</span><span class="cx"> public:
</span><del>-    enum LayerChange {
</del><ins>+    enum LayerChanges {
</ins><span class="cx">         NoChange = 0,
</span><span class="cx">         NameChanged = 1 &lt;&lt; 1,
</span><span class="cx">         ChildrenChanged = 1 &lt;&lt; 2,
</span><span class="lines">@@ -77,6 +77,7 @@
</span><span class="cx">         EdgeAntialiasingMaskChanged = 1 &lt;&lt; 26,
</span><span class="cx">         CustomAppearanceChanged = 1 &lt;&lt; 27
</span><span class="cx">     };
</span><ins>+    typedef unsigned LayerChange;
</ins><span class="cx"> 
</span><span class="cx">     struct LayerCreationProperties {
</span><span class="cx">         LayerCreationProperties();
</span><span class="lines">@@ -97,10 +98,10 @@
</span><span class="cx">         void encode(IPC::ArgumentEncoder&amp;) const;
</span><span class="cx">         static bool decode(IPC::ArgumentDecoder&amp;, LayerProperties&amp;);
</span><span class="cx"> 
</span><del>-        void notePropertiesChanged(LayerChange layerChanges)
</del><ins>+        void notePropertiesChanged(LayerChange changeFlags)
</ins><span class="cx">         {
</span><del>-            changedProperties = static_cast&lt;LayerChange&gt;(changedProperties | layerChanges);
-            everChangedProperties = static_cast&lt;LayerChange&gt;(everChangedProperties | layerChanges);
</del><ins>+            changedProperties |= changeFlags;
+            everChangedProperties |= changeFlags;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         LayerChange changedProperties;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.cpp        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -75,7 +75,7 @@
</span><span class="cx">     return &amp;remoteDrawingArea-&gt;remoteLayerTreeHost();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteScrollingCoordinatorProxy::updateScrollingTree(const RemoteScrollingCoordinatorTransaction&amp; transaction)
</del><ins>+void RemoteScrollingCoordinatorProxy::updateScrollingTree(const RemoteScrollingCoordinatorTransaction&amp; transaction, bool&amp; fixedOrStickyLayerChanged)
</ins><span class="cx"> {
</span><span class="cx">     OwnPtr&lt;ScrollingStateTree&gt; stateTree = const_cast&lt;RemoteScrollingCoordinatorTransaction&amp;&gt;(transaction).scrollingStateTree().release();
</span><span class="cx">     
</span><span class="lines">@@ -84,13 +84,13 @@
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    
-    connectStateNodeLayers(*stateTree, *layerTreeHost);
</del><ins>+
+    connectStateNodeLayers(*stateTree, *layerTreeHost, fixedOrStickyLayerChanged);
</ins><span class="cx">     m_scrollingTree-&gt;commitNewTreeState(stateTree.release());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS)
</span><del>-void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree&amp; stateTree, const RemoteLayerTreeHost&amp; layerTreeHost)
</del><ins>+void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree&amp; stateTree, const RemoteLayerTreeHost&amp; layerTreeHost, bool&amp; fixedOrStickyLayerChanged)
</ins><span class="cx"> {
</span><span class="cx">     for (auto&amp; currNode : stateTree.nodeMap().values()) {
</span><span class="cx">         switch (currNode-&gt;nodeType()) {
</span><span class="lines">@@ -115,12 +115,16 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FixedNode:
</span><del>-            if (currNode-&gt;hasChangedProperty(ScrollingStateNode::ScrollLayer))
</del><ins>+            if (currNode-&gt;hasChangedProperty(ScrollingStateNode::ScrollLayer)) {
</ins><span class="cx">                 currNode-&gt;setLayer(layerTreeHost.getLayer(currNode-&gt;layer()));
</span><ins>+                fixedOrStickyLayerChanged = true;
+            }
</ins><span class="cx">             break;
</span><span class="cx">         case StickyNode:
</span><del>-            if (currNode-&gt;hasChangedProperty(ScrollingStateNode::ScrollLayer))
</del><ins>+            if (currNode-&gt;hasChangedProperty(ScrollingStateNode::ScrollLayer)) {
</ins><span class="cx">                 currNode-&gt;setLayer(layerTreeHost.getLayer(currNode-&gt;layer()));
</span><ins>+                fixedOrStickyLayerChanged = true;
+            }
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -138,9 +142,9 @@
</span><span class="cx">     return m_scrollingTree-&gt;isPointInNonFastScrollableRegion(p);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteScrollingCoordinatorProxy::scrollPositionChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const FloatPoint&amp; offset)
</del><ins>+void RemoteScrollingCoordinatorProxy::viewportChangedViaDelegatedScrolling(ScrollingNodeID nodeID, const WebCore::FloatRect&amp; viewportRect, double scale)
</ins><span class="cx"> {
</span><del>-    m_scrollingTree-&gt;scrollPositionChangedViaDelegatedScrolling(nodeID, offset);
</del><ins>+    m_scrollingTree-&gt;viewportChangedViaDelegatedScrolling(nodeID, viewportRect, scale);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // This comes from the scrolling tree.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessScrollingRemoteScrollingCoordinatorProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebKit2/UIProcess/Scrolling/RemoteScrollingCoordinatorProxy.h        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx">     bool isPointInNonFastScrollableRegion(const WebCore::IntPoint&amp;) const;
</span><span class="cx"> 
</span><span class="cx">     // Called externally when native views move around.
</span><del>-    void scrollPositionChangedViaDelegatedScrolling(WebCore::ScrollingNodeID, const WebCore::FloatPoint&amp;);
</del><ins>+    void viewportChangedViaDelegatedScrolling(WebCore::ScrollingNodeID, const WebCore::FloatRect&amp; viewportRect, double scale);
</ins><span class="cx"> 
</span><span class="cx">     // FIXME: expose the tree and pass this to that?
</span><span class="cx">     bool handleWheelEvent(const WebCore::PlatformWheelEvent&amp;);
</span><span class="lines">@@ -66,10 +66,10 @@
</span><span class="cx"> 
</span><span class="cx">     const RemoteLayerTreeHost* layerTreeHost() const;
</span><span class="cx"> 
</span><del>-    void updateScrollingTree(const RemoteScrollingCoordinatorTransaction&amp;);
</del><ins>+    void updateScrollingTree(const RemoteScrollingCoordinatorTransaction&amp;, bool&amp; fixedOrStickyLayerChanged);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    void connectStateNodeLayers(WebCore::ScrollingStateTree&amp;, const RemoteLayerTreeHost&amp;);
</del><ins>+    void connectStateNodeLayers(WebCore::ScrollingStateTree&amp;, const RemoteLayerTreeHost&amp;, bool&amp; fixedOrStickyLayerChanged);
</ins><span class="cx"> 
</span><span class="cx">     WebPageProxy&amp; m_webPageProxy;
</span><span class="cx">     RefPtr&lt;RemoteScrollingTree&gt; m_scrollingTree;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosRemoteScrollingCoordinatorProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebKit2/UIProcess/ios/RemoteScrollingCoordinatorProxyIOS.mm        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">     return LayerRepresentation(layerOrView.layer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree&amp; stateTree, const RemoteLayerTreeHost&amp; layerTreeHost)
</del><ins>+void RemoteScrollingCoordinatorProxy::connectStateNodeLayers(ScrollingStateTree&amp; stateTree, const RemoteLayerTreeHost&amp; layerTreeHost, bool&amp; fixedOrStickyLayerChanged)
</ins><span class="cx"> {
</span><span class="cx">     for (auto&amp; currNode : stateTree.nodeMap().values()) {
</span><span class="cx">         switch (currNode-&gt;nodeType()) {
</span><span class="lines">@@ -68,12 +68,16 @@
</span><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">         case FixedNode:
</span><del>-            if (currNode-&gt;hasChangedProperty(ScrollingStateNode::ScrollLayer))
</del><ins>+            if (currNode-&gt;hasChangedProperty(ScrollingStateNode::ScrollLayer)) {
</ins><span class="cx">                 currNode-&gt;setLayer(layerRepresentationFromLayerOrView(layerTreeHost.getLayer(currNode-&gt;layer())));
</span><ins>+                fixedOrStickyLayerChanged = true;
+            }
</ins><span class="cx">             break;
</span><span class="cx">         case StickyNode:
</span><del>-            if (currNode-&gt;hasChangedProperty(ScrollingStateNode::ScrollLayer))
</del><ins>+            if (currNode-&gt;hasChangedProperty(ScrollingStateNode::ScrollLayer)) {
</ins><span class="cx">                 currNode-&gt;setLayer(layerRepresentationFromLayerOrView(layerTreeHost.getLayer(currNode-&gt;layer())));
</span><ins>+                fixedOrStickyLayerChanged = true;
+            }
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> #import &quot;WebPageGroup.h&quot;
</span><span class="cx"> #import &quot;WebSystemInterface.h&quot;
</span><span class="cx"> #import &quot;WebKitSystemInterfaceIOS.h&quot;
</span><ins>+#import &lt;WebCore/FrameView.h&gt;
</ins><span class="cx"> #import &lt;UIKit/UIWindow_Private.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -163,20 +164,21 @@
</span><span class="cx">     return [self isEditable];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect scale:(CGFloat)scale inStableState:(BOOL)isStableState
</del><ins>+- (void)didUpdateVisibleRect:(CGRect)visibleRect unobscuredRect:(CGRect)unobscuredRect scale:(CGFloat)zoomScale inStableState:(BOOL)isStableState
</ins><span class="cx"> {
</span><span class="cx">     double scaleNoiseThreshold = 0.0005;
</span><del>-    if (!isStableState &amp;&amp; fabs(scale - _page-&gt;displayedContentScale()) &lt; scaleNoiseThreshold) {
</del><ins>+    CGFloat filteredScale = zoomScale;
+    if (!isStableState &amp;&amp; fabs(filteredScale - _page-&gt;displayedContentScale()) &lt; scaleNoiseThreshold) {
</ins><span class="cx">         // Tiny changes of scale during interactive zoom cause content to jump by one pixel, creating
</span><span class="cx">         // visual noise. We filter those useless updates.
</span><del>-        scale = _page-&gt;displayedContentScale();
</del><ins>+        filteredScale = _page-&gt;displayedContentScale();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    FloatRect fixedPosRect = [self fixedPositionRectFromExposedRect:unobscuredRect scale:scale];
-    _page-&gt;updateVisibleContentRects(VisibleContentRectUpdateInfo(_page-&gt;nextVisibleContentRectUpdateID(), visibleRect, unobscuredRect, fixedPosRect, scale, isStableState));
-
</del><ins>+    CGRect customFixedPositionRect = [self fixedPositionRectFromExposedRect:unobscuredRect scale:zoomScale];
+    _page-&gt;updateVisibleContentRects(VisibleContentRectUpdateInfo(_page-&gt;nextVisibleContentRectUpdateID(), visibleRect, unobscuredRect, customFixedPositionRect, filteredScale, isStableState));
+    
</ins><span class="cx">     RemoteScrollingCoordinatorProxy* scrollingCoordinator = _page-&gt;scrollingCoordinatorProxy();
</span><del>-    scrollingCoordinator-&gt;scrollPositionChangedViaDelegatedScrolling(scrollingCoordinator-&gt;rootScrollingNodeID(), unobscuredRect.origin);
</del><ins>+    scrollingCoordinator-&gt;viewportChangedViaDelegatedScrolling(scrollingCoordinator-&gt;rootScrollingNodeID(), unobscuredRect, zoomScale);
</ins><span class="cx"> 
</span><span class="cx">     if (auto drawingArea = _page-&gt;drawingArea())
</span><span class="cx">         drawingArea-&gt;updateDebugIndicator();
</span><span class="lines">@@ -187,11 +189,9 @@
</span><span class="cx">     _page-&gt;drawingArea()-&gt;setSize(IntSize(size), IntSize(), IntSize());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (FloatRect)fixedPositionRectFromExposedRect:(FloatRect)exposedRect scale:(float)scale
</del><ins>+- (CGRect)fixedPositionRectFromExposedRect:(CGRect)unobscuredRect scale:(CGFloat)scale
</ins><span class="cx"> {
</span><del>-    // FIXME: This should modify the rect based on the scale.
-    UNUSED_PARAM(scale);
-    return exposedRect;
</del><ins>+    return (FloatRect)FrameView::rectForViewportConstrainedObjects(enclosingLayoutRect(unobscuredRect), roundedLayoutSize(FloatSize([self bounds].size)), scale, false, StickToViewportBounds);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)setMinimumLayoutSize:(CGSize)size
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #import &quot;config.h&quot;
</span><span class="cx"> #import &quot;RemoteLayerTreeDrawingAreaProxy.h&quot;
</span><span class="cx"> 
</span><ins>+#import &quot;Logging.h&quot;
</ins><span class="cx"> #import &quot;RemoteLayerTreeDrawingAreaProxyMessages.h&quot;
</span><span class="cx"> #import &quot;DrawingAreaMessages.h&quot;
</span><span class="cx"> #import &quot;RemoteScrollingCoordinatorProxy.h&quot;
</span><span class="lines">@@ -100,15 +101,25 @@
</span><span class="cx"> 
</span><span class="cx"> void RemoteLayerTreeDrawingAreaProxy::commitLayerTree(const RemoteLayerTreeTransaction&amp; layerTreeTransaction, const RemoteScrollingCoordinatorTransaction&amp; scrollingTreeTransaction)
</span><span class="cx"> {
</span><ins>+    LOG(RemoteLayerTree, &quot;%s&quot;, layerTreeTransaction.description().data());
+
</ins><span class="cx">     if (m_remoteLayerTreeHost.updateLayerTree(layerTreeTransaction))
</span><span class="cx">         m_webPageProxy-&gt;setAcceleratedCompositingRootLayer(m_remoteLayerTreeHost.rootLayer());
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><del>-    m_webPageProxy-&gt;scrollingCoordinatorProxy()-&gt;updateScrollingTree(scrollingTreeTransaction);
</del><ins>+    bool fixedOrStickyLayerChanged = false;
+    m_webPageProxy-&gt;scrollingCoordinatorProxy()-&gt;updateScrollingTree(scrollingTreeTransaction, fixedOrStickyLayerChanged);
</ins><span class="cx"> #endif
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     m_webPageProxy-&gt;didCommitLayerTree(layerTreeTransaction);
</span><ins>+
+#if ENABLE(ASYNC_SCROLLING)
+    if (fixedOrStickyLayerChanged) {
+        // If we got a new layer for a fixed or sticky node, its position from the WebProcess is probably stale. We need to re-run the &quot;viewport&quot; changed logic to udpate it with our UI-side state.
+        m_webPageProxy-&gt;scrollingCoordinatorProxy()-&gt;viewportChangedViaDelegatedScrolling(m_webPageProxy-&gt;scrollingCoordinatorProxy()-&gt;rootScrollingNodeID(), m_webPageProxy-&gt;unobscuredContentRect(), m_webPageProxy-&gt;displayedContentScale());
+    }
</ins><span class="cx"> #endif
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     showDebugIndicator(m_webPageProxy-&gt;preferences().tiledScrollingIndicatorVisible());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeHostmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm (165651 => 165652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm        2014-03-14 21:43:26 UTC (rev 165651)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeHost.mm        2014-03-14 21:50:57 UTC (rev 165652)
</span><span class="lines">@@ -26,7 +26,6 @@
</span><span class="cx"> #import &quot;config.h&quot;
</span><span class="cx"> #import &quot;RemoteLayerTreeHost.h&quot;
</span><span class="cx"> 
</span><del>-#import &quot;Logging.h&quot;
</del><span class="cx"> #import &quot;RemoteLayerTreePropertyApplier.h&quot;
</span><span class="cx"> #import &quot;RemoteLayerTreeTransaction.h&quot;
</span><span class="cx"> #import &quot;ShareableBitmap.h&quot;
</span><span class="lines">@@ -54,8 +53,6 @@
</span><span class="cx"> 
</span><span class="cx"> bool RemoteLayerTreeHost::updateLayerTree(const RemoteLayerTreeTransaction&amp; transaction, float indicatorScaleFactor)
</span><span class="cx"> {
</span><del>-    LOG(RemoteLayerTree, &quot;%s&quot;, transaction.description().data());
-
</del><span class="cx">     for (const auto&amp; createdLayer : transaction.createdLayers())
</span><span class="cx">         createLayer(createdLayer);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>