<!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>[198455] 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/198455">198455</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-03-18 17:00:46 -0700 (Fri, 18 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Sideways-scrollable RTL document has wrong initial and reload offset in WKWebView
https://bugs.webkit.org/show_bug.cgi?id=155660
Source/WebCore:

rdar://problem/22212662

Reviewed by Tim Horton.

There were two problems with the scroll position of RTL documents on initial and reload
in WKWebView.

First, in the delegatesScrolling() code path, ScrollView::updateScrollbars() needs to
tell someone that the scroll origin changed, to trigger a scroll to the page origin.

Secondly, WKWebView had scrollPosition/scrollOffset confusion in various places.

Test: fast/scrolling/rtl-initial-scroll-position.html

* platform/ScrollView.cpp:
(WebCore::ScrollView::updateScrollbars):

Source/WebKit2:

Reviewed by Tim Horton.

There were two problems with the scroll position of RTL documents on initial and reload
in WKWebView.

First, in the delegatesScrolling() code path, ScrollView::updateScrollbars() needs to
tell someone that the scroll origin changed, to trigger a scroll to the page origin.

Secondly, WKWebView had scrollPosition/scrollOffset confusion in various places. In
the restorePageState() code path, WebCore passes an exposedRect; this patch makes
it explicit that it's an exposedContentRect, and passes scrollOrigin so that it can
be mapped into scrollOffset-relative coordinates that the UIScrollView wants.

When reloading an RTL page, there was an additional issue; restorePageState()
restored the exposedRect, but then we'd see the origin change as a programmatic scroll
to 0,0, clobbering the exposedRect. Fix by using a &quot;_commitDidRestoreExposedRect&quot; flag
on the WKWebView that is used to ignore the programmatic scroll in that case.

Ideally these changes would fix fast/scrolling/scroll-position-on-reload-rtl.html, but the
test still fails because of timing differences between OS X and iOS.

* UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _didCommitLayerTree:]):
(-[WKWebView _layerTreeCommitComplete]):
(-[WKWebView _restorePageStateToExposedRect:scrollOrigin:scale:]):
(-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]):
(-[WKWebView _restorePageStateToExposedRect:scale:]): Deleted.
(-[WKWebView _scrollToContentOffset:scrollOrigin:]): Deleted.
* UIProcess/API/Cocoa/WKWebViewInternal.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* UIProcess/ios/PageClientImplIOS.h:
* UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::requestScroll):
(WebKit::PageClientImpl::layerTreeCommitComplete):
(WebKit::PageClientImpl::restorePageState):
* UIProcess/ios/WKContentView.h:
* UIProcess/ios/WKContentView.mm:
(-[WKContentView _layerTreeCommitComplete]):
* UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::layerTreeCommitComplete):
(WebKit::WebPageProxy::restorePageState):
* UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::restorePageState):

LayoutTests:

Reviewed by Tim Horton.

Test for initial scroll position in an RTL page.

* fast/scrolling/rtl-initial-scroll-position-expected.html: Added.
* fast/scrolling/rtl-initial-scroll-position.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="#trunkSourceWebCoreplatformScrollViewcpp">trunk/Source/WebCore/platform/ScrollView.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh">trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSh">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosPageClientImplIOSmm">trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewh">trunk/Source/WebKit2/UIProcess/ios/WKContentView.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWKContentViewmm">trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxymm">trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastscrollingrtlinitialscrollpositionexpectedhtml">trunk/LayoutTests/fast/scrolling/rtl-initial-scroll-position-expected.html</a></li>
<li><a href="#trunkLayoutTestsfastscrollingrtlinitialscrollpositionhtml">trunk/LayoutTests/fast/scrolling/rtl-initial-scroll-position.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/LayoutTests/ChangeLog        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2016-03-18  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Sideways-scrollable RTL document has wrong initial and reload offset in WKWebView
+        https://bugs.webkit.org/show_bug.cgi?id=155660
+
+        Reviewed by Tim Horton.
+        
+        Test for initial scroll position in an RTL page.
+
+        * fast/scrolling/rtl-initial-scroll-position-expected.html: Added.
+        * fast/scrolling/rtl-initial-scroll-position.html: Added.
+
</ins><span class="cx"> 2016-03-18  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         ASSERTION FAILED: m_isValid == valid() in WebCore::HTMLFormControlElement::isValidFormControlElement
</span></span></pre></div>
<a id="trunkLayoutTestsfastscrollingrtlinitialscrollpositionexpectedhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/scrolling/rtl-initial-scroll-position-expected.html (0 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/scrolling/rtl-initial-scroll-position-expected.html                                (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-initial-scroll-position-expected.html        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            margin: 0;
+            overflow: hidden;
+        }
+        .wide {
+            width: 2000px;
+            height: 10px;
+            background-color: silver;
+        }
+        .origin {
+            position: absolute;
+            top: 0;
+            left: 0;
+            width: 100px;
+            height: 100px;
+            background-color: green;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div class=&quot;wide&quot;&gt;&lt;/div&gt;
+    &lt;div class=&quot;origin&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsfastscrollingrtlinitialscrollpositionhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/scrolling/rtl-initial-scroll-position.html (0 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/scrolling/rtl-initial-scroll-position.html                                (rev 0)
+++ trunk/LayoutTests/fast/scrolling/rtl-initial-scroll-position.html        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;html dir=&quot;rtl&quot;&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            margin: 0;
+            overflow: hidden;
+        }
+        .wide {
+            width: 2000px;
+            height: 10px;
+            background-color: silver;
+        }
+        .origin {
+            position: absolute;
+            top: 0;
+            left: 0;
+            width: 100px;
+            height: 100px;
+            background-color: green;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+    &lt;div class=&quot;wide&quot;&gt;&lt;/div&gt;
+    &lt;div class=&quot;origin&quot;&gt;&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebCore/ChangeLog        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2016-03-18  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Sideways-scrollable RTL document has wrong initial and reload offset in WKWebView
+        https://bugs.webkit.org/show_bug.cgi?id=155660
+        rdar://problem/22212662
+
+        Reviewed by Tim Horton.
+        
+        There were two problems with the scroll position of RTL documents on initial and reload
+        in WKWebView.
+
+        First, in the delegatesScrolling() code path, ScrollView::updateScrollbars() needs to
+        tell someone that the scroll origin changed, to trigger a scroll to the page origin.
+
+        Secondly, WKWebView had scrollPosition/scrollOffset confusion in various places.
+
+        Test: fast/scrolling/rtl-initial-scroll-position.html
+
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::updateScrollbars):
+
</ins><span class="cx"> 2016-03-18  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r198443.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollView.cpp (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollView.cpp        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebCore/platform/ScrollView.cpp        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -582,8 +582,16 @@
</span><span class="cx"> {
</span><span class="cx">     LOG_WITH_STREAM(Scrolling, stream &lt;&lt; &quot;ScrollView::updateScrollbars &quot; &lt;&lt; desiredPosition);
</span><span class="cx"> 
</span><del>-    if (m_inUpdateScrollbars || prohibitsScrolling() || platformWidget() || delegatesScrolling())
</del><ins>+    if (m_inUpdateScrollbars || prohibitsScrolling() || platformWidget())
</ins><span class="cx">         return;
</span><ins>+    
+    if (delegatesScrolling()) {
+        if (scrollOriginChanged()) {
+            ScrollableArea::scrollToOffsetWithoutAnimation(scrollOffsetFromPosition(desiredPosition));
+            resetScrollOriginChanged();
+        }
+        return;
+    }
</ins><span class="cx"> 
</span><span class="cx">     bool hasOverlayScrollbars = (!m_horizontalScrollbar || m_horizontalScrollbar-&gt;isOverlayScrollbar()) &amp;&amp; (!m_verticalScrollbar || m_verticalScrollbar-&gt;isOverlayScrollbar());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/ChangeLog        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2016-03-18  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Sideways-scrollable RTL document has wrong initial and reload offset in WKWebView
+        https://bugs.webkit.org/show_bug.cgi?id=155660
+
+        Reviewed by Tim Horton.
+
+        There were two problems with the scroll position of RTL documents on initial and reload
+        in WKWebView.
+
+        First, in the delegatesScrolling() code path, ScrollView::updateScrollbars() needs to
+        tell someone that the scroll origin changed, to trigger a scroll to the page origin.
+
+        Secondly, WKWebView had scrollPosition/scrollOffset confusion in various places. In
+        the restorePageState() code path, WebCore passes an exposedRect; this patch makes
+        it explicit that it's an exposedContentRect, and passes scrollOrigin so that it can
+        be mapped into scrollOffset-relative coordinates that the UIScrollView wants.
+
+        When reloading an RTL page, there was an additional issue; restorePageState()
+        restored the exposedRect, but then we'd see the origin change as a programmatic scroll
+        to 0,0, clobbering the exposedRect. Fix by using a &quot;_commitDidRestoreExposedRect&quot; flag
+        on the WKWebView that is used to ignore the programmatic scroll in that case.
+
+        Ideally these changes would fix fast/scrolling/scroll-position-on-reload-rtl.html, but the
+        test still fails because of timing differences between OS X and iOS.
+
+        * UIProcess/API/Cocoa/WKWebView.mm:
+        (-[WKWebView _didCommitLayerTree:]):
+        (-[WKWebView _layerTreeCommitComplete]):
+        (-[WKWebView _restorePageStateToExposedRect:scrollOrigin:scale:]):
+        (-[WKWebView _scrollToContentScrollPosition:scrollOrigin:]):
+        (-[WKWebView _restorePageStateToExposedRect:scale:]): Deleted.
+        (-[WKWebView _scrollToContentOffset:scrollOrigin:]): Deleted.
+        * UIProcess/API/Cocoa/WKWebViewInternal.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * UIProcess/ios/PageClientImplIOS.h:
+        * UIProcess/ios/PageClientImplIOS.mm:
+        (WebKit::PageClientImpl::requestScroll):
+        (WebKit::PageClientImpl::layerTreeCommitComplete):
+        (WebKit::PageClientImpl::restorePageState):
+        * UIProcess/ios/WKContentView.h:
+        * UIProcess/ios/WKContentView.mm:
+        (-[WKContentView _layerTreeCommitComplete]):
+        * UIProcess/ios/WebPageProxyIOS.mm:
+        (WebKit::WebPageProxy::layerTreeCommitComplete):
+        (WebKit::WebPageProxy::restorePageState):
+        * UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::restorePageState):
+
</ins><span class="cx"> 2016-03-18  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         NSURLSession: Set download resume data when a download fails due to an error.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -112,6 +112,7 @@
</span><span class="cx"> #import &lt;WebCore/FrameLoaderTypes.h&gt;
</span><span class="cx"> #import &lt;WebCore/InspectorOverlay.h&gt;
</span><span class="cx"> #import &lt;WebCore/QuartzCoreSPI.h&gt;
</span><ins>+#import &lt;WebCore/ScrollableArea.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 100000
</span><span class="cx"> #if __has_include(&lt;AccessibilitySupport.h&gt;)
</span><span class="lines">@@ -240,6 +241,7 @@
</span><span class="cx">     Optional&lt;CGRect&gt; _frozenUnobscuredContentRect;
</span><span class="cx"> 
</span><span class="cx">     BOOL _needsToRestoreExposedRect;
</span><ins>+    BOOL _commitDidRestoreExposedRect;
</ins><span class="cx">     WebCore::FloatRect _exposedRectToRestore;
</span><span class="cx">     BOOL _needsToRestoreUnobscuredCenter;
</span><span class="cx">     WebCore::FloatPoint _unobscuredCenterToRestore;
</span><span class="lines">@@ -1233,6 +1235,7 @@
</span><span class="cx">             exposedPosition.scale(_scaleToRestore, _scaleToRestore);
</span><span class="cx"> 
</span><span class="cx">             changeContentOffsetBoundedInValidRange(_scrollView.get(), exposedPosition);
</span><ins>+            _commitDidRestoreExposedRect = YES;
</ins><span class="cx">             if (_gestureController)
</span><span class="cx">                 _gestureController-&gt;didRestoreScrollPosition();
</span><span class="cx">         }
</span><span class="lines">@@ -1261,6 +1264,11 @@
</span><span class="cx">         scrollPerfData-&gt;didCommitLayerTree([self visibleRectInViewCoordinates]);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_layerTreeCommitComplete
+{
+    _commitDidRestoreExposedRect = NO;
+}
+
</ins><span class="cx"> - (void)_dynamicViewportUpdateChangedTargetToScale:(double)newScale position:(CGPoint)newScrollPosition nextValidLayerTreeTransactionID:(uint64_t)nextValidLayerTreeTransactionID
</span><span class="cx"> {
</span><span class="cx">     if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing) {
</span><span class="lines">@@ -1288,7 +1296,7 @@
</span><span class="cx">         _gestureController-&gt;didRestoreScrollPosition();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_restorePageStateToExposedRect:(WebCore::FloatRect)exposedRect scale:(double)scale
</del><ins>+- (void)_restorePageStateToExposedRect:(WebCore::FloatRect)exposedRect scrollOrigin:(WebCore::IntPoint)scrollOrigin scale:(double)scale
</ins><span class="cx"> {
</span><span class="cx">     if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing)
</span><span class="cx">         return;
</span><span class="lines">@@ -1299,6 +1307,9 @@
</span><span class="cx">     _needsToRestoreUnobscuredCenter = NO;
</span><span class="cx">     _needsToRestoreExposedRect = YES;
</span><span class="cx">     _firstTransactionIDAfterPageRestore = downcast&lt;WebKit::RemoteLayerTreeDrawingAreaProxy&gt;(*_page-&gt;drawingArea()).nextLayerTreeTransactionID();
</span><ins>+    
+    // Move the exposed rect into scrollView coordinates.
+    exposedRect.move(toFloatSize(scrollOrigin));
</ins><span class="cx">     _exposedRectToRestore = exposedRect;
</span><span class="cx">     _scaleToRestore = scale;
</span><span class="cx"> }
</span><span class="lines">@@ -1408,14 +1419,14 @@
</span><span class="cx">     return contentOffset.constrainedBetween(WebCore::FloatPoint(), WebCore::FloatPoint(maximumContentOffset));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffsetInPageCoordinates scrollOrigin:(WebCore::IntPoint)scrollOrigin
</del><ins>+- (void)_scrollToContentScrollPosition:(WebCore::FloatPoint)scrollPosition scrollOrigin:(WebCore::IntPoint)scrollOrigin
</ins><span class="cx"> {
</span><del>-    if (_dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing)
</del><ins>+    if (_commitDidRestoreExposedRect || _dynamicViewportUpdateMode != DynamicViewportUpdateMode::NotResizing)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    WebCore::FloatPoint contentOffsetRespectingOrigin = scrollOrigin + toFloatSize(contentOffsetInPageCoordinates);
</del><ins>+    WebCore::FloatPoint contentOffset = WebCore::ScrollableArea::scrollOffsetFromPosition(scrollPosition, toFloatSize(scrollOrigin));
</ins><span class="cx"> 
</span><del>-    WebCore::FloatPoint scaledOffset = contentOffsetRespectingOrigin;
</del><ins>+    WebCore::FloatPoint scaledOffset = contentOffset;
</ins><span class="cx">     CGFloat zoomScale = contentZoomScale(self);
</span><span class="cx">     scaledOffset.scale(zoomScale, zoomScale);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPICocoaWKWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/API/Cocoa/WKWebViewInternal.h        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -75,15 +75,16 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_didCommitLoadForMainFrame;
</span><span class="cx"> - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&amp;)layerTreeTransaction;
</span><ins>+- (void)_layerTreeCommitComplete;
</ins><span class="cx"> 
</span><span class="cx"> - (void)_dynamicViewportUpdateChangedTargetToScale:(double)newScale position:(CGPoint)newScrollPosition nextValidLayerTreeTransactionID:(uint64_t)nextValidLayerTreeTransactionID;
</span><span class="cx"> - (void)_couldNotRestorePageState;
</span><del>-- (void)_restorePageStateToExposedRect:(WebCore::FloatRect)exposedRect scale:(double)scale;
-- (void)_restorePageStateToUnobscuredCenter:(WebCore::FloatPoint)center scale:(double)scale;
</del><ins>+- (void)_restorePageStateToExposedRect:(WebCore::FloatRect)exposedRect scrollOrigin:(WebCore::IntPoint)scrollOrigin scale:(double)scale;
+- (void)_restorePageStateToUnobscuredCenter:(WebCore::FloatPoint)center scale:(double)scale; // FIXME: needs scroll origin?
</ins><span class="cx"> 
</span><span class="cx"> - (PassRefPtr&lt;WebKit::ViewSnapshot&gt;)_takeViewSnapshot;
</span><span class="cx"> 
</span><del>-- (void)_scrollToContentOffset:(WebCore::FloatPoint)contentOffset scrollOrigin:(WebCore::IntPoint)scrollOrigin;
</del><ins>+- (void)_scrollToContentScrollPosition:(WebCore::FloatPoint)scrollPosition scrollOrigin:(WebCore::IntPoint)scrollOrigin;
</ins><span class="cx"> - (BOOL)_scrollToRect:(WebCore::FloatRect)targetRect origin:(WebCore::FloatPoint)origin minimumScrollDistance:(float)minimumScrollDistance;
</span><span class="cx"> - (void)_scrollByContentOffset:(WebCore::FloatPoint)offset;
</span><span class="cx"> - (void)_zoomToFocusRect:(WebCore::FloatRect)focusedElementRect selectionRect:(WebCore::FloatRect)selectionRectInDocumentCoordinates fontSize:(float)fontSize minimumScale:(double)minimumScale maximumScale:(double)maximumScale allowScaling:(BOOL)allowScaling forceScroll:(BOOL)forceScroll;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -288,9 +288,11 @@
</span><span class="cx">     virtual void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&amp;, const Vector&lt;WebCore::FloatQuad&gt;&amp; highlightedQuads, const WebCore::IntSize&amp; topLeftRadius, const WebCore::IntSize&amp; topRightRadius, const WebCore::IntSize&amp; bottomLeftRadius, const WebCore::IntSize&amp; bottomRightRadius) = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual void didCommitLayerTree(const RemoteLayerTreeTransaction&amp;) = 0;
</span><ins>+    virtual void layerTreeCommitComplete() = 0;
+
</ins><span class="cx">     virtual void dynamicViewportUpdateChangedTarget(double newScale, const WebCore::FloatPoint&amp; newScrollPosition, uint64_t transactionID) = 0;
</span><span class="cx">     virtual void couldNotRestorePageState() = 0;
</span><del>-    virtual void restorePageState(const WebCore::FloatRect&amp;, double) = 0;
</del><ins>+    virtual void restorePageState(const WebCore::FloatRect&amp; exposedContentRect, const WebCore::IntPoint&amp; scrollOrigin, double scale) = 0;
</ins><span class="cx">     virtual void restorePageCenterAndScale(const WebCore::FloatPoint&amp;, double) = 0;
</span><span class="cx"> 
</span><span class="cx">     virtual void startAssistingNode(const AssistedNodeInformation&amp;, bool userIsInteracting, bool blurPreviousNode, API::Object* userData) = 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -526,6 +526,7 @@
</span><span class="cx">     void setDataDetectionResult(const DataDetectionResult&amp;);
</span><span class="cx"> #endif
</span><span class="cx">     void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&amp;);
</span><ins>+    void layerTreeCommitComplete();
</ins><span class="cx"> 
</span><span class="cx"> #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
</span><span class="cx">     void didRenderFrame(const WebCore::IntSize&amp; contentsSize, const WebCore::IntRect&amp; coveredRect);
</span><span class="lines">@@ -1406,7 +1407,7 @@
</span><span class="cx"> 
</span><span class="cx">     void dynamicViewportUpdateChangedTarget(double newTargetScale, const WebCore::FloatPoint&amp; newScrollPosition, uint64_t dynamicViewportSizeUpdateID);
</span><span class="cx">     void couldNotRestorePageState();
</span><del>-    void restorePageState(const WebCore::FloatRect&amp;, double scale);
</del><ins>+    void restorePageState(const WebCore::FloatRect&amp; exposedContentRect, const WebCore::IntPoint&amp; scrollOrigin, double scale);
</ins><span class="cx">     void restorePageCenterAndScale(const WebCore::FloatPoint&amp;, double scale);
</span><span class="cx"> 
</span><span class="cx">     void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&amp; color, const Vector&lt;WebCore::FloatQuad&gt;&amp; geometries, const WebCore::IntSize&amp; topLeftRadius, const WebCore::IntSize&amp; topRightRadius, const WebCore::IntSize&amp; bottomLeftRadius, const WebCore::IntSize&amp; bottomRightRadius);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -358,7 +358,7 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     DynamicViewportUpdateChangedTarget(double newTargetScale, WebCore::FloatPoint newScrollPosition, uint64_t dynamicViewportSizeUpdateID)
</span><span class="cx">     CouldNotRestorePageState()
</span><del>-    RestorePageState(WebCore::FloatRect exposedRect, double scale)
</del><ins>+    RestorePageState(WebCore::FloatRect exposedContentRect, WebCore::IntPoint scrollOrigin, double scale)
</ins><span class="cx">     RestorePageCenterAndScale(WebCore::FloatPoint unobscuredCenter, double scale)
</span><span class="cx">     DidGetTapHighlightGeometries(uint64_t requestID, WebCore::Color color, Vector&lt;WebCore::FloatQuad&gt; geometries, WebCore::IntSize topLeftRadius, WebCore::IntSize topRightRadius, WebCore::IntSize bottomLeftRadius, WebCore::IntSize bottomRightRadius)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.h        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -118,9 +118,11 @@
</span><span class="cx">     void didGetTapHighlightGeometries(uint64_t requestID, const WebCore::Color&amp;, const Vector&lt;WebCore::FloatQuad&gt;&amp; highlightedQuads, const WebCore::IntSize&amp; topLeftRadius, const WebCore::IntSize&amp; topRightRadius, const WebCore::IntSize&amp; bottomLeftRadius, const WebCore::IntSize&amp; bottomRightRadius) override;
</span><span class="cx"> 
</span><span class="cx">     void didCommitLayerTree(const RemoteLayerTreeTransaction&amp;) override;
</span><ins>+    void layerTreeCommitComplete() override;
+
</ins><span class="cx">     void dynamicViewportUpdateChangedTarget(double newScale, const WebCore::FloatPoint&amp; newScrollPosition, uint64_t transactionID) override;
</span><span class="cx">     void couldNotRestorePageState() override;
</span><del>-    void restorePageState(const WebCore::FloatRect&amp;, double) override;
</del><ins>+    void restorePageState(const WebCore::FloatRect&amp;, const WebCore::IntPoint&amp;, double) override;
</ins><span class="cx">     void restorePageCenterAndScale(const WebCore::FloatPoint&amp;, double) override;
</span><span class="cx"> 
</span><span class="cx">     void startAssistingNode(const AssistedNodeInformation&amp;, bool userIsInteracting, bool blurPreviousNode, API::Object* userData) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosPageClientImplIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/ios/PageClientImplIOS.mm        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -147,7 +147,7 @@
</span><span class="cx"> void PageClientImpl::requestScroll(const FloatPoint&amp; scrollPosition, const IntPoint&amp; scrollOrigin, bool isProgrammaticScroll)
</span><span class="cx"> {
</span><span class="cx">     UNUSED_PARAM(isProgrammaticScroll);
</span><del>-    [m_webView _scrollToContentOffset:scrollPosition scrollOrigin:scrollOrigin];
</del><ins>+    [m_webView _scrollToContentScrollPosition:scrollPosition scrollOrigin:scrollOrigin];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IntSize PageClientImpl::viewSize()
</span><span class="lines">@@ -512,6 +512,11 @@
</span><span class="cx">     [m_contentView _didCommitLayerTree:layerTreeTransaction];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImpl::layerTreeCommitComplete()
+{
+    [m_contentView _layerTreeCommitComplete];
+}
+
</ins><span class="cx"> void PageClientImpl::dynamicViewportUpdateChangedTarget(double newScale, const WebCore::FloatPoint&amp; newScrollPosition, uint64_t nextValidLayerTreeTransactionID)
</span><span class="cx"> {
</span><span class="cx">     [m_webView _dynamicViewportUpdateChangedTargetToScale:newScale position:newScrollPosition nextValidLayerTreeTransactionID:nextValidLayerTreeTransactionID];
</span><span class="lines">@@ -522,9 +527,9 @@
</span><span class="cx">     [m_webView _couldNotRestorePageState];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PageClientImpl::restorePageState(const WebCore::FloatRect&amp; exposedRect, double scale)
</del><ins>+void PageClientImpl::restorePageState(const WebCore::FloatRect&amp; exposedContentRect, const WebCore::IntPoint&amp; scrollOrigin, double scale)
</ins><span class="cx"> {
</span><del>-    [m_webView _restorePageStateToExposedRect:exposedRect scale:scale];
</del><ins>+    [m_webView _restorePageStateToExposedRect:exposedContentRect scrollOrigin:scrollOrigin scale:scale];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PageClientImpl::restorePageCenterAndScale(const WebCore::FloatPoint&amp; center, double scale)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.h (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.h        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.h        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -88,6 +88,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_didCommitLoadForMainFrame;
</span><span class="cx"> - (void)_didCommitLayerTree:(const WebKit::RemoteLayerTreeTransaction&amp;)layerTreeTransaction;
</span><ins>+- (void)_layerTreeCommitComplete;
</ins><span class="cx"> 
</span><span class="cx"> - (void)_setAccessibilityWebProcessToken:(NSData *)data;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWKContentViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/ios/WKContentView.mm        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -520,6 +520,11 @@
</span><span class="cx">         [self _updateChangedSelection];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_layerTreeCommitComplete
+{
+    [_webView _layerTreeCommitComplete];
+}
+
</ins><span class="cx"> - (void)_setAcceleratedCompositingRootView:(UIView *)rootView
</span><span class="cx"> {
</span><span class="cx">     for (UIView* subview in [_rootContentView subviews])
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/ios/WebPageProxyIOS.mm        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -372,6 +372,11 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::layerTreeCommitComplete()
+{
+    m_pageClient.layerTreeCommitComplete();
+}
+
</ins><span class="cx"> void WebPageProxy::selectWithGesture(const WebCore::IntPoint point, WebCore::TextGranularity granularity, uint32_t gestureType, uint32_t gestureState, bool isInteractingWithAssistedNode, std::function&lt;void (const WebCore::IntPoint&amp;, uint32_t, uint32_t, uint32_t, CallbackBase::Error)&gt; callbackFunction)
</span><span class="cx"> {
</span><span class="cx">     if (!isValid()) {
</span><span class="lines">@@ -814,9 +819,9 @@
</span><span class="cx">     m_pageClient.couldNotRestorePageState();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::restorePageState(const WebCore::FloatRect&amp; exposedRect, double scale)
</del><ins>+void WebPageProxy::restorePageState(const WebCore::FloatRect&amp; exposedContentRect, const WebCore::IntPoint&amp; scrollOrigin, double scale)
</ins><span class="cx"> {
</span><del>-    m_pageClient.restorePageState(exposedRect, scale);
</del><ins>+    m_pageClient.restorePageState(exposedContentRect, scrollOrigin, scale);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::restorePageCenterAndScale(const WebCore::FloatPoint&amp; center, double scale)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacRemoteLayerTreeDrawingAreaProxymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/UIProcess/mac/RemoteLayerTreeDrawingAreaProxy.mm        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -229,6 +229,8 @@
</span><span class="cx">         asLayer(m_debugIndicatorLayerTreeHost-&gt;rootLayer()).name = @&quot;Indicator host root&quot;;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    m_webPageProxy.layerTreeCommitComplete();
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     [m_displayLinkHandler schedule];
</span><span class="cx"> #else
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (198454 => 198455)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2016-03-18 23:59:27 UTC (rev 198454)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2016-03-19 00:00:46 UTC (rev 198455)
</span><span class="lines">@@ -290,6 +290,8 @@
</span><span class="cx"> 
</span><span class="cx">     m_userHasChangedPageScaleFactor = !historyItem.scaleIsInitial();
</span><span class="cx"> 
</span><ins>+    FrameView&amp; frameView = *m_page-&gt;mainFrame().view();
+
</ins><span class="cx">     FloatSize currentMinimumLayoutSizeInScrollViewCoordinates = m_viewportConfiguration.minimumLayoutSize();
</span><span class="cx">     if (historyItem.minimumLayoutSizeInScrollViewCoordinates() == currentMinimumLayoutSizeInScrollViewCoordinates) {
</span><span class="cx">         float boundedScale = std::min&lt;float&gt;(m_viewportConfiguration.maximumScale(), std::max&lt;float&gt;(m_viewportConfiguration.minimumScale(), historyItem.pageScaleFactor()));
</span><span class="lines">@@ -297,10 +299,9 @@
</span><span class="cx"> 
</span><span class="cx">         m_drawingArea-&gt;setExposedContentRect(historyItem.exposedContentRect());
</span><span class="cx"> 
</span><del>-        send(Messages::WebPageProxy::RestorePageState(historyItem.exposedContentRect(), boundedScale));
</del><ins>+        send(Messages::WebPageProxy::RestorePageState(historyItem.exposedContentRect(), frameView.scrollOrigin(), boundedScale));
</ins><span class="cx">     } else {
</span><span class="cx">         IntSize oldContentSize = historyItem.contentSize();
</span><del>-        FrameView&amp; frameView = *m_page-&gt;mainFrame().view();
</del><span class="cx">         IntSize newContentSize = frameView.contentsSize();
</span><span class="cx">         double visibleHorizontalFraction = static_cast&lt;float&gt;(historyItem.unobscuredContentRect().width()) / oldContentSize.width();
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>