<!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>[168190] 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/168190">168190</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2014-05-02 14:24:54 -0700 (Fri, 02 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS WK2] Don't create backing store for -webkit-overflow-scrolling:touch that can't scroll
https://bugs.webkit.org/show_bug.cgi?id=132487
&lt;rdar://problem/16758041&gt;

Reviewed by Sam Weinig.

Source/WebCore:

Previously, -webkit-overflow-scrolling:touch would cause us to make compositing
layers for any element that had overflow: auto or scroll on either axis. This
created lots of backing store when not required.

Improve this to only create compositing for scrolling when there is actually
scrollable overflow. This makes things slightly more complex, because we can
only know when layout is up to date.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::computeRectForRepaint): usesCompositedScrolling() tells
us if we're actually doing composited overflow.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::hasTouchScrollableOverflow):
(WebCore::RenderLayer::handleTouchEvent):
* rendering/RenderLayer.h:
* rendering/RenderLayerBacking.cpp:
(WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling):
(WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): Only update
scrolling and clipping layers if layout is not pending.
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
(WebCore::RenderLayerBacking::updateScrollingLayers): The caller calls
updateInternalHierarchy(), so no need to do it here.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::requiresCompositingForScrolling): We
can only determine that we're scrollable after layout.
(WebCore::isStickyInAcceleratedScrollingLayerOrViewport):
(WebCore::isMainFrameScrollingOrOverflowScrolling):

LayoutTests:

These are all progressions, and show that we make layers in fewer cases.

* platform/ios-sim/compositing/overflow/iframe-inside-overflow-clipping-expected.txt:
* platform/ios-sim/compositing/overflow/overflow-auto-with-touch-no-overflow-expected.txt:
* platform/ios-sim/compositing/overflow/overflow-overlay-with-touch-no-overflow-expected.txt:
* platform/ios-sim/compositing/overflow/overflow-scroll-with-touch-no-overflow-expected.txt:
* platform/ios-sim/compositing/overflow/subpixel-overflow-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformiossimcompositingoverflowiframeinsideoverflowclippingexpectedtxt">trunk/LayoutTests/platform/ios-sim/compositing/overflow/iframe-inside-overflow-clipping-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimcompositingoverflowoverflowautowithtouchnooverflowexpectedtxt">trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-auto-with-touch-no-overflow-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimcompositingoverflowoverflowoverlaywithtouchnooverflowexpectedtxt">trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-overlay-with-touch-no-overflow-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimcompositingoverflowoverflowscrollwithtouchnooverflowexpectedtxt">trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-scroll-with-touch-no-overflow-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformiossimcompositingoverflowsubpixeloverflowexpectedtxt">trunk/LayoutTests/platform/ios-sim/compositing/overflow/subpixel-overflow-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderBoxcpp">trunk/Source/WebCore/rendering/RenderBox.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayercpp">trunk/Source/WebCore/rendering/RenderLayer.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerh">trunk/Source/WebCore/rendering/RenderLayer.h</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerCompositorcpp">trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/LayoutTests/ChangeLog        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-05-02  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Don't create backing store for -webkit-overflow-scrolling:touch that can't scroll
+        https://bugs.webkit.org/show_bug.cgi?id=132487
+        &lt;rdar://problem/16758041&gt;
+
+        Reviewed by Sam Weinig.
+        
+        These are all progressions, and show that we make layers in fewer cases.
+
+        * platform/ios-sim/compositing/overflow/iframe-inside-overflow-clipping-expected.txt:
+        * platform/ios-sim/compositing/overflow/overflow-auto-with-touch-no-overflow-expected.txt:
+        * platform/ios-sim/compositing/overflow/overflow-overlay-with-touch-no-overflow-expected.txt:
+        * platform/ios-sim/compositing/overflow/overflow-scroll-with-touch-no-overflow-expected.txt:
+        * platform/ios-sim/compositing/overflow/subpixel-overflow-expected.txt:
+
</ins><span class="cx"> 2014-05-02  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r168150.
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimcompositingoverflowiframeinsideoverflowclippingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-sim/compositing/overflow/iframe-inside-overflow-clipping-expected.txt (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-sim/compositing/overflow/iframe-inside-overflow-clipping-expected.txt        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/LayoutTests/platform/ios-sim/compositing/overflow/iframe-inside-overflow-clipping-expected.txt        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -1,3 +1,4 @@
</span><span class="cx"> This test should not assert.
</span><span class="cx"> 
</span><span class="cx"> 
</span><ins>+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformiossimcompositingoverflowoverflowautowithtouchnooverflowexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-auto-with-touch-no-overflow-expected.txt (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-auto-with-touch-no-overflow-expected.txt        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-auto-with-touch-no-overflow-expected.txt        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -1,26 +1 @@
</span><del>-(GraphicsLayer
-  (bounds 800.00 600.00)
-  (children 1
-    (GraphicsLayer
-      (bounds 800.00 600.00)
-      (children 1
-        (GraphicsLayer
-          (position 8.00 8.00)
-          (bounds 300.00 300.00)
-          (children 1
-            (GraphicsLayer
-              (bounds 300.00 300.00)
-              (children 1
-                (GraphicsLayer
-                  (bounds 300.00 300.00)
-                  (drawsContent 1)
-                )
-              )
-            )
-          )
-        )
-      )
-    )
-  )
-)
</del><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimcompositingoverflowoverflowoverlaywithtouchnooverflowexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-overlay-with-touch-no-overflow-expected.txt (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-overlay-with-touch-no-overflow-expected.txt        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-overlay-with-touch-no-overflow-expected.txt        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -1,26 +1 @@
</span><del>-(GraphicsLayer
-  (bounds 800.00 600.00)
-  (children 1
-    (GraphicsLayer
-      (bounds 800.00 600.00)
-      (children 1
-        (GraphicsLayer
-          (position 8.00 8.00)
-          (bounds 300.00 300.00)
-          (children 1
-            (GraphicsLayer
-              (bounds 300.00 300.00)
-              (children 1
-                (GraphicsLayer
-                  (bounds 300.00 300.00)
-                  (drawsContent 1)
-                )
-              )
-            )
-          )
-        )
-      )
-    )
-  )
-)
</del><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimcompositingoverflowoverflowscrollwithtouchnooverflowexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-scroll-with-touch-no-overflow-expected.txt (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-scroll-with-touch-no-overflow-expected.txt        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/LayoutTests/platform/ios-sim/compositing/overflow/overflow-scroll-with-touch-no-overflow-expected.txt        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -1,26 +1 @@
</span><del>-(GraphicsLayer
-  (bounds 800.00 600.00)
-  (children 1
-    (GraphicsLayer
-      (bounds 800.00 600.00)
-      (children 1
-        (GraphicsLayer
-          (position 8.00 8.00)
-          (bounds 300.00 300.00)
-          (children 1
-            (GraphicsLayer
-              (bounds 300.00 300.00)
-              (children 1
-                (GraphicsLayer
-                  (bounds 300.00 300.00)
-                  (drawsContent 1)
-                )
-              )
-            )
-          )
-        )
-      )
-    )
-  )
-)
</del><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformiossimcompositingoverflowsubpixeloverflowexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-sim/compositing/overflow/subpixel-overflow-expected.txt (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-sim/compositing/overflow/subpixel-overflow-expected.txt        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/LayoutTests/platform/ios-sim/compositing/overflow/subpixel-overflow-expected.txt        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -3,65 +3,4 @@
</span><span class="cx"> Content
</span><span class="cx">  
</span><span class="cx"> Content
</span><del>- (GraphicsLayer
-  (bounds 800.00 600.00)
-  (children 1
-    (GraphicsLayer
-      (bounds 800.00 600.00)
-      (children 3
-        (GraphicsLayer
-          (position 18.00 18.00)
-          (bounds 202.00 202.50)
-          (drawsContent 1)
-          (children 1
-            (GraphicsLayer
-              (position 1.00 1.00)
-              (bounds 200.00 200.00)
-              (children 1
-                (GraphicsLayer
-                  (bounds 200.00 200.00)
-                  (drawsContent 1)
-                )
-              )
-            )
-          )
-        )
-        (GraphicsLayer
-          (position 244.00 18.00)
-          (bounds 202.00 202.50)
-          (drawsContent 1)
-          (children 1
-            (GraphicsLayer
-              (position 1.00 1.00)
-              (bounds 200.00 201.00)
-              (children 1
-                (GraphicsLayer
-                  (bounds 200.00 201.00)
-                  (drawsContent 1)
-                )
-              )
-            )
-          )
-        )
-        (GraphicsLayer
-          (position 470.00 18.00)
-          (bounds 202.00 203.00)
-          (drawsContent 1)
-          (children 1
-            (GraphicsLayer
-              (position 1.00 1.00)
-              (bounds 200.00 201.00)
-              (children 1
-                (GraphicsLayer
-                  (bounds 200.00 201.00)
-                  (drawsContent 1)
-                )
-              )
-            )
-          )
-        )
-      )
-    )
-  )
-)
</del><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/Source/WebCore/ChangeLog        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-05-02  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        [iOS WK2] Don't create backing store for -webkit-overflow-scrolling:touch that can't scroll
+        https://bugs.webkit.org/show_bug.cgi?id=132487
+        &lt;rdar://problem/16758041&gt;
+
+        Reviewed by Sam Weinig.
+
+        Previously, -webkit-overflow-scrolling:touch would cause us to make compositing
+        layers for any element that had overflow: auto or scroll on either axis. This
+        created lots of backing store when not required.
+        
+        Improve this to only create compositing for scrolling when there is actually
+        scrollable overflow. This makes things slightly more complex, because we can
+        only know when layout is up to date.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::computeRectForRepaint): usesCompositedScrolling() tells
+        us if we're actually doing composited overflow.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::hasTouchScrollableOverflow):
+        (WebCore::RenderLayer::handleTouchEvent):
+        * rendering/RenderLayer.h:
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::layerOrAncestorIsTransformedOrUsingCompositedScrolling):
+        (WebCore::RenderLayerBacking::updateGraphicsLayerConfiguration): Only update
+        scrolling and clipping layers if layout is not pending.
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+        (WebCore::RenderLayerBacking::updateScrollingLayers): The caller calls
+        updateInternalHierarchy(), so no need to do it here.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::requiresCompositingForScrolling): We
+        can only determine that we're scrollable after layout.
+        (WebCore::isStickyInAcceleratedScrollingLayerOrViewport):
+        (WebCore::isMainFrameScrollingOrOverflowScrolling):
+
</ins><span class="cx"> 2014-05-02  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Clean up FormDataElement
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderBoxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderBox.cpp        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -2176,7 +2176,7 @@
</span><span class="cx">     if (o-&gt;hasOverflowClip()) {
</span><span class="cx">         RenderBox* containerBox = toRenderBox(o);
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-        if (!containerBox-&gt;layer() || !containerBox-&gt;layer()-&gt;hasAcceleratedTouchScrolling()) {
</del><ins>+        if (!containerBox-&gt;layer() || !containerBox-&gt;layer()-&gt;usesCompositedScrolling()) {
</ins><span class="cx"> #endif
</span><span class="cx">         containerBox-&gt;applyCachedClipAndScrollOffsetForRepaint(rect);
</span><span class="cx">         if (rect.isEmpty())
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -2115,11 +2115,16 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS) &amp;&amp; ENABLE(TOUCH_EVENTS)
</del><ins>+bool RenderLayer::hasTouchScrollableOverflow() const
+{
+    return hasAcceleratedTouchScrolling() &amp;&amp; (hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
+}
+
+#if ENABLE(TOUCH_EVENTS)
</ins><span class="cx"> bool RenderLayer::handleTouchEvent(const PlatformTouchEvent&amp; touchEvent)
</span><span class="cx"> {
</span><span class="cx">     // If we have accelerated scrolling, let the scrolling be handled outside of WebKit.
</span><del>-    if (hasAcceleratedTouchScrolling())
</del><ins>+    if (hasTouchScrollableOverflow())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     return ScrollableArea::handleTouchEvent(touchEvent);
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayer.h (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayer.h        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/Source/WebCore/rendering/RenderLayer.h        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -460,6 +460,8 @@
</span><span class="cx"> 
</span><span class="cx">     // Returns true when the layer could do touch scrolling, but doesn't look at whether there is actually scrollable overflow.
</span><span class="cx">     bool hasAcceleratedTouchScrolling() const;
</span><ins>+    // Returns true when there is actually scrollable overflow (requires layout to be up-to-date).
+    bool hasTouchScrollableOverflow() const;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -406,7 +406,7 @@
</span><span class="cx">     for (RenderLayer* curr = &amp;layer; curr; curr = curr-&gt;parent()) {
</span><span class="cx">         if (curr-&gt;hasTransform()
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-            || curr-&gt;hasAcceleratedTouchScrolling()
</del><ins>+            || curr-&gt;hasTouchScrollableOverflow()
</ins><span class="cx"> #else
</span><span class="cx">             || curr-&gt;needsCompositedScrolling()
</span><span class="cx"> #endif
</span><span class="lines">@@ -536,29 +536,31 @@
</span><span class="cx">         layerConfigChanged = true;
</span><span class="cx">     
</span><span class="cx">     bool needsDescendentsClippingLayer = compositor().clipsCompositingDescendants(m_owningLayer);
</span><del>-    bool usesCompositedScrolling;
</del><ins>+
+    if (!renderer().view().needsLayout()) {
+        bool usesCompositedScrolling;
</ins><span class="cx"> #if PLATFORM(IOS)
</span><del>-    usesCompositedScrolling = m_owningLayer.hasAcceleratedTouchScrolling();
</del><ins>+        usesCompositedScrolling = m_owningLayer.hasTouchScrollableOverflow();
</ins><span class="cx"> #else
</span><del>-    usesCompositedScrolling = m_owningLayer.needsCompositedScrolling();
</del><ins>+        usesCompositedScrolling = m_owningLayer.needsCompositedScrolling();
</ins><span class="cx"> #endif
</span><ins>+        // Our scrolling layer will clip.
+        if (usesCompositedScrolling)
+            needsDescendentsClippingLayer = false;
</ins><span class="cx"> 
</span><del>-    // Our scrolling layer will clip.
-    if (usesCompositedScrolling)
-        needsDescendentsClippingLayer = false;
</del><ins>+        if (updateScrollingLayers(usesCompositedScrolling))
+            layerConfigChanged = true;
</ins><span class="cx"> 
</span><ins>+        if (updateDescendantClippingLayer(needsDescendentsClippingLayer))
+            layerConfigChanged = true;
+    }
+
</ins><span class="cx">     if (updateAncestorClippingLayer(compositor().clippedByAncestor(m_owningLayer)))
</span><span class="cx">         layerConfigChanged = true;
</span><span class="cx"> 
</span><del>-    if (updateDescendantClippingLayer(needsDescendentsClippingLayer))
-        layerConfigChanged = true;
-
</del><span class="cx">     if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), requiresVerticalScrollbarLayer(), requiresScrollCornerLayer()))
</span><span class="cx">         layerConfigChanged = true;
</span><span class="cx"> 
</span><del>-    if (updateScrollingLayers(usesCompositedScrolling))
-        layerConfigChanged = true;
-
</del><span class="cx">     if (layerConfigChanged)
</span><span class="cx">         updateInternalHierarchy();
</span><span class="cx"> 
</span><span class="lines">@@ -752,7 +754,7 @@
</span><span class="cx">         graphicsLayerParentLocation = renderer().view().documentRect().location();
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    if (compAncestor &amp;&amp; compAncestor-&gt;hasAcceleratedTouchScrolling()) {
</del><ins>+    if (compAncestor &amp;&amp; compAncestor-&gt;hasTouchScrollableOverflow()) {
</ins><span class="cx">         RenderBox* renderBox = toRenderBox(&amp;compAncestor-&gt;renderer());
</span><span class="cx">         LayoutRect paddingBox(renderBox-&gt;borderLeft(), renderBox-&gt;borderTop(),
</span><span class="cx">             renderBox-&gt;width() - renderBox-&gt;borderLeft() - renderBox-&gt;borderRight(),
</span><span class="lines">@@ -1440,7 +1442,6 @@
</span><span class="cx">         m_scrollingContentsLayer = nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    updateInternalHierarchy();
</del><span class="cx">     m_graphicsLayer-&gt;setPaintingPhase(paintingPhaseForPrimaryLayer());
</span><span class="cx">     m_graphicsLayer-&gt;setNeedsDisplay(); // Because painting phases changed.
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (168189 => 168190)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-05-02 21:21:04 UTC (rev 168189)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp        2014-05-02 21:24:54 UTC (rev 168190)
</span><span class="lines">@@ -2476,7 +2476,15 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> bool RenderLayerCompositor::requiresCompositingForScrolling(const RenderLayer&amp; layer) const
</span><span class="cx"> {
</span><del>-    return layer.hasAcceleratedTouchScrolling();
</del><ins>+    if (!layer.hasAcceleratedTouchScrolling())
+        return false;
+
+    if (!m_inPostLayoutUpdate) {
+        m_reevaluateCompositingAfterLayout = true;
+        return layer.isComposited();
+    }
+
+    return layer.hasTouchScrollableOverflow();
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -2499,7 +2507,7 @@
</span><span class="cx">     ASSERT(layer.renderer().isStickyPositioned());
</span><span class="cx"> 
</span><span class="cx">     RenderLayer* enclosingOverflowLayer = layer.enclosingOverflowClipLayer(ExcludeSelf);
</span><del>-    if (enclosingOverflowLayer &amp;&amp; enclosingOverflowLayer-&gt;hasAcceleratedTouchScrolling()) {
</del><ins>+    if (enclosingOverflowLayer &amp;&amp; enclosingOverflowLayer-&gt;hasTouchScrollableOverflow()) {
</ins><span class="cx">         if (enclosingAcceleratedOverflowLayer)
</span><span class="cx">             *enclosingAcceleratedOverflowLayer = enclosingOverflowLayer;
</span><span class="cx">         return true;
</span><span class="lines">@@ -2537,7 +2545,7 @@
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    return layer.hasAcceleratedTouchScrolling();
</del><ins>+    return layer.hasTouchScrollableOverflow();
</ins><span class="cx"> #else
</span><span class="cx">     return layer.needsCompositedScrolling();
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>