<!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>[164952] 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/164952">164952</a></dd>
<dt>Author</dt> <dd>benjamin@webkit.org</dd>
<dt>Date</dt> <dd>2014-03-02 15:13:46 -0800 (Sun, 02 Mar 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS][WK2] Pages using tiled compositing layers allocate too many tiles on zoom
https://bugs.webkit.org/show_bug.cgi?id=129471

Patch by Benjamin Poulain &lt;bpoulain@apple.com&gt; on 2014-03-02
Reviewed by Simon Fraser.

Source/WebCore: 

A few issues with TileController were causing sublayers of the root layers
to tile incorrect surfaces on zoom.

First, the exposedRect API was not updating the sublayers. The layers go correctly
into tiling mode, but the tiles cover the full document instead of the visible area.

The other major issue was the margins being applied to the coverage size in document
coordinates. Since each margin is 512px, the total coverage size after zoom was
gigantic.

To solve this, this patch switch from the exposedRect API to the generic concept
of VisibleExtentContentRect introduced for iOS WebKit1.

* WebCore.exp.in:
* platform/ScrollView.h:
Define a VisibleExtentContentRect on the scrollview itself when there is no
platformWidget().
The case with inside frame is untested due to stability issues :(.
(see &lt;rdar://problem/16199219&gt;)

* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::computeTileCoverageRect):
Remove the margin from the tile coverage.

On iOS, m_tileCoverage is always zero at the moment. Previously, the tile coverage
was artificially extended by the margins. With the margins removed, I temporarily added
a factor of 1.5.
ViewUpdateDispatcher has all the information to compute a great tile coverage, I will need
a follow up patch to fix that.

* platform/ios/ScrollViewIOS.mm:
(WebCore::ScrollView::visibleExtentContentRect):
(WebCore::ScrollView::setVisibleExtentContentRect):

Source/WebKit2: 

* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):
A few interesting changes here:
-Now that we do not use setExposedRect, we can pass the exposed area directly
 to the drawing area since everything is now in content coordinates :)
-The scale is now converted to float before being compared to the Page's scaleFactor.
 The page's scalefactor being a float, the comparison was failing most of the time.

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::setVisibleExtentContentRect):</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="#trunkSourceWebCoreplatformScrollViewh">trunk/Source/WebCore/platform/ScrollView.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacTileControllermm">trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosScrollViewIOSmm">trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreamm">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (164951 => 164952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-03-02 22:35:36 UTC (rev 164951)
+++ trunk/Source/WebCore/ChangeLog        2014-03-02 23:13:46 UTC (rev 164952)
</span><span class="lines">@@ -1,3 +1,44 @@
</span><ins>+2014-03-02  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [iOS][WK2] Pages using tiled compositing layers allocate too many tiles on zoom
+        https://bugs.webkit.org/show_bug.cgi?id=129471
+
+        Reviewed by Simon Fraser.
+
+        A few issues with TileController were causing sublayers of the root layers
+        to tile incorrect surfaces on zoom.
+
+        First, the exposedRect API was not updating the sublayers. The layers go correctly
+        into tiling mode, but the tiles cover the full document instead of the visible area.
+
+        The other major issue was the margins being applied to the coverage size in document
+        coordinates. Since each margin is 512px, the total coverage size after zoom was
+        gigantic.
+
+        To solve this, this patch switch from the exposedRect API to the generic concept
+        of VisibleExtentContentRect introduced for iOS WebKit1.
+
+        * WebCore.exp.in:
+        * platform/ScrollView.h:
+        Define a VisibleExtentContentRect on the scrollview itself when there is no
+        platformWidget().
+        The case with inside frame is untested due to stability issues :(.
+        (see &lt;rdar://problem/16199219&gt;)
+
+        * platform/graphics/ca/mac/TileController.mm:
+        (WebCore::TileController::computeTileCoverageRect):
+        Remove the margin from the tile coverage.
+
+        On iOS, m_tileCoverage is always zero at the moment. Previously, the tile coverage
+        was artificially extended by the margins. With the margins removed, I temporarily added
+        a factor of 1.5.
+        ViewUpdateDispatcher has all the information to compute a great tile coverage, I will need
+        a follow up patch to fix that.
+
+        * platform/ios/ScrollViewIOS.mm:
+        (WebCore::ScrollView::visibleExtentContentRect):
+        (WebCore::ScrollView::setVisibleExtentContentRect):
+
</ins><span class="cx"> 2014-03-02  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Sort Mac platform export files so they merge better
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (164951 => 164952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-03-02 22:35:36 UTC (rev 164951)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-03-02 23:13:46 UTC (rev 164952)
</span><span class="lines">@@ -2376,6 +2376,7 @@
</span><span class="cx"> _WebThreadUnlockGuardForMail
</span><span class="cx"> __ZN7WebCore10FloatPointC1ERK7CGPoint
</span><span class="cx"> __ZN7WebCore10ScrollView15setScrollOffsetERKNS_8IntPointE
</span><ins>+__ZN7WebCore10ScrollView27setVisibleExtentContentRectERKNS_7IntRectE
</ins><span class="cx"> __ZN7WebCore10XLinkNames4initEv
</span><span class="cx"> __ZN7WebCore10inSameLineERKNS_15VisiblePositionES2_
</span><span class="cx"> __ZN7WebCore11BidiContext41copyStackRemovingUnicodeEmbeddingContextsEv
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollView.h (164951 => 164952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollView.h        2014-03-02 22:35:36 UTC (rev 164951)
+++ trunk/Source/WebCore/platform/ScrollView.h        2014-03-02 23:13:46 UTC (rev 164952)
</span><span class="lines">@@ -171,6 +171,7 @@
</span><span class="cx">     IntRect actualVisibleContentRect() const;
</span><span class="cx">     // This is the area that is partially or fully exposed, and may extend under overlapping UI elements.
</span><span class="cx">     IntRect visibleExtentContentRect() const;
</span><ins>+    void setVisibleExtentContentRect(const IntRect&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void setActualScrollPosition(const IntPoint&amp;);
</span><span class="cx">     TileCache* tileCache();
</span><span class="lines">@@ -392,7 +393,11 @@
</span><span class="cx">     // whether it is safe to blit on scroll.
</span><span class="cx">     bool m_canBlitOnScroll;
</span><span class="cx"> 
</span><del>-#if !PLATFORM(IOS)
</del><ins>+    // FIXME: visibleExtentContentRect is a very similar concept to fixedVisibleContentRect except it does not differentiate
+    // between exposed rect and unobscuredRects. The two attributes should eventually be merged.
+#if PLATFORM(IOS)
+    IntRect m_visibleExtentContentRect;
+#else
</ins><span class="cx">     IntRect m_fixedVisibleContentRect;
</span><span class="cx"> #endif
</span><span class="cx">     IntSize m_scrollOffset; // FIXME: Would rather store this as a position, but we will wait to make this change until more code is shared.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacTileControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm (164951 => 164952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm        2014-03-02 22:35:36 UTC (rev 164951)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileController.mm        2014-03-02 23:13:46 UTC (rev 164952)
</span><span class="lines">@@ -498,18 +498,28 @@
</span><span class="cx">     // FIXME: look at how far the document can scroll in each dimension.
</span><span class="cx">     float coverageHorizontalSize = visibleRect.width();
</span><span class="cx">     float coverageVerticalSize = visibleRect.height();
</span><del>-    
</del><ins>+
+#if PLATFORM(IOS)
+    // FIXME: ViewUpdateDispatcher could do an amazing job at computing this (&lt;rdar://problem/16205290&gt;).
+    // In the meantime, just default to something good enough.
+    if (!largeVisibleRectChange) {
+        coverageHorizontalSize *= 1.5;
+        coverageVerticalSize *= 1.5;
+    }
+#else
</ins><span class="cx">     // Inflate the coverage rect so that it covers 2x of the visible width and 3x of the visible height.
</span><span class="cx">     // These values were chosen because it's more common to have tall pages and to scroll vertically,
</span><span class="cx">     // so we keep more tiles above and below the current area.
</span><ins>+
</ins><span class="cx">     if (m_tileCoverage &amp; CoverageForHorizontalScrolling &amp;&amp; !largeVisibleRectChange)
</span><span class="cx">         coverageHorizontalSize *= 2;
</span><span class="cx"> 
</span><span class="cx">     if (m_tileCoverage &amp; CoverageForVerticalScrolling &amp;&amp; !largeVisibleRectChange)
</span><span class="cx">         coverageVerticalSize *= 3;
</span><del>-    
</del><ins>+
</ins><span class="cx">     coverageVerticalSize += topMarginHeight() + bottomMarginHeight();
</span><span class="cx">     coverageHorizontalSize += leftMarginWidth() + rightMarginWidth();
</span><ins>+#endif
</ins><span class="cx"> 
</span><span class="cx">     FloatRect coverageBounds = bounds();
</span><span class="cx">     float coverageLeft = visibleRect.x() - (coverageHorizontalSize - visibleRect.width()) / 2;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosScrollViewIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm (164951 => 164952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm        2014-03-02 22:35:36 UTC (rev 164951)
+++ trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm        2014-03-02 23:13:46 UTC (rev 164952)
</span><span class="lines">@@ -108,24 +108,36 @@
</span><span class="cx"> 
</span><span class="cx"> IntRect ScrollView::visibleExtentContentRect() const
</span><span class="cx"> {
</span><del>-    NSScrollView *view = static_cast&lt;NSScrollView *&gt;(platformWidget());
</del><ins>+    if (NSScrollView *view = static_cast&lt;NSScrollView *&gt;(platformWidget())) {
+        CGRect r = CGRectZero;
+        BEGIN_BLOCK_OBJC_EXCEPTIONS;
+        if ([view isKindOfClass:[NSScrollView class]])
+            r = [view documentVisibleExtent];
+        else {
+            r.origin = [view visibleRect].origin;
+            r.size = [view bounds].size;
+        }
</ins><span class="cx"> 
</span><del>-    CGRect r = CGRectZero;
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    if ([view isKindOfClass:[NSScrollView class]])
-        r = [view documentVisibleExtent];
-    else if (view) {
-        r.origin = [view visibleRect].origin;
-        r.size = [view bounds].size;
-    } else {
-        // FIXME: WebKit2 on iOS doesn't inform the WebProcess of the exposed area.
-        return IntRect(IntPoint(), contentsSize());
</del><ins>+        END_BLOCK_OBJC_EXCEPTIONS;
+        return enclosingIntRect(r);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    END_BLOCK_OBJC_EXCEPTIONS;
-    return enclosingIntRect(r);
</del><ins>+    const ScrollView* parent = this-&gt;parent();
+    if (!parent)
+        return m_visibleExtentContentRect;
+
+    IntRect parentViewExtentContentRect = parent-&gt;visibleExtentContentRect();
+    IntRect selfExtentContentRect = rootViewToContents(parentViewExtentContentRect);
+    selfExtentContentRect.intersect(boundsRect());
+    return selfExtentContentRect;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void ScrollView::setVisibleExtentContentRect(const IntRect&amp; rect)
+{
+    ASSERT(!platformWidget());
+    m_visibleExtentContentRect = rect;
+}
+
</ins><span class="cx"> void ScrollView::setActualScrollPosition(const IntPoint&amp; position)
</span><span class="cx"> {
</span><span class="cx">     NSScrollView *view = static_cast&lt;NSScrollView *&gt;(platformWidget());
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (164951 => 164952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-03-02 22:35:36 UTC (rev 164951)
+++ trunk/Source/WebKit2/ChangeLog        2014-03-02 23:13:46 UTC (rev 164952)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2014-03-02  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
+
+        [iOS][WK2] Pages using tiled compositing layers allocate too many tiles on zoom
+        https://bugs.webkit.org/show_bug.cgi?id=129471
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/DrawingArea.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateVisibleContentRects):
+        A few interesting changes here:
+        -Now that we do not use setExposedRect, we can pass the exposed area directly
+         to the drawing area since everything is now in content coordinates :)
+        -The scale is now converted to float before being compared to the Page's scaleFactor.
+         The page's scalefactor being a float, the comparison was failing most of the time.
+
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::setVisibleExtentContentRect):
+
</ins><span class="cx"> 2014-03-02  Darin Adler  &lt;darin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Change public text iterator API implementations to not depend on 16-bit character pointers
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (164951 => 164952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2014-03-02 22:35:36 UTC (rev 164951)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2014-03-02 23:13:46 UTC (rev 164952)
</span><span class="lines">@@ -93,6 +93,9 @@
</span><span class="cx">     virtual WebCore::FloatRect exposedRect() const = 0;
</span><span class="cx">     virtual void setCustomFixedPositionRect(const WebCore::FloatRect&amp;) = 0;
</span><span class="cx"> #endif
</span><ins>+#if PLATFORM(IOS)
+    virtual void setVisibleExtentContentRect(const WebCore::FloatRect&amp;) = 0;
+#endif
</ins><span class="cx">     virtual void mainFrameScrollabilityChanged(bool) { }
</span><span class="cx"> 
</span><span class="cx">     virtual bool supportsAsyncScrolling() { return false; }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (164951 => 164952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-03-02 22:35:36 UTC (rev 164951)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2014-03-02 23:13:46 UTC (rev 164952)
</span><span class="lines">@@ -1642,20 +1642,19 @@
</span><span class="cx"> 
</span><span class="cx"> void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo&amp; visibleContentRectUpdateInfo)
</span><span class="cx"> {
</span><del>-    double boundedScale = std::min(m_viewportConfiguration.maximumScale(), std::max(m_viewportConfiguration.minimumScale(), visibleContentRectUpdateInfo.scale()));
-
-    IntPoint scrollPosition = roundedIntPoint(visibleContentRectUpdateInfo.unobscuredRect().location());
-
</del><span class="cx">     FloatRect exposedRect = visibleContentRectUpdateInfo.exposedRect();
</span><del>-    exposedRect.scale(boundedScale);
-    m_drawingArea-&gt;setExposedRect(exposedRect);
</del><ins>+    m_drawingArea-&gt;setVisibleExtentContentRect(enclosingIntRect(exposedRect));
</ins><span class="cx"> 
</span><del>-    if (boundedScale != m_page-&gt;pageScaleFactor()) {
</del><ins>+    double boundedScale = std::min(m_viewportConfiguration.maximumScale(), std::max(m_viewportConfiguration.minimumScale(), visibleContentRectUpdateInfo.scale()));
+    float floatBoundedScale = boundedScale;
+    if (floatBoundedScale != m_page-&gt;pageScaleFactor()) {
</ins><span class="cx">         m_scaleWasSetByUIProcess = true;
</span><del>-        m_page-&gt;setPageScaleFactor(boundedScale, scrollPosition);
</del><ins>+
+        IntPoint scrollPosition = roundedIntPoint(visibleContentRectUpdateInfo.unobscuredRect().location());
+        m_page-&gt;setPageScaleFactor(floatBoundedScale, scrollPosition);
</ins><span class="cx">         if (m_drawingArea-&gt;layerTreeHost())
</span><span class="cx">             m_drawingArea-&gt;layerTreeHost()-&gt;deviceOrPageScaleFactorChanged();
</span><del>-        send(Messages::WebPageProxy::PageScaleFactorDidChange(boundedScale));
</del><ins>+        send(Messages::WebPageProxy::PageScaleFactorDidChange(floatBoundedScale));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // FIXME: we should also update the frame view from unobscured rect. Altenatively, we can have it pull the values from ScrollView.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h (164951 => 164952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h        2014-03-02 22:35:36 UTC (rev 164951)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h        2014-03-02 23:13:46 UTC (rev 164952)
</span><span class="lines">@@ -75,6 +75,10 @@
</span><span class="cx">     virtual void setExposedRect(const WebCore::FloatRect&amp;) override;
</span><span class="cx">     virtual WebCore::FloatRect exposedRect() const override { return m_scrolledExposedRect; }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    virtual void setVisibleExtentContentRect(const WebCore::FloatRect&amp;) override;
+#endif
+
</ins><span class="cx">     virtual void setCustomFixedPositionRect(const WebCore::FloatRect&amp;) override;
</span><span class="cx"> 
</span><span class="cx">     // WebCore::GraphicsLayerClient
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm (164951 => 164952)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm        2014-03-02 22:35:36 UTC (rev 164951)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm        2014-03-02 23:13:46 UTC (rev 164952)
</span><span class="lines">@@ -246,6 +246,18 @@
</span><span class="cx">     updateScrolledExposedRect();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+void RemoteLayerTreeDrawingArea::setVisibleExtentContentRect(const FloatRect&amp; visibleExtentContentRect)
+{
+    FrameView* frameView = m_webPage-&gt;corePage()-&gt;mainFrame().view();
+    if (!frameView)
+        return;
+
+    frameView-&gt;setVisibleExtentContentRect(enclosingIntRect(visibleExtentContentRect));
+    scheduleCompositingLayerFlush();
+}
+#endif
+
</ins><span class="cx"> void RemoteLayerTreeDrawingArea::updateScrolledExposedRect()
</span><span class="cx"> {
</span><span class="cx">     FrameView* frameView = m_webPage-&gt;corePage()-&gt;mainFrame().view();
</span></span></pre>
</div>
</div>

</body>
</html>