<!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>[182669] 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/182669">182669</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-04-12 10:30:58 -0700 (Sun, 12 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Too much repainting on scrolling with fixed backgrounds
https://bugs.webkit.org/show_bug.cgi?id=143637
rdar://problem/20245243

Reviewed by Darin Adler.

Source/WebCore:

FrameView::scrollContentsSlowPath() would repaint the entire viewport if there were
any slow-repaint objects (those with background-attachment: fixed) and the contents
were using compositing for scrolling.

This is wrong; we only need to issue repaint for the slow-repaint renderers,
and, if the frame is hosted in a compositing layer and not using compositing for scrolling,
repaint that hosting layer.

Tests: compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint.html
       compositing/repaint/iframes/compositing-iframe-scroll-repaint.html
       compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint.html
       platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint.html

* page/FrameView.cpp:
(WebCore::FrameView::scrollContentsSlowPath):

LayoutTests:

Tests with various configurations of iframes and compositing, which dump layer trees with
repaint rectangles.

Also tiled-scrolling test that exercises the simple case.

Put WebKit1-specific results in platform/mac-wk1, since they are very different from
WK2 and other platforms, due to WK1-specific layer hosting and repaint behaviors.

* compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt: Added.
* compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint.html: Added.
* compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt: Added.
* compositing/repaint/iframes/compositing-iframe-scroll-repaint.html: Added.
* compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt: Added.
* compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint.html: Added.
* compositing/repaint/iframes/resources/compositing-document.html: Added.
* compositing/repaint/iframes/resources/compositing-fixed-background-document.html: Added.
* compositing/repaint/iframes/resources/fixed-background-document.html: Added.
* platform/mac-wk1/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt: Added.
* platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt: Added.
* platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt: Added.
* platform/mac-wk2/compositing/repaint/fixed-background-scroll-expected.txt:
* platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint-expected.txt: Added.
* platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2compositingrepaintfixedbackgroundscrollexpectedtxt">trunk/LayoutTests/platform/mac-wk2/compositing/repaint/fixed-background-scroll-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/LayoutTests/compositing/repaint/iframes/</li>
<li><a href="#trunkLayoutTestscompositingrepaintiframescompositediframewithfixedbackgrounddocrepaintexpectedtxt">trunk/LayoutTests/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositingrepaintiframescompositediframewithfixedbackgrounddocrepainthtml">trunk/LayoutTests/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint.html</a></li>
<li><a href="#trunkLayoutTestscompositingrepaintiframescompositingiframescrollrepaintexpectedtxt">trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositingrepaintiframescompositingiframescrollrepainthtml">trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint.html</a></li>
<li><a href="#trunkLayoutTestscompositingrepaintiframescompositingiframewithfixedbackgrounddocrepaintexpectedtxt">trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt</a></li>
<li><a href="#trunkLayoutTestscompositingrepaintiframescompositingiframewithfixedbackgrounddocrepainthtml">trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint.html</a></li>
<li>trunk/LayoutTests/compositing/repaint/iframes/resources/</li>
<li><a href="#trunkLayoutTestscompositingrepaintiframesresourcescompositingdocumenthtml">trunk/LayoutTests/compositing/repaint/iframes/resources/compositing-document.html</a></li>
<li><a href="#trunkLayoutTestscompositingrepaintiframesresourcescompositingfixedbackgrounddocumenthtml">trunk/LayoutTests/compositing/repaint/iframes/resources/compositing-fixed-background-document.html</a></li>
<li><a href="#trunkLayoutTestscompositingrepaintiframesresourcesfixedbackgrounddocumenthtml">trunk/LayoutTests/compositing/repaint/iframes/resources/fixed-background-document.html</a></li>
<li>trunk/LayoutTests/platform/mac-wk1/compositing/</li>
<li>trunk/LayoutTests/platform/mac-wk1/compositing/repaint/</li>
<li>trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/</li>
<li><a href="#trunkLayoutTestsplatformmacwk1compositingrepaintiframescompositediframewithfixedbackgrounddocrepaintexpectedtxt">trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1compositingrepaintiframescompositingiframescrollrepaintexpectedtxt">trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk1compositingrepaintiframescompositingiframewithfixedbackgrounddocrepaintexpectedtxt">trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingfixedbackgroundscrollrepaintexpectedtxt">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacwk2tileddrawingfixedbackgroundscrollrepainthtml">trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (182668 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-04-12 09:50:40 UTC (rev 182668)
+++ trunk/LayoutTests/ChangeLog        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2015-04-12  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Too much repainting on scrolling with fixed backgrounds
+        https://bugs.webkit.org/show_bug.cgi?id=143637
+        rdar://problem/20245243
+
+        Reviewed by Darin Adler.
+        
+        Tests with various configurations of iframes and compositing, which dump layer trees with
+        repaint rectangles.
+        
+        Also tiled-scrolling test that exercises the simple case.
+        
+        Put WebKit1-specific results in platform/mac-wk1, since they are very different from
+        WK2 and other platforms, due to WK1-specific layer hosting and repaint behaviors.
+
+        * compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt: Added.
+        * compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint.html: Added.
+        * compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt: Added.
+        * compositing/repaint/iframes/compositing-iframe-scroll-repaint.html: Added.
+        * compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt: Added.
+        * compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint.html: Added.
+        * compositing/repaint/iframes/resources/compositing-document.html: Added.
+        * compositing/repaint/iframes/resources/compositing-fixed-background-document.html: Added.
+        * compositing/repaint/iframes/resources/fixed-background-document.html: Added.
+        * platform/mac-wk1/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt: Added.
+        * platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt: Added.
+        * platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt: Added.
+        * platform/mac-wk2/compositing/repaint/fixed-background-scroll-expected.txt:
+        * platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint-expected.txt: Added.
+        * platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint.html: Added.
+
</ins><span class="cx"> 2015-04-12  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ES6] Implement Array.prototype.values
</span></span></pre></div>
<a id="trunkLayoutTestscompositingrepaintiframescompositediframewithfixedbackgrounddocrepaintexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt                                (rev 0)
+++ trunk/LayoutTests/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 2016.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 2016.00)
+      (contentsOpaque 1)
+      (children 2
+        (GraphicsLayer
+          (position 14.00 14.00)
+          (bounds 432.00 332.00)
+          (drawsContent 1)
+          (repaint rects
+            (rect 24.00 16.00 100.00 8.00)
+            (rect 16.00 16.00 400.00 300.00)
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 369.00)
+          (anchor 1.00 1.00)
+          (bounds 1.00 1.00)
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingrepaintiframescompositediframewithfixedbackgrounddocrepainthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint.html (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint.html                                (rev 0)
+++ trunk/LayoutTests/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint.html        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            height: 2000px;
+        }
+        iframe {
+            height: 300px;
+            width: 400px;
+            margin: 20px;
+            box-shadow: 0 0 10px black;
+            -webkit-transform: translateZ(0);
+        }
+        .composited {
+            -webkit-transform: translateZ(0);
+            width: 1px;
+            height: 1px;
+        }
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        var expectedLoads = 2;
+        function documentLoaded()
+        {
+            if (!--expectedLoads) {
+                // Timeout is required to allow layer to paint before the scroll.
+                window.setTimeout(doTest, 0);
+            }
+        }
+        
+        function doTest()
+        {
+            if (window.testRunner)
+                testRunner.display(); // Flush pending compositing repaints.
+            
+            if (window.internals)
+                window.internals.startTrackingRepaints();
+
+            document.getElementById('frame').contentWindow.scrollTo(0, 100);
+
+            if (window.internals)
+                document.getElementById('repaintRects').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
+            
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+                
+        window.addEventListener('load', documentLoaded, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;iframe id=&quot;frame&quot; onload=&quot;documentLoaded()&quot; src=&quot;resources/fixed-background-document.html&quot;&gt;&lt;/iframe&gt;
+&lt;pre id=&quot;repaintRects&quot;&gt;&lt;/pre&gt;
+&lt;div class=&quot;composited&quot;&gt;&lt;/div&gt; &lt;!-- To get the root composited in WebKit1 --&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingrepaintiframescompositingiframescrollrepaintexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt                                (rev 0)
+++ trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 2016.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 2016.00)
+      (contentsOpaque 1)
+      (children 2
+        (GraphicsLayer
+          (position 14.00 14.00)
+          (bounds 432.00 332.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 16.00 16.00)
+              (children 1
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 400.00 300.00)
+                  (children 1
+                    (GraphicsLayer
+                      (position 0.00 -100.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 400.00 1016.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 400.00 1016.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 8.00 8.00)
+                                  (bounds 100.00 100.00)
+                                  (contentsOpaque 1)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 369.00)
+          (anchor 1.00 1.00)
+          (bounds 1.00 1.00)
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingrepaintiframescompositingiframescrollrepainthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint.html (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint.html                                (rev 0)
+++ trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-scroll-repaint.html        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            height: 2000px;
+        }
+        iframe {
+            height: 300px;
+            width: 400px;
+            margin: 20px;
+            box-shadow: 0 0 10px black;
+        }
+        .composited {
+            -webkit-transform: translateZ(0);
+            width: 1px;
+            height: 1px;
+        }
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        var expectedLoads = 2;
+        function documentLoaded()
+        {
+            if (!--expectedLoads) {
+                // Timeout is required to allow layer to paint before the scroll.
+                window.setTimeout(doTest, 0);
+            }
+        }
+        
+        function doTest()
+        {
+            if (window.testRunner)
+                testRunner.display(); // Flush pending compositing repaints.
+
+            if (window.internals)
+                window.internals.startTrackingRepaints();
+
+            document.getElementById('frame').contentWindow.scrollTo(0, 100);
+
+            if (window.internals)
+                document.getElementById('repaintRects').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
+            
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+                
+        window.addEventListener('load', documentLoaded, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;iframe id=&quot;frame&quot; onload=&quot;documentLoaded()&quot; src=&quot;resources/compositing-document.html&quot;&gt;&lt;/iframe&gt;
+&lt;pre id=&quot;repaintRects&quot;&gt;&lt;/pre&gt;
+&lt;div class=&quot;composited&quot;&gt;&lt;/div&gt; &lt;!-- To get the root composited in WebKit1 --&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingrepaintiframescompositingiframewithfixedbackgrounddocrepaintexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt                                (rev 0)
+++ trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 2016.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 2016.00)
+      (contentsOpaque 1)
+      (children 2
+        (GraphicsLayer
+          (position 14.00 14.00)
+          (bounds 432.00 332.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (position 16.00 16.00)
+              (children 1
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 400.00 300.00)
+                  (children 1
+                    (GraphicsLayer
+                      (position 0.00 -100.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 400.00 1016.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 400.00 1016.00)
+                              (drawsContent 1)
+                              (repaint rects
+                                (rect 8.00 8.00 100.00 100.00)
+                              )
+                              (children 1
+                                (GraphicsLayer
+                                  (position 8.00 108.00)
+                                  (bounds 100.00 100.00)
+                                  (contentsOpaque 1)
+                                  (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [100.00 0.00 0.00 1.00])
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 369.00)
+          (anchor 1.00 1.00)
+          (bounds 1.00 1.00)
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingrepaintiframescompositingiframewithfixedbackgrounddocrepainthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint.html (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint.html                                (rev 0)
+++ trunk/LayoutTests/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint.html        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,64 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            height: 2000px;
+        }
+        iframe {
+            height: 300px;
+            width: 400px;
+            margin: 20px;
+            box-shadow: 0 0 10px black;
+        }
+        
+        .composited {
+            -webkit-transform: translateZ(0);
+            width: 1px;
+            height: 1px;
+        }        
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        var expectedLoads = 2;
+        function documentLoaded()
+        {
+            if (!--expectedLoads) {
+                // Timeout is required to allow layer to paint before the scroll.
+                window.setTimeout(doTest, 0);
+            }
+        }
+        
+        function doTest()
+        {
+            if (window.testRunner)
+                testRunner.display(); // Flush pending compositing repaints.
+
+            if (window.internals)
+                window.internals.startTrackingRepaints();
+
+            document.getElementById('frame').contentWindow.scrollTo(0, 100);
+
+            if (window.internals)
+                document.getElementById('repaintRects').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
+            
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+                
+        window.addEventListener('load', documentLoaded, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;iframe id=&quot;frame&quot; onload=&quot;documentLoaded()&quot; src=&quot;resources/compositing-fixed-background-document.html&quot;&gt;&lt;/iframe&gt;
+&lt;pre id=&quot;repaintRects&quot;&gt;&lt;/pre&gt;
+&lt;div class=&quot;composited&quot;&gt;&lt;/div&gt; &lt;!-- To get the root composited in WebKit1 --&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingrepaintiframesresourcescompositingdocumenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/repaint/iframes/resources/compositing-document.html (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/repaint/iframes/resources/compositing-document.html                                (rev 0)
+++ trunk/LayoutTests/compositing/repaint/iframes/resources/compositing-document.html        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            overflow: hidden;
+            height: 1000px;
+        }
+        .box {
+            width: 100px;
+            height: 100px;
+            background-color: blue;
+        }
+        
+        .composited {
+            -webkit-transform: translateZ(0);
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div class=&quot;composited box&quot;&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingrepaintiframesresourcescompositingfixedbackgrounddocumenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/repaint/iframes/resources/compositing-fixed-background-document.html (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/repaint/iframes/resources/compositing-fixed-background-document.html                                (rev 0)
+++ trunk/LayoutTests/compositing/repaint/iframes/resources/compositing-fixed-background-document.html        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            overflow: hidden;
+            height: 1000px;
+        }
+        .box {
+            width: 100px;
+            height: 100px;
+            background-color: blue;
+        }
+        
+        .background-fixed {
+                 background-image: linear-gradient(blue, green);
+                 background-size: 100% 100px;
+            background-attachment: fixed;
+        }
+        
+        .composited {
+            -webkit-transform: translate3d(100px, 0, 0);
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div class=&quot;background-fixed box&quot;&gt;
+&lt;/div&gt;
+&lt;div class=&quot;composited box&quot;&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestscompositingrepaintiframesresourcesfixedbackgrounddocumenthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/compositing/repaint/iframes/resources/fixed-background-document.html (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/compositing/repaint/iframes/resources/fixed-background-document.html                                (rev 0)
+++ trunk/LayoutTests/compositing/repaint/iframes/resources/fixed-background-document.html        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,27 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            overflow: hidden;
+            height: 1000px;
+        }
+        .box {
+            width: 100px;
+            height: 100px;
+            background-color: blue;
+        }
+        
+        .background-fixed {
+                 background-image: linear-gradient(blue, green);
+                 background-size: 100% 100px;
+            background-attachment: fixed;
+        }
+    &lt;/style&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;div class=&quot;background-fixed box&quot;&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1compositingrepaintiframescompositediframewithfixedbackgrounddocrepaintexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint-expected.txt        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 2016.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 2016.00)
+      (contentsOpaque 1)
+      (children 2
+        (GraphicsLayer
+          (position 14.00 14.00)
+          (bounds 432.00 332.00)
+          (drawsContent 1)
+          (repaint rects
+            (rect 24.00 16.00 100.00 8.00)
+            (rect 16.00 16.00 400.00 300.00)
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 369.00)
+          (anchor 1.00 1.00)
+          (bounds 1.00 1.00)
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1compositingrepaintiframescompositingiframescrollrepaintexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-scroll-repaint-expected.txt        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,62 @@
</span><ins>+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 2016.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 2016.00)
+      (contentsOpaque 1)
+      (children 2
+        (GraphicsLayer
+          (position 14.00 14.00)
+          (bounds 432.00 332.00)
+          (drawsContent 1)
+          (repaint rects
+            (rect 16.00 16.00 400.00 300.00)
+          )
+          (children 1
+            (GraphicsLayer
+              (position 16.00 16.00)
+              (children 1
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 400.00 300.00)
+                  (children 1
+                    (GraphicsLayer
+                      (position 0.00 -100.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 400.00 1016.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 400.00 1016.00)
+                              (drawsContent 1)
+                              (children 1
+                                (GraphicsLayer
+                                  (position 8.00 8.00)
+                                  (bounds 100.00 100.00)
+                                  (contentsOpaque 1)
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 369.00)
+          (anchor 1.00 1.00)
+          (bounds 1.00 1.00)
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk1compositingrepaintiframescompositingiframewithfixedbackgrounddocrepaintexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac-wk1/compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint-expected.txt        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 785.00 2016.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 785.00 2016.00)
+      (contentsOpaque 1)
+      (children 2
+        (GraphicsLayer
+          (position 14.00 14.00)
+          (bounds 432.00 332.00)
+          (drawsContent 1)
+          (repaint rects
+            (rect 16.00 16.00 400.00 300.00)
+          )
+          (children 1
+            (GraphicsLayer
+              (position 16.00 16.00)
+              (children 1
+                (GraphicsLayer
+                  (anchor 0.00 0.00)
+                  (bounds 400.00 300.00)
+                  (children 1
+                    (GraphicsLayer
+                      (position 0.00 -100.00)
+                      (children 1
+                        (GraphicsLayer
+                          (anchor 0.00 0.00)
+                          (bounds 400.00 1016.00)
+                          (children 1
+                            (GraphicsLayer
+                              (bounds 400.00 1016.00)
+                              (drawsContent 1)
+                              (repaint rects
+                                (rect 8.00 8.00 100.00 100.00)
+                              )
+                              (children 1
+                                (GraphicsLayer
+                                  (position 8.00 108.00)
+                                  (bounds 100.00 100.00)
+                                  (contentsOpaque 1)
+                                  (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [100.00 0.00 0.00 1.00])
+                                )
+                              )
+                            )
+                          )
+                        )
+                      )
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 369.00)
+          (anchor 1.00 1.00)
+          (bounds 1.00 1.00)
+        )
+      )
+    )
+  )
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2compositingrepaintfixedbackgroundscrollexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac-wk2/compositing/repaint/fixed-background-scroll-expected.txt (182668 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/compositing/repaint/fixed-background-scroll-expected.txt        2015-04-12 09:50:40 UTC (rev 182668)
+++ trunk/LayoutTests/platform/mac-wk2/compositing/repaint/fixed-background-scroll-expected.txt        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -1,6 +1,3 @@
</span><del>-(repaint rects
-  (rect 0 0 785 600)
-)
</del><span class="cx"> (GraphicsLayer
</span><span class="cx">   (anchor 0.00 0.00)
</span><span class="cx">   (bounds 785.00 2021.00)
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingfixedbackgroundscrollrepaintexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint-expected.txt (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint-expected.txt        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,6 @@
</span><ins>+We should only repaint the bounds of the element with a fixed background.
+
+(repaint rects
+  (rect 8 -50 252 202)
+)
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacwk2tileddrawingfixedbackgroundscrollrepainthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint.html (0 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint.html        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -0,0 +1,54 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+
+&lt;html&gt;
+&lt;head&gt;
+    &lt;style&gt;
+        body {
+            height: 2000px;
+        }
+            #test {
+                height: 200px;
+                width: 250px;
+                border: 1px solid black;
+                background-image: linear-gradient(blue, green);
+                background-size: 100% 300px;
+           background-attachment: fixed;
+            }
+    &lt;/style&gt;
+    &lt;script&gt;
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function documentLoaded()
+        {
+            // Timeout is required to allow layers to paint before the scroll.
+            window.setTimeout(doTest, 0);
+        }
+        
+        function doTest()
+        {
+            if (window.internals)
+                window.internals.startTrackingRepaints();
+
+            window.scrollTo(0, 100);
+
+            if (window.internals)
+                document.getElementById('repaintRects').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
+            
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }
+                
+        window.addEventListener('load', documentLoaded, false);
+    &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+
+&lt;p&gt;We should only repaint the bounds of the element with a fixed background.&lt;/p&gt;
+&lt;div id=&quot;test&quot;&gt;&lt;/div&gt;
+&lt;pre id=&quot;repaintRects&quot;&gt;&lt;/pre&gt;
+
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (182668 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-12 09:50:40 UTC (rev 182668)
+++ trunk/Source/WebCore/ChangeLog        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-04-12  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Too much repainting on scrolling with fixed backgrounds
+        https://bugs.webkit.org/show_bug.cgi?id=143637
+        rdar://problem/20245243
+
+        Reviewed by Darin Adler.
+        
+        FrameView::scrollContentsSlowPath() would repaint the entire viewport if there were
+        any slow-repaint objects (those with background-attachment: fixed) and the contents
+        were using compositing for scrolling.
+        
+        This is wrong; we only need to issue repaint for the slow-repaint renderers,
+        and, if the frame is hosted in a compositing layer and not using compositing for scrolling,
+        repaint that hosting layer.
+
+        Tests: compositing/repaint/iframes/composited-iframe-with-fixed-background-doc-repaint.html
+               compositing/repaint/iframes/compositing-iframe-scroll-repaint.html
+               compositing/repaint/iframes/compositing-iframe-with-fixed-background-doc-repaint.html
+               platform/mac-wk2/tiled-drawing/fixed-background-scroll-repaint.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scrollContentsSlowPath):
+
</ins><span class="cx"> 2015-04-11  Matt Baker  &lt;mattbaker@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: create content view and details sidebar for Frames timeline
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (182668 => 182669)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-04-12 09:50:40 UTC (rev 182668)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-04-12 17:30:58 UTC (rev 182669)
</span><span class="lines">@@ -1867,25 +1867,12 @@
</span><span class="cx"> 
</span><span class="cx"> void FrameView::scrollContentsSlowPath(const IntRect&amp; updateRect)
</span><span class="cx"> {
</span><del>-    if (usesCompositedScrolling()) {
-        // FIXME: respect paintsEntireContents()?
-        IntRect updateRect = visibleContentRect(LegacyIOSDocumentVisibleRect);
-
-        // Make sure to &quot;apply&quot; the scale factor here since we're converting from frame view
-        // coordinates to layer backing coordinates.
-        updateRect.scale(1 / frame().frameScaleFactor());
-
-        ASSERT(renderView());
-        renderView()-&gt;layer()-&gt;setBackingNeedsRepaintInRect(updateRect, GraphicsLayer::DoNotClipToLayer);
-    }
-
</del><span class="cx">     repaintSlowRepaintObjects();
</span><span class="cx"> 
</span><del>-    if (RenderWidget* frameRenderer = frame().ownerRenderer()) {
-        if (isEnclosedInCompositingLayer()) {
-            LayoutRect rect(frameRenderer-&gt;borderLeft() + frameRenderer-&gt;paddingLeft(),
-                            frameRenderer-&gt;borderTop() + frameRenderer-&gt;paddingTop(),
-                            visibleWidth(), visibleHeight());
</del><ins>+    if (!usesCompositedScrolling() &amp;&amp; isEnclosedInCompositingLayer()) {
+        if (RenderWidget* frameRenderer = frame().ownerRenderer()) {
+            LayoutRect rect(frameRenderer-&gt;borderLeft() + frameRenderer-&gt;paddingLeft(), frameRenderer-&gt;borderTop() + frameRenderer-&gt;paddingTop(),
+                visibleWidth(), visibleHeight());
</ins><span class="cx">             frameRenderer-&gt;repaintRectangle(rect);
</span><span class="cx">             return;
</span><span class="cx">         }
</span></span></pre>
</div>
</div>

</body>
</html>