<!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>[245974] 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/245974">245974</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2019-05-31 11:55:14 -0700 (Fri, 31 May 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[Async overflow scrolling] Flashes of missing layer backing store when scrolling an overflow
https://bugs.webkit.org/show_bug.cgi?id=198363

Reviewed by Tim Horton.

Source/WebCore:

When the contents of an overflow:scroll did not use a tiled backing layer, GraphicsLayerCA::adjustCoverageRect()
would do no coverage rect expansion for scrolling, which meant that backing store attachment for
descendant layers would just use the visible rect from their scrolling ancestor which made it easy
to scroll into view a layer whose backing store was not yet attached.

Since this only affects non-tiled layers, re-use the generic TileController::adjustTileCoverageRect()
code by moving it down to GraphicsLayer, and call it for a scrolled contents layer which does not
have tiled backing.

Tested by fast/scrolling/ios/reconcile-layer-position-recursive.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::adjustCoverageRectForMovement):
* platform/graphics/GraphicsLayer.h:
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::adjustCoverageRect const):
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::adjustTileCoverageRect):

LayoutTests:

Reset results.

* fast/scrolling/ios/reconcile-layer-position-recursive-expected.txt:
* tiled-drawing/tiled-backing-in-window-expected.txt:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastscrollingiosreconcilelayerpositionrecursiveexpectedtxt">trunk/LayoutTests/fast/scrolling/ios/reconcile-layer-position-recursive-expected.txt</a></li>
<li><a href="#trunkLayoutTeststileddrawingtiledbackinginwindowexpectedtxt">trunk/LayoutTests/tiled-drawing/tiled-backing-in-window-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayercpp">trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsGraphicsLayerh">trunk/Source/WebCore/platform/graphics/GraphicsLayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp">trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaTileControllercpp">trunk/Source/WebCore/platform/graphics/ca/TileController.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (245973 => 245974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2019-05-31 18:16:45 UTC (rev 245973)
+++ trunk/LayoutTests/ChangeLog 2019-05-31 18:55:14 UTC (rev 245974)
</span><span class="lines">@@ -8,6 +8,18 @@
</span><span class="cx">         * webgpu/whlsl-store-to-property-updates-properly-expected.html: Added.
</span><span class="cx">         * webgpu/whlsl-store-to-property-updates-properly.html: Added.
</span><span class="cx"> 
</span><ins>+2019-05-31  Simon Fraser  <simon.fraser@apple.com>
+
+        [Async overflow scrolling] Flashes of missing layer backing store when scrolling an overflow
+        https://bugs.webkit.org/show_bug.cgi?id=198363
+
+        Reviewed by Tim Horton.
+
+        Reset results.
+
+        * fast/scrolling/ios/reconcile-layer-position-recursive-expected.txt:
+        * tiled-drawing/tiled-backing-in-window-expected.txt:
+
</ins><span class="cx"> 2019-05-31  Ryan Haddad  <ryanhaddad@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r245946.
</span></span></pre></div>
<a id="trunkLayoutTestsfastscrollingiosreconcilelayerpositionrecursiveexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/scrolling/ios/reconcile-layer-position-recursive-expected.txt (245973 => 245974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/scrolling/ios/reconcile-layer-position-recursive-expected.txt     2019-05-31 18:16:45 UTC (rev 245973)
+++ trunk/LayoutTests/fast/scrolling/ios/reconcile-layer-position-recursive-expected.txt        2019-05-31 18:55:14 UTC (rev 245974)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">                   (bounds 300.00 510.00)
</span><span class="cx">                   (drawsContent 1)
</span><span class="cx">                   (visible rect 0.00, 13.00 300.00 x 287.00)
</span><del>-                  (coverage rect 0.00, 13.00 300.00 x 287.00)
</del><ins>+                  (coverage rect 0.00, 12.00 300.00 x 288.00)
</ins><span class="cx">                   (intersects coverage rect 1)
</span><span class="cx">                   (contentsScale 2.00)
</span><span class="cx">                   (children 1
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">                       (bounds 210.00 410.00)
</span><span class="cx">                       (drawsContent 1)
</span><span class="cx">                       (visible rect 0.00, 0.00 210.00 x 250.00)
</span><del>-                      (coverage rect -50.00, -37.00 300.00 x 287.00)
</del><ins>+                      (coverage rect -50.00, -38.00 300.00 x 288.00)
</ins><span class="cx">                       (intersects coverage rect 1)
</span><span class="cx">                       (contentsScale 2.00)
</span><span class="cx">                       (children 1
</span></span></pre></div>
<a id="trunkLayoutTeststileddrawingtiledbackinginwindowexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/tiled-drawing/tiled-backing-in-window-expected.txt (245973 => 245974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/tiled-drawing/tiled-backing-in-window-expected.txt     2019-05-31 18:16:45 UTC (rev 245973)
+++ trunk/LayoutTests/tiled-drawing/tiled-backing-in-window-expected.txt        2019-05-31 18:55:14 UTC (rev 245974)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">           (usingTiledLayer 1)
</span><span class="cx">           (drawsContent 1)
</span><span class="cx">           (visible rect 0.00, 0.00 777.00 x 200.00)
</span><del>-          (coverage rect -8.00, -8.00 785.00 x 585.00)
</del><ins>+          (coverage rect 0.00, 0.00 777.00 x 200.00)
</ins><span class="cx">           (intersects coverage rect 1)
</span><span class="cx">           (contentsScale 1.00)
</span><span class="cx">           (tile cache coverage 0, 0 1024 x 200)
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (245973 => 245974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2019-05-31 18:16:45 UTC (rev 245973)
+++ trunk/Source/WebCore/ChangeLog      2019-05-31 18:55:14 UTC (rev 245974)
</span><span class="lines">@@ -21,6 +21,32 @@
</span><span class="cx">         * Modules/webgpu/WHLSL/Metal/WHLSLFunctionWriter.cpp:
</span><span class="cx">         (WebCore::WHLSL::Metal::FunctionDefinitionWriter::visit):
</span><span class="cx"> 
</span><ins>+2019-05-31  Simon Fraser  <simon.fraser@apple.com>
+
+        [Async overflow scrolling] Flashes of missing layer backing store when scrolling an overflow
+        https://bugs.webkit.org/show_bug.cgi?id=198363
+
+        Reviewed by Tim Horton.
+
+        When the contents of an overflow:scroll did not use a tiled backing layer, GraphicsLayerCA::adjustCoverageRect()
+        would do no coverage rect expansion for scrolling, which meant that backing store attachment for
+        descendant layers would just use the visible rect from their scrolling ancestor which made it easy
+        to scroll into view a layer whose backing store was not yet attached.
+        
+        Since this only affects non-tiled layers, re-use the generic TileController::adjustTileCoverageRect()
+        code by moving it down to GraphicsLayer, and call it for a scrolled contents layer which does not
+        have tiled backing.
+        
+        Tested by fast/scrolling/ios/reconcile-layer-position-recursive.html
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::adjustCoverageRectForMovement):
+        * platform/graphics/GraphicsLayer.h:
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::adjustCoverageRect const):
+        * platform/graphics/ca/TileController.cpp:
+        (WebCore::TileController::adjustTileCoverageRect):
+
</ins><span class="cx"> 2019-05-31  Geoffrey Garen  <ggaren@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Some WeakPtr cleanup
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (245973 => 245974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2019-05-31 18:16:45 UTC (rev 245973)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp    2019-05-31 18:55:14 UTC (rev 245974)
</span><span class="lines">@@ -502,6 +502,64 @@
</span><span class="cx">     client().paintContents(this, context, m_paintingPhase, clipRect, layerPaintBehavior);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+FloatRect GraphicsLayer::adjustCoverageRectForMovement(const FloatRect& coverageRect, const FloatRect& previousVisibleRect, const FloatRect& currentVisibleRect)
+{
+    // If the old visible rect is empty, we have no information about how the visible area is changing
+    // (maybe the layer was just created), so don't attempt to expand. Also don't attempt to expand if the rects don't overlap.
+    if (previousVisibleRect.isEmpty() || !currentVisibleRect.intersects(previousVisibleRect))
+        return unionRect(coverageRect, currentVisibleRect);
+
+    const float paddingMultiplier = 2;
+
+    float leftEdgeDelta = paddingMultiplier * (currentVisibleRect.x() - previousVisibleRect.x());
+    float rightEdgeDelta = paddingMultiplier * (currentVisibleRect.maxX() - previousVisibleRect.maxX());
+
+    float topEdgeDelta = paddingMultiplier * (currentVisibleRect.y() - previousVisibleRect.y());
+    float bottomEdgeDelta = paddingMultiplier * (currentVisibleRect.maxY() - previousVisibleRect.maxY());
+    
+    FloatRect expandedRect = currentVisibleRect;
+
+    // More exposed on left side.
+    if (leftEdgeDelta < 0) {
+        float newLeft = expandedRect.x() + leftEdgeDelta;
+        // Pad to the left, but don't reduce padding that's already in the backing store (since we're still exposing to the left).
+        if (newLeft < previousVisibleRect.x())
+            expandedRect.shiftXEdgeTo(newLeft);
+        else
+            expandedRect.shiftXEdgeTo(previousVisibleRect.x());
+    }
+
+    // More exposed on right.
+    if (rightEdgeDelta > 0) {
+        float newRight = expandedRect.maxX() + rightEdgeDelta;
+        // Pad to the right, but don't reduce padding that's already in the backing store (since we're still exposing to the right).
+        if (newRight > previousVisibleRect.maxX())
+            expandedRect.setWidth(newRight - expandedRect.x());
+        else
+            expandedRect.setWidth(previousVisibleRect.maxX() - expandedRect.x());
+    }
+
+    // More exposed at top.
+    if (topEdgeDelta < 0) {
+        float newTop = expandedRect.y() + topEdgeDelta;
+        if (newTop < previousVisibleRect.y())
+            expandedRect.shiftYEdgeTo(newTop);
+        else
+            expandedRect.shiftYEdgeTo(previousVisibleRect.y());
+    }
+
+    // More exposed on bottom.
+    if (bottomEdgeDelta > 0) {
+        float newBottom = expandedRect.maxY() + bottomEdgeDelta;
+        if (newBottom > previousVisibleRect.maxY())
+            expandedRect.setHeight(newBottom - expandedRect.y());
+        else
+            expandedRect.setHeight(previousVisibleRect.maxY() - expandedRect.y());
+    }
+    
+    return unionRect(coverageRect, expandedRect);
+}
+
</ins><span class="cx"> String GraphicsLayer::animationNameForTransition(AnimatedPropertyID property)
</span><span class="cx"> {
</span><span class="cx">     // | is not a valid identifier character in CSS, so this can never conflict with a keyframe identifier.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsGraphicsLayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (245973 => 245974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h   2019-05-31 18:16:45 UTC (rev 245973)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h      2019-05-31 18:55:14 UTC (rev 245974)
</span><span class="lines">@@ -576,6 +576,8 @@
</span><span class="cx">     // for example to allocate new tiles.
</span><span class="cx">     virtual bool visibleRectChangeRequiresFlush(const FloatRect& /* clipRect */) const { return false; }
</span><span class="cx"> 
</span><ins>+    static FloatRect adjustCoverageRectForMovement(const FloatRect& coverageRect, const FloatRect& previousVisibleRect, const FloatRect& currentVisibleRect);
+
</ins><span class="cx">     // Return a string with a human readable form of the layer tree, If debug is true
</span><span class="cx">     // pointers for the layers and timing data will be included in the returned string.
</span><span class="cx">     WEBCORE_EXPORT String layerTreeAsText(LayerTreeAsTextBehavior = LayerTreeAsTextBehaviorNormal) const;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (245973 => 245974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp    2019-05-31 18:16:45 UTC (rev 245973)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp       2019-05-31 18:55:14 UTC (rev 245974)
</span><span class="lines">@@ -1450,6 +1450,10 @@
</span><span class="cx">     case Type::ScrolledContents:
</span><span class="cx">         if (m_layer->usesTiledBackingLayer())
</span><span class="cx">             coverageRect = tiledBacking()->adjustTileCoverageRectForScrolling(coverageRect, size(), oldVisibleRect, rects.visibleRect, pageScaleFactor() * deviceScaleFactor());
</span><ins>+        else {
+            // Even if we don't have tiled backing, we want to expand coverage so that contained layers get attached backing store.
+            coverageRect = adjustCoverageRectForMovement(coverageRect, oldVisibleRect, rects.visibleRect);
+        }
</ins><span class="cx">         break;
</span><span class="cx">     case Type::Normal:
</span><span class="cx">         if (m_layer->usesTiledBackingLayer())
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaTileControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/TileController.cpp (245973 => 245974)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/TileController.cpp     2019-05-31 18:16:45 UTC (rev 245973)
+++ trunk/Source/WebCore/platform/graphics/ca/TileController.cpp        2019-05-31 18:55:14 UTC (rev 245974)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(CG)
</span><span class="cx"> 
</span><ins>+#include "GraphicsLayer.h"
</ins><span class="cx"> #include "IntRect.h"
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "PlatformCALayer.h"
</span><span class="lines">@@ -364,65 +365,11 @@
</span><span class="cx"> 
</span><span class="cx"> FloatRect TileController::adjustTileCoverageRect(const FloatRect& coverageRect, const FloatRect& previousVisibleRect, const FloatRect& currentVisibleRect, bool sizeChanged)
</span><span class="cx"> {
</span><del>-    // If the old visible rect is empty, we have no information about how the visible area is changing
-    // (maybe the layer was just created), so don't attempt to expand. Also don't attempt to expand
-    // if the size changed or the rects don't overlap.
-    if (previousVisibleRect.isEmpty() || sizeChanged  || !currentVisibleRect.intersects(previousVisibleRect))
</del><ins>+    if (sizeChanged || MemoryPressureHandler::singleton().isUnderMemoryPressure())
</ins><span class="cx">         return unionRect(coverageRect, currentVisibleRect);
</span><span class="cx"> 
</span><del>-    if (MemoryPressureHandler::singleton().isUnderMemoryPressure())
-        return unionRect(coverageRect, currentVisibleRect);
-
-    const float paddingMultiplier = 2;
-
-    float leftEdgeDelta = paddingMultiplier * (currentVisibleRect.x() - previousVisibleRect.x());
-    float rightEdgeDelta = paddingMultiplier * (currentVisibleRect.maxX() - previousVisibleRect.maxX());
-
-    float topEdgeDelta = paddingMultiplier * (currentVisibleRect.y() - previousVisibleRect.y());
-    float bottomEdgeDelta = paddingMultiplier * (currentVisibleRect.maxY() - previousVisibleRect.maxY());
-    
-    FloatRect expandedRect = currentVisibleRect;
-
-    // More exposed on left side.
-    if (leftEdgeDelta < 0) {
-        float newLeft = expandedRect.x() + leftEdgeDelta;
-        // Pad to the left, but don't reduce padding that's already in the backing store (since we're still exposing to the left).
-        if (newLeft < previousVisibleRect.x())
-            expandedRect.shiftXEdgeTo(newLeft);
-        else
-            expandedRect.shiftXEdgeTo(previousVisibleRect.x());
-    }
-
-    // More exposed on right.
-    if (rightEdgeDelta > 0) {
-        float newRight = expandedRect.maxX() + rightEdgeDelta;
-        // Pad to the right, but don't reduce padding that's already in the backing store (since we're still exposing to the right).
-        if (newRight > previousVisibleRect.maxX())
-            expandedRect.setWidth(newRight - expandedRect.x());
-        else
-            expandedRect.setWidth(previousVisibleRect.maxX() - expandedRect.x());
-    }
-
-    // More exposed at top.
-    if (topEdgeDelta < 0) {
-        float newTop = expandedRect.y() + topEdgeDelta;
-        if (newTop < previousVisibleRect.y())
-            expandedRect.shiftYEdgeTo(newTop);
-        else
-            expandedRect.shiftYEdgeTo(previousVisibleRect.y());
-    }
-
-    // More exposed on bottom.
-    if (bottomEdgeDelta > 0) {
-        float newBottom = expandedRect.maxY() + bottomEdgeDelta;
-        if (newBottom > previousVisibleRect.maxY())
-            expandedRect.setHeight(newBottom - expandedRect.y());
-        else
-            expandedRect.setHeight(previousVisibleRect.maxY() - expandedRect.y());
-    }
-    
-    expandedRect.intersect(boundsWithoutMargin());
-    return unionRect(coverageRect, expandedRect);
</del><ins>+    auto expandedCoverageRect = GraphicsLayer::adjustCoverageRectForMovement(coverageRect, previousVisibleRect, currentVisibleRect);
+    return intersection(expandedCoverageRect, boundsWithoutMargin());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !PLATFORM(IOS_FAMILY)
</span></span></pre>
</div>
</div>

</body>
</html>