<!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>[225089] 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/225089">225089</a></dd>
<dt>Author</dt> <dd>fred.wang@free.fr</dd>
<dt>Date</dt> <dd>2017-11-21 22:30:21 -0800 (Tue, 21 Nov 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>Async frame scrolling: handle fixed root backgrounds in frames
https://bugs.webkit.org/show_bug.cgi?id=176261

Source/WebCore:

Based on patch by Simon Fraser <simon.fraser@apple.com>
Patch by Frederic Wang <fwang@igalia.com> on 2017-11-21
Reviewed by Antonio Gomes.

For frames with tiled backing, we register a slow-repaint object because we hit
RenderElement::styleWillChange() before we've made a backing for the iframe's RenderView so
view().compositor().supportsFixedRootBackgroundCompositing() returns false. This patch
ensures that this object is removed when setBackgroundLayerPaintsFixedRootBackground is
called. It also removes the opaque background of non-main frames with tiled backing.
This fixes a possible hit of ASSERT(!m_backgroundLayer) after <a href="http://trac.webkit.org/projects/webkit/changeset/221615">r221615</a>.

Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGeometry): Do not set opaque contents for frames with
tiled backing. We keep !m_isMainFrameRenderViewLayer for backward compatibility with WK1.
(WebCore::RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground): Add an early
return when m_backgroundLayerPaintsFixedRootBackground is not changed. Remove the slow
repaint object previously registered for this frame. Also add an ASSERT to ensure that a
fixed root background is only set for frames with async scrolling.
(WebCore::RenderLayerBacking::updateRootLayerConfiguration): Restrict some special handling
of background and opaqueness to the main frame.

LayoutTests:

Patch by Frederic Wang <fwang@igalia.com> on 2017-11-21
Reviewed by Antonio Gomes.

Extend tiled-drawing-async-frame-scrolling with new test cases and update expectations.

* compositing/tiling/tiled-drawing-async-frame-scrolling.html: Add two test cases with
non-white and fixed gradient background. The latter exhibits a crash fixed by that commit.
* compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Adjust expectation due
to spacing changes.
* platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Ditto.
Update expectation for the first case to remove the white background and add expectations for
the two new cases.
* platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Ditto.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscompositingtilingtileddrawingasyncframescrollingexpectedtxt">trunk/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositingtilingtileddrawingasyncframescrollinghtml">trunk/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling.html</a></li>
<li><a href="#trunkLayoutTestsplatformioswk2compositingtilingtileddrawingasyncframescrollingexpectedtxt">trunk/LayoutTests/platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2compositingtilingtileddrawingasyncframescrollingexpectedtxt">trunk/LayoutTests/platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorerenderingRenderLayerBackingcpp">trunk/Source/WebCore/rendering/RenderLayerBacking.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (225088 => 225089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2017-11-22 01:02:24 UTC (rev 225088)
+++ trunk/LayoutTests/ChangeLog 2017-11-22 06:30:21 UTC (rev 225089)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2017-11-21  Frederic Wang  <fwang@igalia.com>
+
+        Async frame scrolling: handle fixed root backgrounds in frames
+        https://bugs.webkit.org/show_bug.cgi?id=176261
+
+        Reviewed by Antonio Gomes.
+
+        Extend tiled-drawing-async-frame-scrolling with new test cases and update expectations.
+
+        * compositing/tiling/tiled-drawing-async-frame-scrolling.html: Add two test cases with
+        non-white and fixed gradient background. The latter exhibits a crash fixed by that commit.
+        * compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Adjust expectation due
+        to spacing changes.
+        * platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Ditto.
+        Update expectation for the first case to remove the white background and add expectations for
+        the two new cases.
+        * platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt: Ditto.
+
</ins><span class="cx"> 2017-11-21  Ms2ger  <Ms2ger@igalia.com>
</span><span class="cx"> 
</span><span class="cx">         [GTK] Enable imported/w3c/web-platform-tests/url/failure.html
</span></span></pre></div>
<a id="trunkLayoutTestscompositingtilingtileddrawingasyncframescrollingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt (225088 => 225089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt    2017-11-22 01:02:24 UTC (rev 225088)
+++ trunk/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt       2017-11-22 06:30:21 UTC (rev 225089)
</span><span class="lines">@@ -1,2 +1,2 @@
</span><ins>+   
</ins><span class="cx"> 
</span><del>-
</del></span></pre></div>
<a id="trunkLayoutTestscompositingtilingtileddrawingasyncframescrollinghtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling.html (225088 => 225089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling.html    2017-11-22 01:02:24 UTC (rev 225088)
+++ trunk/LayoutTests/compositing/tiling/tiled-drawing-async-frame-scrolling.html       2017-11-22 06:30:21 UTC (rev 225089)
</span><span class="lines">@@ -18,10 +18,32 @@
</span><span class="cx">                 testRunner.notifyDone();
</span><span class="cx">             }
</span><span class="cx">         }
</span><ins>+
+       var frameToLoadCount = 3;
+       function newFrameLoaded() {
+           frameToLoadCount--;
+           if (frameToLoadCount === 0)
+               doTest();
+        }
</ins><span class="cx">     </script>
</span><ins>+    <style>
+        frame {
+            width: 200px;
+            height: 100px;
+        }
+    </style>
</ins><span class="cx">   </head>
</span><span class="cx">   <body>
</span><del>-    <iframe onload="setTimeout(doTest, 0)" id="frame" style="height: 100px; width: 200px;" scrolling="yes" srcdoc="&lt;div style='height: 300px; width: 400px;'&gt;&lt;/div&gt;"></iframe>
-    <pre id="layers">Layer tree goes here</p>
</del><ins>+    <iframe onload="newFrameLoaded()" scrolling="yes" srcdoc="<html style='
+            background: transparent;
+            height: 300px; width: 400px;'></html>"></iframe>
+    <iframe onload="newFrameLoaded()" scrolling="yes" srcdoc="<html style='
+            background: #ABCDEF;
+            height: 300px; width: 400px;'></html>"></iframe>
+    <iframe onload="newFrameLoaded()" scrolling="yes" srcdoc="<html style='
+            background-image: linear-gradient(45deg, black, white);
+            background-attachment: fixed;
+           height: 300px; width: 400px;'></html>"></iframe>
+    <pre id="layers">Layer tree goes here</pre>
</ins><span class="cx">   </body>
</span><span class="cx"> </html>
</span></span></pre></div>
<a id="trunkLayoutTestsplatformioswk2compositingtilingtileddrawingasyncframescrollingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt (225088 => 225089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt   2017-11-22 01:02:24 UTC (rev 225088)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt      2017-11-22 06:30:21 UTC (rev 225089)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-
</del><ins>+   
</ins><span class="cx"> (GraphicsLayer
</span><span class="cx">   (anchor 0.00 0.00)
</span><span class="cx">   (bounds 800.00 600.00)
</span><span class="lines">@@ -20,13 +20,13 @@
</span><span class="cx">       (tile size 800 x 600)
</span><span class="cx">       (top left tile 0, 0 tiles grid 1 x 1)
</span><span class="cx">       (in window 1)
</span><del>-      (children 1
</del><ins>+      (children 3
</ins><span class="cx">         (GraphicsLayer
</span><span class="cx">           (position 8.00 8.00)
</span><del>-          (bounds 204.00 104.00)
</del><ins>+          (bounds 304.00 154.00)
</ins><span class="cx">           (drawsContent 1)
</span><span class="cx">           (backingStoreAttached 1)
</span><del>-          (visible rect 0.00, 0.00 204.00 x 104.00)
</del><ins>+          (visible rect 0.00, 0.00 304.00 x 154.00)
</ins><span class="cx">           (coverage rect -8.00, -8.00 800.00 x 600.00)
</span><span class="cx">           (intersects coverage rect 1)
</span><span class="cx">           (contentsScale 2.00)
</span><span class="lines">@@ -41,10 +41,10 @@
</span><span class="cx">               (children 1
</span><span class="cx">                 (GraphicsLayer
</span><span class="cx">                   (anchor 0.00 0.00)
</span><del>-                  (bounds 200.00 100.00)
</del><ins>+                  (bounds 300.00 150.00)
</ins><span class="cx">                   (backingStoreAttached 1)
</span><del>-                  (visible rect 0.00, 0.00 200.00 x 100.00)
-                  (coverage rect 0.00, 0.00 200.00 x 100.00)
</del><ins>+                  (visible rect 0.00, 0.00 300.00 x 150.00)
+                  (coverage rect 0.00, 0.00 300.00 x 150.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">@@ -51,29 +51,28 @@
</span><span class="cx">                     (GraphicsLayer
</span><span class="cx">                       (backingStoreAttached 0)
</span><span class="cx">                       (visible rect 0.00, 0.00 0.00 x 0.00)
</span><del>-                      (coverage rect 0.00, 0.00 200.00 x 100.00)
</del><ins>+                      (coverage rect 0.00, 0.00 300.00 x 150.00)
</ins><span class="cx">                       (intersects coverage rect 0)
</span><span class="cx">                       (contentsScale 2.00)
</span><span class="cx">                       (children 1
</span><span class="cx">                         (GraphicsLayer
</span><span class="cx">                           (anchor 0.00 0.00)
</span><del>-                          (bounds 408.00 316.00)
</del><ins>+                          (bounds 400.00 300.00)
</ins><span class="cx">                           (backingStoreAttached 1)
</span><del>-                          (visible rect 0.00, 0.00 200.00 x 100.00)
-                          (coverage rect 0.00, 0.00 200.00 x 100.00)
</del><ins>+                          (visible rect 0.00, 0.00 300.00 x 150.00)
+                          (coverage rect 0.00, 0.00 300.00 x 150.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="cx">                             (GraphicsLayer
</span><del>-                              (bounds 408.00 316.00)
</del><ins>+                              (bounds 400.00 300.00)
</ins><span class="cx">                               (drawsContent 1)
</span><del>-                              (backgroundColor #FFFFFF)
</del><span class="cx">                               (backingStoreAttached 1)
</span><del>-                              (visible rect 0.00, 0.00 200.00 x 100.00)
-                              (coverage rect 0.00, 0.00 200.00 x 100.00)
</del><ins>+                              (visible rect 0.00, 0.00 300.00 x 150.00)
+                              (coverage rect 0.00, 0.00 300.00 x 150.00)
</ins><span class="cx">                               (intersects coverage rect 1)
</span><span class="cx">                               (contentsScale 2.00)
</span><del>-                              (tile cache coverage 0, 0 408 x 316)
</del><ins>+                              (tile cache coverage 0, 0 400 x 300)
</ins><span class="cx">                               (tile size 512 x 512)
</span><span class="cx">                               (top left tile 0, 0 tiles grid 1 x 1)
</span><span class="cx">                               (in window 1)
</span><span class="lines">@@ -81,7 +80,7 @@
</span><span class="cx">                                 (GraphicsLayer
</span><span class="cx">                                   (backingStoreAttached 0)
</span><span class="cx">                                   (visible rect 0.00, 0.00 0.00 x 0.00)
</span><del>-                                  (coverage rect 0.00, 0.00 200.00 x 100.00)
</del><ins>+                                  (coverage rect 0.00, 0.00 300.00 x 150.00)
</ins><span class="cx">                                   (intersects coverage rect 0)
</span><span class="cx">                                   (contentsScale 2.00)
</span><span class="cx">                                 )
</span><span class="lines">@@ -97,6 +96,156 @@
</span><span class="cx">             )
</span><span class="cx">           )
</span><span class="cx">         )
</span><ins>+        (GraphicsLayer
+          (position 316.00 8.00)
+          (bounds 304.00 154.00)
+          (drawsContent 1)
+          (backingStoreAttached 1)
+          (visible rect 0.00, 0.00 304.00 x 154.00)
+          (coverage rect -316.00, -8.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 2.00)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (backingStoreAttached 0)
+              (visible rect 0.00, 0.00 0.00 x 0.00)
+              (coverage rect -318.00, -10.00 800.00 x 600.00)
+              (intersects coverage rect 0)
+              (contentsScale 2.00)
+              (children 1
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 300.00 150.00)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 300.00 x 150.00)
+                  (coverage rect 0.00, 0.00 300.00 x 150.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 2.00)
+                  (children 1
+                    (GraphicsLayer
+                      (backingStoreAttached 0)
+                      (visible rect 0.00, 0.00 0.00 x 0.00)
+                      (coverage rect 0.00, 0.00 300.00 x 150.00)
+                      (intersects coverage rect 0)
+                      (contentsScale 2.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 400.00 300.00)
+                          (backingStoreAttached 1)
+                          (visible rect 0.00, 0.00 300.00 x 150.00)
+                          (coverage rect 0.00, 0.00 300.00 x 150.00)
+                          (intersects coverage rect 1)
+                          (contentsScale 2.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 400.00 300.00)
+                              (drawsContent 1)
+                              (backingStoreAttached 1)
+                              (visible rect 0.00, 0.00 300.00 x 150.00)
+                              (coverage rect 0.00, 0.00 300.00 x 150.00)
+                              (intersects coverage rect 1)
+                              (contentsScale 2.00)
+                              (tile cache coverage 0, 0 400 x 300)
+                              (tile size 512 x 512)
+                              (top left tile 0, 0 tiles grid 1 x 1)
+                              (in window 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (backingStoreAttached 0)
+                                  (visible rect 0.00, 0.00 0.00 x 0.00)
+                                  (coverage rect 0.00, 0.00 300.00 x 150.00)
+                                  (intersects coverage rect 0)
+                                  (contentsScale 2.00)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 167.00)
+          (bounds 304.00 154.00)
+          (drawsContent 1)
+          (backingStoreAttached 1)
+          (visible rect 0.00, 0.00 304.00 x 154.00)
+          (coverage rect -8.00, -167.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 2.00)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (backingStoreAttached 0)
+              (visible rect 0.00, 0.00 0.00 x 0.00)
+              (coverage rect -10.00, -169.00 800.00 x 600.00)
+              (intersects coverage rect 0)
+              (contentsScale 2.00)
+              (children 1
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 300.00 150.00)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 300.00 x 150.00)
+                  (coverage rect 0.00, 0.00 300.00 x 150.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 2.00)
+                  (children 1
+                    (GraphicsLayer
+                      (backingStoreAttached 0)
+                      (visible rect 0.00, 0.00 0.00 x 0.00)
+                      (coverage rect 0.00, 0.00 300.00 x 150.00)
+                      (intersects coverage rect 0)
+                      (contentsScale 2.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 400.00 300.00)
+                          (backingStoreAttached 1)
+                          (visible rect 0.00, 0.00 300.00 x 150.00)
+                          (coverage rect 0.00, 0.00 300.00 x 150.00)
+                          (intersects coverage rect 1)
+                          (contentsScale 2.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 400.00 300.00)
+                              (drawsContent 1)
+                              (backingStoreAttached 1)
+                              (visible rect 0.00, 0.00 300.00 x 150.00)
+                              (coverage rect 0.00, 0.00 300.00 x 150.00)
+                              (intersects coverage rect 1)
+                              (contentsScale 2.00)
+                              (tile cache coverage 0, 0 400 x 300)
+                              (tile size 512 x 512)
+                              (top left tile 0, 0 tiles grid 1 x 1)
+                              (in window 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (backingStoreAttached 0)
+                                  (visible rect 0.00, 0.00 0.00 x 0.00)
+                                  (coverage rect 0.00, 0.00 300.00 x 150.00)
+                                  (intersects coverage rect 0)
+                                  (contentsScale 2.00)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
</ins><span class="cx">       )
</span><span class="cx">     )
</span><span class="cx">   )
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2compositingtilingtileddrawingasyncframescrollingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt (225088 => 225089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt   2017-11-22 01:02:24 UTC (rev 225088)
+++ trunk/LayoutTests/platform/mac-wk2/compositing/tiling/tiled-drawing-async-frame-scrolling-expected.txt      2017-11-22 06:30:21 UTC (rev 225089)
</span><span class="lines">@@ -1,4 +1,4 @@
</span><del>-
</del><ins>+   
</ins><span class="cx"> (GraphicsLayer
</span><span class="cx">   (anchor 0.00 0.00)
</span><span class="cx">   (bounds 800.00 600.00)
</span><span class="lines">@@ -20,13 +20,13 @@
</span><span class="cx">       (tile size 800 x 600)
</span><span class="cx">       (top left tile 0, 0 tiles grid 1 x 1)
</span><span class="cx">       (in window 1)
</span><del>-      (children 1
</del><ins>+      (children 3
</ins><span class="cx">         (GraphicsLayer
</span><span class="cx">           (position 8.00 8.00)
</span><del>-          (bounds 204.00 104.00)
</del><ins>+          (bounds 304.00 154.00)
</ins><span class="cx">           (drawsContent 1)
</span><span class="cx">           (backingStoreAttached 1)
</span><del>-          (visible rect 0.00, 0.00 204.00 x 104.00)
</del><ins>+          (visible rect 0.00, 0.00 304.00 x 154.00)
</ins><span class="cx">           (coverage rect -8.00, -8.00 800.00 x 600.00)
</span><span class="cx">           (intersects coverage rect 1)
</span><span class="cx">           (contentsScale 1.00)
</span><span class="lines">@@ -41,10 +41,10 @@
</span><span class="cx">               (children 4
</span><span class="cx">                 (GraphicsLayer
</span><span class="cx">                   (anchor 0.00 0.00)
</span><del>-                  (bounds 185.00 85.00)
</del><ins>+                  (bounds 285.00 135.00)
</ins><span class="cx">                   (backingStoreAttached 1)
</span><del>-                  (visible rect 0.00, 0.00 185.00 x 85.00)
-                  (coverage rect 0.00, 0.00 185.00 x 85.00)
</del><ins>+                  (visible rect 0.00, 0.00 285.00 x 135.00)
+                  (coverage rect 0.00, 0.00 285.00 x 135.00)
</ins><span class="cx">                   (intersects coverage rect 1)
</span><span class="cx">                   (contentsScale 1.00)
</span><span class="cx">                   (children 1
</span><span class="lines">@@ -51,29 +51,28 @@
</span><span class="cx">                     (GraphicsLayer
</span><span class="cx">                       (backingStoreAttached 0)
</span><span class="cx">                       (visible rect 0.00, 0.00 0.00 x 0.00)
</span><del>-                      (coverage rect 0.00, 0.00 185.00 x 85.00)
</del><ins>+                      (coverage rect 0.00, 0.00 285.00 x 135.00)
</ins><span class="cx">                       (intersects coverage rect 0)
</span><span class="cx">                       (contentsScale 1.00)
</span><span class="cx">                       (children 1
</span><span class="cx">                         (GraphicsLayer
</span><span class="cx">                           (anchor 0.00 0.00)
</span><del>-                          (bounds 408.00 316.00)
</del><ins>+                          (bounds 400.00 300.00)
</ins><span class="cx">                           (backingStoreAttached 1)
</span><del>-                          (visible rect 0.00, 0.00 185.00 x 85.00)
-                          (coverage rect 0.00, 0.00 185.00 x 85.00)
</del><ins>+                          (visible rect 0.00, 0.00 285.00 x 135.00)
+                          (coverage rect 0.00, 0.00 285.00 x 135.00)
</ins><span class="cx">                           (intersects coverage rect 1)
</span><span class="cx">                           (contentsScale 1.00)
</span><span class="cx">                           (children 1
</span><span class="cx">                             (GraphicsLayer
</span><del>-                              (bounds 408.00 316.00)
</del><ins>+                              (bounds 400.00 300.00)
</ins><span class="cx">                               (drawsContent 1)
</span><del>-                              (backgroundColor #FFFFFF)
</del><span class="cx">                               (backingStoreAttached 1)
</span><del>-                              (visible rect 0.00, 0.00 185.00 x 85.00)
-                              (coverage rect 0.00, 0.00 185.00 x 85.00)
</del><ins>+                              (visible rect 0.00, 0.00 285.00 x 135.00)
+                              (coverage rect 0.00, 0.00 285.00 x 135.00)
</ins><span class="cx">                               (intersects coverage rect 1)
</span><span class="cx">                               (contentsScale 1.00)
</span><del>-                              (tile cache coverage 0, 0 408 x 316)
</del><ins>+                              (tile cache coverage 0, 0 400 x 300)
</ins><span class="cx">                               (tile size 512 x 512)
</span><span class="cx">                               (top left tile 0, 0 tiles grid 1 x 1)
</span><span class="cx">                               (in window 1)
</span><span class="lines">@@ -81,7 +80,7 @@
</span><span class="cx">                                 (GraphicsLayer
</span><span class="cx">                                   (backingStoreAttached 0)
</span><span class="cx">                                   (visible rect 0.00, 0.00 0.00 x 0.00)
</span><del>-                                  (coverage rect 0.00, 0.00 185.00 x 85.00)
</del><ins>+                                  (coverage rect 0.00, 0.00 285.00 x 135.00)
</ins><span class="cx">                                   (intersects coverage rect 0)
</span><span class="cx">                                   (contentsScale 1.00)
</span><span class="cx">                                 )
</span><span class="lines">@@ -94,32 +93,32 @@
</span><span class="cx">                   )
</span><span class="cx">                 )
</span><span class="cx">                 (GraphicsLayer
</span><del>-                  (position 0.00 85.00)
-                  (bounds 185.00 15.00)
</del><ins>+                  (position 0.00 135.00)
+                  (bounds 285.00 15.00)
</ins><span class="cx">                   (drawsContent 1)
</span><span class="cx">                   (backingStoreAttached 1)
</span><del>-                  (visible rect 0.00, 0.00 185.00 x 15.00)
-                  (coverage rect -10.00, -95.00 800.00 x 600.00)
</del><ins>+                  (visible rect 0.00, 0.00 285.00 x 15.00)
+                  (coverage rect -10.00, -145.00 800.00 x 600.00)
</ins><span class="cx">                   (intersects coverage rect 1)
</span><span class="cx">                   (contentsScale 1.00)
</span><span class="cx">                 )
</span><span class="cx">                 (GraphicsLayer
</span><del>-                  (position 185.00 0.00)
-                  (bounds 15.00 85.00)
</del><ins>+                  (position 285.00 0.00)
+                  (bounds 15.00 135.00)
</ins><span class="cx">                   (drawsContent 1)
</span><span class="cx">                   (backingStoreAttached 1)
</span><del>-                  (visible rect 0.00, 0.00 15.00 x 85.00)
-                  (coverage rect -195.00, -10.00 800.00 x 600.00)
</del><ins>+                  (visible rect 0.00, 0.00 15.00 x 135.00)
+                  (coverage rect -295.00, -10.00 800.00 x 600.00)
</ins><span class="cx">                   (intersects coverage rect 1)
</span><span class="cx">                   (contentsScale 1.00)
</span><span class="cx">                 )
</span><span class="cx">                 (GraphicsLayer
</span><del>-                  (position 185.00 85.00)
</del><ins>+                  (position 285.00 135.00)
</ins><span class="cx">                   (bounds 15.00 15.00)
</span><span class="cx">                   (drawsContent 1)
</span><span class="cx">                   (backingStoreAttached 1)
</span><span class="cx">                   (visible rect 0.00, 0.00 15.00 x 15.00)
</span><del>-                  (coverage rect -195.00, -95.00 800.00 x 600.00)
</del><ins>+                  (coverage rect -295.00, -145.00 800.00 x 600.00)
</ins><span class="cx">                   (intersects coverage rect 1)
</span><span class="cx">                   (contentsScale 1.00)
</span><span class="cx">                 )
</span><span class="lines">@@ -127,6 +126,236 @@
</span><span class="cx">             )
</span><span class="cx">           )
</span><span class="cx">         )
</span><ins>+        (GraphicsLayer
+          (position 316.00 8.00)
+          (bounds 304.00 154.00)
+          (drawsContent 1)
+          (backingStoreAttached 1)
+          (visible rect 0.00, 0.00 304.00 x 154.00)
+          (coverage rect -316.00, -8.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 1.00)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (backingStoreAttached 0)
+              (visible rect 0.00, 0.00 0.00 x 0.00)
+              (coverage rect -318.00, -10.00 800.00 x 600.00)
+              (intersects coverage rect 0)
+              (contentsScale 1.00)
+              (children 4
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 285.00 135.00)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 285.00 x 135.00)
+                  (coverage rect 0.00, 0.00 285.00 x 135.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                  (children 1
+                    (GraphicsLayer
+                      (backingStoreAttached 0)
+                      (visible rect 0.00, 0.00 0.00 x 0.00)
+                      (coverage rect 0.00, 0.00 285.00 x 135.00)
+                      (intersects coverage rect 0)
+                      (contentsScale 1.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 400.00 300.00)
+                          (backingStoreAttached 1)
+                          (visible rect 0.00, 0.00 285.00 x 135.00)
+                          (coverage rect 0.00, 0.00 285.00 x 135.00)
+                          (intersects coverage rect 1)
+                          (contentsScale 1.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 400.00 300.00)
+                              (drawsContent 1)
+                              (backingStoreAttached 1)
+                              (visible rect 0.00, 0.00 285.00 x 135.00)
+                              (coverage rect 0.00, 0.00 285.00 x 135.00)
+                              (intersects coverage rect 1)
+                              (contentsScale 1.00)
+                              (tile cache coverage 0, 0 400 x 300)
+                              (tile size 512 x 512)
+                              (top left tile 0, 0 tiles grid 1 x 1)
+                              (in window 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (backingStoreAttached 0)
+                                  (visible rect 0.00, 0.00 0.00 x 0.00)
+                                  (coverage rect 0.00, 0.00 285.00 x 135.00)
+                                  (intersects coverage rect 0)
+                                  (contentsScale 1.00)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+                (GraphicsLayer
+                  (position 0.00 135.00)
+                  (bounds 285.00 15.00)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 285.00 x 15.00)
+                  (coverage rect -318.00, -145.00 800.00 x 600.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                )
+                (GraphicsLayer
+                  (position 285.00 0.00)
+                  (bounds 15.00 135.00)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 15.00 x 135.00)
+                  (coverage rect -603.00, -10.00 800.00 x 600.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                )
+                (GraphicsLayer
+                  (position 285.00 135.00)
+                  (bounds 15.00 15.00)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 15.00 x 15.00)
+                  (coverage rect -603.00, -145.00 800.00 x 600.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 166.00)
+          (bounds 304.00 154.00)
+          (drawsContent 1)
+          (backingStoreAttached 1)
+          (visible rect 0.00, 0.00 304.00 x 154.00)
+          (coverage rect -8.00, -166.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 1.00)
+          (children 1
+            (GraphicsLayer
+              (position 2.00 2.00)
+              (backingStoreAttached 0)
+              (visible rect 0.00, 0.00 0.00 x 0.00)
+              (coverage rect -10.00, -168.00 800.00 x 600.00)
+              (intersects coverage rect 0)
+              (contentsScale 1.00)
+              (children 4
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 285.00 135.00)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 285.00 x 135.00)
+                  (coverage rect 0.00, 0.00 285.00 x 135.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                  (children 1
+                    (GraphicsLayer
+                      (backingStoreAttached 0)
+                      (visible rect 0.00, 0.00 0.00 x 0.00)
+                      (coverage rect 0.00, 0.00 285.00 x 135.00)
+                      (intersects coverage rect 0)
+                      (contentsScale 1.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 400.00 300.00)
+                          (backingStoreAttached 1)
+                          (visible rect 0.00, 0.00 285.00 x 135.00)
+                          (coverage rect 0.00, 0.00 285.00 x 135.00)
+                          (intersects coverage rect 1)
+                          (contentsScale 1.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 400.00 300.00)
+                              (backingStoreAttached 1)
+                              (visible rect 0.00, 0.00 285.00 x 135.00)
+                              (coverage rect 0.00, 0.00 285.00 x 135.00)
+                              (intersects coverage rect 1)
+                              (contentsScale 1.00)
+                              (children 2
+                                (GraphicsLayer
+                                  (anchor 0.00 0.00)
+                                  (bounds 285.00 135.00)
+                                  (drawsContent 1)
+                                  (backingStoreAttached 1)
+                                  (visible rect 0.00, 0.00 285.00 x 135.00)
+                                  (coverage rect 0.00, 0.00 285.00 x 135.00)
+                                  (intersects coverage rect 1)
+                                  (contentsScale 1.00)
+                                )
+                                (GraphicsLayer
+                                  (bounds 400.00 300.00)
+                                  (drawsContent 1)
+                                  (backingStoreAttached 1)
+                                  (visible rect 0.00, 0.00 285.00 x 135.00)
+                                  (coverage rect 0.00, 0.00 285.00 x 135.00)
+                                  (intersects coverage rect 1)
+                                  (contentsScale 1.00)
+                                  (tile cache coverage 0, 0 400 x 300)
+                                  (tile size 512 x 512)
+                                  (top left tile 0, 0 tiles grid 1 x 1)
+                                  (in window 1)
+                                  (children 1
+                                    (GraphicsLayer
+                                      (backingStoreAttached 0)
+                                      (visible rect 0.00, 0.00 0.00 x 0.00)
+                                      (coverage rect 0.00, 0.00 285.00 x 135.00)
+                                      (intersects coverage rect 0)
+                                      (contentsScale 1.00)
+                                    )
+                                  )
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+                (GraphicsLayer
+                  (position 0.00 135.00)
+                  (bounds 285.00 15.00)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 285.00 x 15.00)
+                  (coverage rect -10.00, -303.00 800.00 x 600.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                )
+                (GraphicsLayer
+                  (position 285.00 0.00)
+                  (bounds 15.00 135.00)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 15.00 x 135.00)
+                  (coverage rect -295.00, -168.00 800.00 x 600.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                )
+                (GraphicsLayer
+                  (position 285.00 135.00)
+                  (bounds 15.00 15.00)
+                  (drawsContent 1)
+                  (backingStoreAttached 1)
+                  (visible rect 0.00, 0.00 15.00 x 15.00)
+                  (coverage rect -295.00, -303.00 800.00 x 600.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 1.00)
+                )
+              )
+            )
+          )
+        )
</ins><span class="cx">       )
</span><span class="cx">     )
</span><span class="cx">   )
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (225088 => 225089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog   2017-11-22 01:02:24 UTC (rev 225088)
+++ trunk/Source/WebCore/ChangeLog      2017-11-22 06:30:21 UTC (rev 225089)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2017-11-21  Frederic Wang  <fwang@igalia.com>
+
+        Async frame scrolling: handle fixed root backgrounds in frames
+        https://bugs.webkit.org/show_bug.cgi?id=176261
+
+        Based on patch by Simon Fraser <simon.fraser@apple.com>
+        Reviewed by Antonio Gomes.
+
+        For frames with tiled backing, we register a slow-repaint object because we hit
+        RenderElement::styleWillChange() before we've made a backing for the iframe's RenderView so
+        view().compositor().supportsFixedRootBackgroundCompositing() returns false. This patch
+        ensures that this object is removed when setBackgroundLayerPaintsFixedRootBackground is
+        called. It also removes the opaque background of non-main frames with tiled backing.
+        This fixes a possible hit of ASSERT(!m_backgroundLayer) after r221615.
+
+        Test: compositing/tiling/tiled-drawing-async-frame-scrolling.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGeometry): Do not set opaque contents for frames with
+        tiled backing. We keep !m_isMainFrameRenderViewLayer for backward compatibility with WK1.
+        (WebCore::RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground): Add an early
+        return when m_backgroundLayerPaintsFixedRootBackground is not changed. Remove the slow
+        repaint object previously registered for this frame. Also add an ASSERT to ensure that a
+        fixed root background is only set for frames with async scrolling.
+        (WebCore::RenderLayerBacking::updateRootLayerConfiguration): Restrict some special handling
+        of background and opaqueness to the main frame.
+
</ins><span class="cx"> 2017-11-21  Simon Fraser  <simon.fraser@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Some FELighting cleanup
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingRenderLayerBackingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (225088 => 225089)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp    2017-11-22 01:02:24 UTC (rev 225088)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp       2017-11-22 06:30:21 UTC (rev 225089)
</span><span class="lines">@@ -1019,7 +1019,7 @@
</span><span class="cx">         positionOverflowControlsLayers();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!m_isMainFrameRenderViewLayer) {
</del><ins>+    if (!m_isMainFrameRenderViewLayer && !m_isFrameLayerWithTiledBacking) {
</ins><span class="cx">         // For non-root layers, background is always painted by the primary graphics layer.
</span><span class="cx">         ASSERT(!m_backgroundLayer);
</span><span class="cx">         // Subpixel offset from graphics layer or size changed.
</span><span class="lines">@@ -1421,7 +1421,15 @@
</span><span class="cx"> 
</span><span class="cx"> void RenderLayerBacking::setBackgroundLayerPaintsFixedRootBackground(bool backgroundLayerPaintsFixedRootBackground)
</span><span class="cx"> {
</span><ins>+    if (backgroundLayerPaintsFixedRootBackground == m_backgroundLayerPaintsFixedRootBackground)
+        return;
+
</ins><span class="cx">     m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootBackground;
</span><ins>+
+    if (m_backgroundLayerPaintsFixedRootBackground) {
+        ASSERT(m_isFrameLayerWithTiledBacking);
+        renderer().view().frameView().removeSlowRepaintObject(renderer().view().rendererForRootBackground());
+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RenderLayerBacking::requiresHorizontalScrollbarLayer() const
</span><span class="lines">@@ -1923,12 +1931,14 @@
</span><span class="cx">     bool viewIsTransparent = compositor().viewHasTransparentBackground(&backgroundColor);
</span><span class="cx"> 
</span><span class="cx">     if (m_backgroundLayerPaintsFixedRootBackground && m_backgroundLayer) {
</span><del>-        m_backgroundLayer->setBackgroundColor(backgroundColor);
-        m_backgroundLayer->setContentsOpaque(!viewIsTransparent);
</del><ins>+        if (m_isMainFrameRenderViewLayer) {
+            m_backgroundLayer->setBackgroundColor(backgroundColor);
+            m_backgroundLayer->setContentsOpaque(!viewIsTransparent);
+        }
</ins><span class="cx"> 
</span><span class="cx">         m_graphicsLayer->setBackgroundColor(Color());
</span><span class="cx">         m_graphicsLayer->setContentsOpaque(false);
</span><del>-    } else {
</del><ins>+    } else if (m_isMainFrameRenderViewLayer) {
</ins><span class="cx">         m_graphicsLayer->setBackgroundColor(backgroundColor);
</span><span class="cx">         m_graphicsLayer->setContentsOpaque(!viewIsTransparent);
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>