Title: [137215] trunk
Revision
137215
Author
simon.fra...@apple.com
Date
2012-12-10 15:43:43 -0800 (Mon, 10 Dec 2012)

Log Message

Don't unconditionally repaint compositing layers when their size changes
https://bugs.webkit.org/show_bug.cgi?id=104461

Reviewed by Sam Weinig.

Source/WebCore:

RenderLayerBacking always repainted the entire compositing layer when its size
changed. This was done to fix repaint issues when outline widths changes, but
that issue is now solved by repainting in GraphicsLayer::setOffsetFromRenderer(),
add in r134628. I believe this is no longer necessary.

Always repainting when the size changes is terrible for the tile cache when
loading large documents, as all tiles repaint every time the document gets
longer.

Test: compositing/repaint/resize-repaint.html

* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):

LayoutTests:

Test that dumps repaint rects after adding content to a compositing layer.

* compositing/repaint/resize-repaint-expected.txt: Added.
* compositing/repaint/resize-repaint.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (137214 => 137215)


--- trunk/LayoutTests/ChangeLog	2012-12-10 23:34:32 UTC (rev 137214)
+++ trunk/LayoutTests/ChangeLog	2012-12-10 23:43:43 UTC (rev 137215)
@@ -1,3 +1,15 @@
+2012-12-10  Simon Fraser  <simon.fra...@apple.com>
+
+        Don't unconditionally repaint compositing layers when their size changes
+        https://bugs.webkit.org/show_bug.cgi?id=104461
+
+        Reviewed by Sam Weinig.
+
+        Test that dumps repaint rects after adding content to a compositing layer.
+
+        * compositing/repaint/resize-repaint-expected.txt: Added.
+        * compositing/repaint/resize-repaint.html: Added.
+
 2012-12-10  Ojan Vafai  <o...@chromium.org>
 
         Unreviewed, rolling out r134150.

Added: trunk/LayoutTests/compositing/repaint/resize-repaint-expected.txt (0 => 137215)


--- trunk/LayoutTests/compositing/repaint/resize-repaint-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/repaint/resize-repaint-expected.txt	2012-12-10 23:43:43 UTC (rev 137215)
@@ -0,0 +1,23 @@
+(repaint rects
+  (rect 8 10 784 205)
+  (rect 0 23 800 205)
+)
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 402.00 207.00)
+          (drawsContent 1)
+          (repaint rects
+            (rect 0.00 1.00 402.00 1.00)
+          )
+        )
+      )
+    )
+  )
+)
+
Property changes on: trunk/LayoutTests/compositing/repaint/resize-repaint-expected.txt
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Added: trunk/LayoutTests/compositing/repaint/resize-repaint.html (0 => 137215)


--- trunk/LayoutTests/compositing/repaint/resize-repaint.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/repaint/resize-repaint.html	2012-12-10 23:43:43 UTC (rev 137215)
@@ -0,0 +1,55 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        #resizing {
+            width: 400px;
+            border: 1px solid black;
+            -webkit-transform: translateZ(0);
+        }
+
+        #resizing > div {
+            height: 50px;
+            margin: 1px;
+            background-color: silver;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.dumpAsText();
+        
+        function doTest()
+        {
+            // Force compositing update before changing layer size.
+            window.internals.layerTreeAsText(document);
+
+            var resizingDiv = document.getElementById('resizing');
+            
+            for (var i = 0; i < 2; ++i) {
+                var newDiv = document.createElement('div');
+                resizingDiv.appendChild(newDiv);
+            }
+
+            if (window.internals)
+                window.internals.startTrackingRepaints(document);
+
+            for (var i = 0; i < 2; ++i) {
+                var newDiv = document.createElement('div');
+                resizingDiv.appendChild(newDiv);
+            }
+            
+            if (window.internals)
+                document.getElementById('layers').textContent = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
+        }
+        
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+
+<div id="resizing"></div>
+<pre id="layers"></pre>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/compositing/repaint/resize-repaint.html
___________________________________________________________________

Added: svn:mime-type

Added: svn:keywords

Added: svn:eol-style

Modified: trunk/Source/WebCore/ChangeLog (137214 => 137215)


--- trunk/Source/WebCore/ChangeLog	2012-12-10 23:34:32 UTC (rev 137214)
+++ trunk/Source/WebCore/ChangeLog	2012-12-10 23:43:43 UTC (rev 137215)
@@ -1,3 +1,24 @@
+2012-12-10  Simon Fraser  <simon.fra...@apple.com>
+
+        Don't unconditionally repaint compositing layers when their size changes
+        https://bugs.webkit.org/show_bug.cgi?id=104461
+
+        Reviewed by Sam Weinig.
+
+        RenderLayerBacking always repainted the entire compositing layer when its size
+        changed. This was done to fix repaint issues when outline widths changes, but
+        that issue is now solved by repainting in GraphicsLayer::setOffsetFromRenderer(),
+        add in r134628. I believe this is no longer necessary.
+        
+        Always repainting when the size changes is terrible for the tile cache when
+        loading large documents, as all tiles repaint every time the document gets
+        longer.
+
+        Test: compositing/repaint/resize-repaint.html
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+
 2012-12-10  Ojan Vafai  <o...@chromium.org>
 
         Unreviewed, rolling out r134150.

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (137214 => 137215)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-12-10 23:34:32 UTC (rev 137214)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-12-10 23:43:43 UTC (rev 137215)
@@ -631,13 +631,8 @@
     
     FloatSize oldSize = m_graphicsLayer->size();
     FloatSize newSize = relativeCompositingBounds.size();
-    if (oldSize != newSize) {
+    if (oldSize != newSize)
         m_graphicsLayer->setSize(newSize);
-        // A bounds change will almost always require redisplay. Usually that redisplay
-        // will happen because of a repaint elsewhere, but not always:
-        // e.g. see RenderView::setMaximalOutlineSize()
-        m_graphicsLayer->setNeedsDisplay();
-    }
 
     // If we have a layer that clips children, position it.
     IntRect clippingBox;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to