<!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>[198502] 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/198502">198502</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2016-03-21 15:25:08 -0700 (Mon, 21 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS WK2] Use larger tiles when possible to reduce per-tile painting overhead
https://bugs.webkit.org/show_bug.cgi?id=155734
rdar://problem/24968144

Reviewed by Tim Horton.

Source/WebCore:

The existing tile size logic is wired to adjustScrollbars, which doesn't fire
when scrolling is delegated. For iOS WK2, key off of a new unobscuredContentSizeChanged()
function that runs when the UI process tells told WebCore that the unobscured size
has changed. In addition, contentsResized() is used to update scrollability when
page changes size.

* page/FrameView.cpp:
(WebCore::FrameView::contentsResized):
(WebCore::FrameView::addedOrRemovedScrollbar):
(WebCore::FrameView::adjustTiledBackingScrollability): Handle both delegated and non-delegated
scrolling; the former looks at the visible size (based on the unobscuredVisibleContentRect),
the latter at the presence of scrollbars.
(WebCore::FrameView::unobscuredContentSizeChanged):
* page/FrameView.h:
* platform/ScrollView.h:
(WebCore::ScrollView::unobscuredContentSizeChanged):
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::adjustTileCoverageRect): Use kDefaultTileSize rather than the
tile size, to retain the old amount of overdraw.
(WebCore::TileController::tileSize): There was a bug in the not-scrollable case; we need
to scale.
* platform/ios/ScrollViewIOS.mm:
(WebCore::ScrollView::setUnobscuredContentSize):

LayoutTests:

New results with larger page tiles in WK2.

* platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt: Added.
* platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt: Added.
* platform/ios-simulator-wk2/compositing/tiling/transform-origin-tiled-expected.txt: 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="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewh">trunk/Source/WebCore/page/FrameView.h</a></li>
<li><a href="#trunkSourceWebCoreplatformScrollViewh">trunk/Source/WebCore/platform/ScrollView.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaTileControllercpp">trunk/Source/WebCore/platform/graphics/ca/TileController.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformiosScrollViewIOSmm">trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformiossimulatorwk2compositingtilingrotatedtiledclampedexpectedtxt">trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorwk2compositingtilingrotatedtiledpreserve3dclampedexpectedtxt">trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimulatorwk2compositingtilingtransformorigintiledexpectedtxt">trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/transform-origin-tiled-expected.txt</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (198501 => 198502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-21 22:22:16 UTC (rev 198501)
+++ trunk/LayoutTests/ChangeLog        2016-03-21 22:25:08 UTC (rev 198502)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-03-21  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Use larger tiles when possible to reduce per-tile painting overhead
+        https://bugs.webkit.org/show_bug.cgi?id=155734
+        rdar://problem/24968144
+
+        Reviewed by Tim Horton.
+
+        New results with larger page tiles in WK2.
+
+        * platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt: Added.
+        * platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt: Added.
+        * platform/ios-simulator-wk2/compositing/tiling/transform-origin-tiled-expected.txt: Added.
+
</ins><span class="cx"> 2016-03-21  Hyungwook Lee  &lt;hyungwook.lee@navercorp.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Connect layoutTestController.findString() to support testing
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorwk2compositingtilingrotatedtiledclampedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt (0 => 198502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-clamped-expected.txt        2016-03-21 22:25:08 UTC (rev 198502)
</span><span class="lines">@@ -0,0 +1,61 @@
</span><ins>+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (visible rect 0.00, 0.00 800.00 x 600.00)
+  (coverage rect 0.00, 0.00 800.00 x 600.00)
+  (intersects coverage rect 1)
+  (contentsScale 2.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (visible rect 0.00, 0.00 800.00 x 600.00)
+      (coverage rect 0.00, 0.00 800.00 x 600.00)
+      (intersects coverage rect 1)
+      (contentsScale 2.00)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (children 1
+        (GraphicsLayer
+          (position 58.00 50.00)
+          (bounds 502.00 302.00)
+          (visible rect 0.00, 0.00 502.00 x 302.00)
+          (coverage rect -58.00, -50.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 2.00)
+          (children 1
+            (GraphicsLayer
+              (position 1.00 1.00)
+              (bounds 500.00 300.00)
+              (childrenTransform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 -0.00] [0.00 0.00 0.00 1.00])
+              (visible rect 0.00, 0.00 500.00 x 300.00)
+              (coverage rect 0.00, 0.00 500.00 x 300.00)
+              (intersects coverage rect 1)
+              (contentsScale 2.00)
+              (children 1
+                (GraphicsLayer
+                  (position -1250.00 0.00)
+                  (anchor 0.54 0.50)
+                  (bounds 2800.00 300.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (transform [0.17 0.00 -0.98 0.00] [0.00 1.00 0.00 0.00] [0.98 0.00 0.17 0.00] [0.00 0.00 0.00 1.00])
+                  (visible rect 0.00, 0.00 2800.00 x 300.00)
+                  (coverage rect 0.00, 0.00 2800.00 x 300.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 2.00)
+                  (tile cache coverage 0, 0 2800 x 300)
+                  (tile size 512 x 512)
+                  (top left tile 0, 0 tiles grid 6 x 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorwk2compositingtilingrotatedtiledpreserve3dclampedexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt (0 => 198502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/rotated-tiled-preserve3d-clamped-expected.txt        2016-03-21 22:25:08 UTC (rev 198502)
</span><span class="lines">@@ -0,0 +1,70 @@
</span><ins>+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (visible rect 0.00, 0.00 800.00 x 600.00)
+  (coverage rect 0.00, 0.00 800.00 x 600.00)
+  (intersects coverage rect 1)
+  (contentsScale 2.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (visible rect 0.00, 0.00 800.00 x 600.00)
+      (coverage rect 0.00, 0.00 800.00 x 600.00)
+      (intersects coverage rect 1)
+      (contentsScale 2.00)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (children 1
+        (GraphicsLayer
+          (position 58.00 50.00)
+          (bounds 502.00 302.00)
+          (visible rect 0.00, 0.00 502.00 x 302.00)
+          (coverage rect -58.00, -50.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 2.00)
+          (children 1
+            (GraphicsLayer
+              (position 1.00 1.00)
+              (bounds 500.00 300.00)
+              (childrenTransform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 -0.00] [0.00 0.00 0.00 1.00])
+              (visible rect 0.00, 0.00 500.00 x 300.00)
+              (coverage rect 0.00, 0.00 500.00 x 300.00)
+              (intersects coverage rect 1)
+              (contentsScale 2.00)
+              (children 1
+                (GraphicsLayer
+                  (preserves3D 1)
+                  (visible rect 0.00, 0.00 0.00 x 0.00)
+                  (coverage rect 0.00, 0.00 500.00 x 300.00)
+                  (intersects coverage rect 0)
+                  (contentsScale 2.00)
+                  (children 1
+                    (GraphicsLayer
+                      (position -1250.00 0.00)
+                      (anchor 0.54 0.50)
+                      (bounds 2800.00 300.00)
+                      (usingTiledLayer 1)
+                      (contentsOpaque 1)
+                      (drawsContent 1)
+                      (transform [0.17 0.00 -0.98 0.00] [0.00 1.00 0.00 0.00] [0.98 0.00 0.17 0.00] [0.00 0.00 0.00 1.00])
+                      (visible rect 0.00, 0.00 2800.00 x 300.00)
+                      (coverage rect 0.00, 0.00 2800.00 x 300.00)
+                      (intersects coverage rect 1)
+                      (contentsScale 2.00)
+                      (tile cache coverage 0, 0 2800 x 300)
+                      (tile size 512 x 512)
+                      (top left tile 0, 0 tiles grid 6 x 1)
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimulatorwk2compositingtilingtransformorigintiledexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/transform-origin-tiled-expected.txt (0 => 198502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/transform-origin-tiled-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/compositing/tiling/transform-origin-tiled-expected.txt        2016-03-21 22:25:08 UTC (rev 198502)
</span><span class="lines">@@ -0,0 +1,60 @@
</span><ins>+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (visible rect 0.00, 0.00 800.00 x 600.00)
+  (coverage rect 0.00, 0.00 800.00 x 600.00)
+  (intersects coverage rect 1)
+  (contentsScale 2.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (visible rect 0.00, 0.00 800.00 x 600.00)
+      (coverage rect 0.00, 0.00 800.00 x 600.00)
+      (intersects coverage rect 1)
+      (contentsScale 2.00)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (children 1
+        (GraphicsLayer
+          (position 58.00 50.00)
+          (bounds 502.00 302.00)
+          (visible rect 0.00, 0.00 502.00 x 302.00)
+          (coverage rect -58.00, -50.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 2.00)
+          (children 1
+            (GraphicsLayer
+              (position 1.00 1.00)
+              (bounds 500.00 300.00)
+              (childrenTransform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 -0.00] [0.00 0.00 0.00 1.00])
+              (visible rect 0.00, 0.00 500.00 x 300.00)
+              (coverage rect 0.00, 0.00 500.00 x 300.00)
+              (intersects coverage rect 1)
+              (contentsScale 2.00)
+              (children 1
+                (GraphicsLayer
+                  (position -1250.00 0.00)
+                  (anchor 0.54 0.50)
+                  (bounds 2800.00 300.00)
+                  (usingTiledLayer 1)
+                  (contentsOpaque 1)
+                  (drawsContent 1)
+                  (visible rect 1250.00, 0.00 500.00 x 300.00)
+                  (coverage rect 1250.00, 0.00 500.00 x 300.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 2.00)
+                  (tile cache coverage 1024, 0 1024 x 300)
+                  (tile size 512 x 512)
+                  (top left tile 2, 0 tiles grid 2 x 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198501 => 198502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-21 22:22:16 UTC (rev 198501)
+++ trunk/Source/WebCore/ChangeLog        2016-03-21 22:25:08 UTC (rev 198502)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2016-03-21  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Use larger tiles when possible to reduce per-tile painting overhead
+        https://bugs.webkit.org/show_bug.cgi?id=155734
+        rdar://problem/24968144
+
+        Reviewed by Tim Horton.
+
+        The existing tile size logic is wired to adjustScrollbars, which doesn't fire
+        when scrolling is delegated. For iOS WK2, key off of a new unobscuredContentSizeChanged()
+        function that runs when the UI process tells told WebCore that the unobscured size
+        has changed. In addition, contentsResized() is used to update scrollability when
+        page changes size.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::contentsResized):
+        (WebCore::FrameView::addedOrRemovedScrollbar):
+        (WebCore::FrameView::adjustTiledBackingScrollability): Handle both delegated and non-delegated
+        scrolling; the former looks at the visible size (based on the unobscuredVisibleContentRect),
+        the latter at the presence of scrollbars.
+        (WebCore::FrameView::unobscuredContentSizeChanged):
+        * page/FrameView.h:
+        * platform/ScrollView.h:
+        (WebCore::ScrollView::unobscuredContentSizeChanged):
+        * platform/graphics/ca/TileController.cpp:
+        (WebCore::TileController::adjustTileCoverageRect): Use kDefaultTileSize rather than the
+        tile size, to retain the old amount of overdraw.
+        (WebCore::TileController::tileSize): There was a bug in the not-scrollable case; we need
+        to scale.
+        * platform/ios/ScrollViewIOS.mm:
+        (WebCore::ScrollView::setUnobscuredContentSize):
+
</ins><span class="cx"> 2016-03-21  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r197552.
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (198501 => 198502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2016-03-21 22:22:16 UTC (rev 198501)
+++ trunk/Source/WebCore/page/FrameView.cpp        2016-03-21 22:25:08 UTC (rev 198502)
</span><span class="lines">@@ -2136,6 +2136,13 @@
</span><span class="cx">     ScrollView::setScrollPosition(scrollPosition);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void FrameView::contentsResized()
+{
+    // For non-delegated scrolling, adjustTiledBackingScrollability() is called via addedOrRemovedScrollbar() which occurs less often.
+    if (delegatesScrolling())
+        adjustTiledBackingScrollability();
+}
+
</ins><span class="cx"> void FrameView::delegatesScrollingDidChange()
</span><span class="cx"> {
</span><span class="cx">     // When we switch to delgatesScrolling mode, we should destroy the scrolling/clipping layers in RenderLayerCompositor.
</span><span class="lines">@@ -2466,18 +2473,46 @@
</span><span class="cx">             renderView-&gt;compositor().frameViewDidAddOrRemoveScrollbars();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (auto* tiledBacking = this-&gt;tiledBacking()) {
-        TiledBacking::Scrollability scrollability = TiledBacking::NotScrollable;
-        if (horizontalScrollbar())
-            scrollability = TiledBacking::HorizontallyScrollable;
</del><ins>+    adjustTiledBackingScrollability();
+}
</ins><span class="cx"> 
</span><del>-        if (verticalScrollbar())
-            scrollability |= TiledBacking::VerticallyScrollable;
</del><ins>+void FrameView::adjustTiledBackingScrollability()
+{
+    auto* tiledBacking = this-&gt;tiledBacking();
+    if (!tiledBacking)
+        return;
+    
+    bool horizontallyScrollable;
+    bool verticallyScrollable;
</ins><span class="cx"> 
</span><del>-        tiledBacking-&gt;setScrollability(scrollability);
</del><ins>+    if (delegatesScrolling()) {
+        IntSize documentSize = contentsSize();
+        IntSize visibleSize = this-&gt;visibleSize();
+        
+        horizontallyScrollable = documentSize.width() &gt; visibleSize.width();
+        verticallyScrollable = documentSize.height() &gt; visibleSize.height();
+    } else {
+        horizontallyScrollable = horizontalScrollbar();
+        verticallyScrollable = verticalScrollbar();
</ins><span class="cx">     }
</span><ins>+
+    TiledBacking::Scrollability scrollability = TiledBacking::NotScrollable;
+    if (horizontallyScrollable)
+        scrollability = TiledBacking::HorizontallyScrollable;
+
+    if (verticallyScrollable)
+        scrollability |= TiledBacking::VerticallyScrollable;
+
+    tiledBacking-&gt;setScrollability(scrollability);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+void FrameView::unobscuredContentSizeChanged()
+{
+    adjustTiledBackingScrollability();
+}
+#endif
+
</ins><span class="cx"> static LayerFlushThrottleState::Flags determineLayerFlushThrottleState(Page&amp; page)
</span><span class="cx"> {
</span><span class="cx">     // We only throttle when constantly receiving new data during the inital page load.
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.h (198501 => 198502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.h        2016-03-21 22:22:16 UTC (rev 198501)
+++ trunk/Source/WebCore/page/FrameView.h        2016-03-21 22:25:08 UTC (rev 198502)
</span><span class="lines">@@ -510,6 +510,8 @@
</span><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void availableContentSizeChanged(AvailableSizeChangeReason) override;
</span><span class="cx"> 
</span><ins>+    void adjustTiledBackingScrollability();
+
</ins><span class="cx">     void addPaintPendingMilestones(LayoutMilestones);
</span><span class="cx">     void firePaintRelatedMilestonesIfNeeded();
</span><span class="cx">     void fireLayoutRelatedMilestonesIfNeeded();
</span><span class="lines">@@ -636,7 +638,12 @@
</span><span class="cx"> #if ENABLE(RUBBER_BANDING)
</span><span class="cx">     GraphicsLayer* layerForOverhangAreas() const override;
</span><span class="cx"> #endif
</span><ins>+    void contentsResized() override;
</ins><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    void unobscuredContentSizeChanged() override;
+#endif
+
</ins><span class="cx">     bool usesCompositedScrolling() const override;
</span><span class="cx">     bool usesAsyncScrolling() const override;
</span><span class="cx">     bool usesMockScrollAnimator() const override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformScrollViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ScrollView.h (198501 => 198502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ScrollView.h        2016-03-21 22:22:16 UTC (rev 198501)
+++ trunk/Source/WebCore/platform/ScrollView.h        2016-03-21 22:25:08 UTC (rev 198502)
</span><span class="lines">@@ -419,6 +419,10 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void scrollOffsetChangedViaPlatformWidgetImpl(const ScrollOffset&amp;, const ScrollOffset&amp;) { }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    virtual void unobscuredContentSizeChanged() { }
+#endif
+
</ins><span class="cx"> private:
</span><span class="cx">     IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const override;
</span><span class="cx">     WEBCORE_EXPORT IntRect unobscuredContentRectInternal(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaTileControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/TileController.cpp (198501 => 198502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/TileController.cpp        2016-03-21 22:22:16 UTC (rev 198501)
+++ trunk/Source/WebCore/platform/graphics/ca/TileController.cpp        2016-03-21 22:25:08 UTC (rev 198502)
</span><span class="lines">@@ -363,8 +363,8 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    double horizontalMargin = tileSize().width() / contentsScale;
-    double verticalMargin = tileSize().height() / contentsScale;
</del><ins>+    double horizontalMargin = kDefaultTileSize / contentsScale;
+    double verticalMargin = kDefaultTileSize / contentsScale;
</ins><span class="cx"> 
</span><span class="cx">     double currentTime = monotonicallyIncreasingTime();
</span><span class="cx">     double timeDelta = currentTime - m_velocity.lastUpdateTime;
</span><span class="lines">@@ -494,11 +494,14 @@
</span><span class="cx"> 
</span><span class="cx">     IntSize tileSize(kDefaultTileSize, kDefaultTileSize);
</span><span class="cx"> 
</span><del>-    if (m_scrollability == NotScrollable)
-        tileSize = boundsWithoutMargin().size().constrainedBetween(IntSize(kDefaultTileSize, kDefaultTileSize), IntSize(kGiantTileSize, kGiantTileSize));
-    else if (m_scrollability == VerticallyScrollable)
-        tileSize.setWidth(std::min(std::max(boundsWithoutMargin().width(), kDefaultTileSize), kGiantTileSize));
</del><ins>+    if (m_scrollability == NotScrollable) {
+        IntSize scaledSize = expandedIntSize(boundsWithoutMargin().size() * tileGrid().scale());
+        tileSize = scaledSize.constrainedBetween(IntSize(kDefaultTileSize, kDefaultTileSize), IntSize(kGiantTileSize, kGiantTileSize));
+    } else if (m_scrollability == VerticallyScrollable)
+        tileSize.setWidth(std::min(std::max&lt;int&gt;(ceilf(boundsWithoutMargin().width() * tileGrid().scale()), kDefaultTileSize), kGiantTileSize));
</ins><span class="cx"> 
</span><ins>+    LOG_WITH_STREAM(Scrolling, stream &lt;&lt; &quot;TileController::tileSize newSize=&quot; &lt;&lt; tileSize);
+
</ins><span class="cx">     m_tileSizeLocked = true;
</span><span class="cx">     return tileSize;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosScrollViewIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm (198501 => 198502)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm        2016-03-21 22:22:16 UTC (rev 198501)
+++ trunk/Source/WebCore/platform/ios/ScrollViewIOS.mm        2016-03-21 22:25:08 UTC (rev 198502)
</span><span class="lines">@@ -116,7 +116,11 @@
</span><span class="cx"> void ScrollView::setUnobscuredContentSize(const FloatSize&amp; size)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!platformWidget());
</span><ins>+    if (size == m_unobscuredContentSize)
+        return;
+
</ins><span class="cx">     m_unobscuredContentSize = size;
</span><ins>+    unobscuredContentSizeChanged();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> FloatRect ScrollView::exposedContentRect() const
</span></span></pre>
</div>
</div>

</body>
</html>