Title: [134628] trunk
Revision
134628
Author
[email protected]
Date
2012-11-14 10:51:51 -0800 (Wed, 14 Nov 2012)

Log Message

Optimize painting of composited scrolling layers
https://bugs.webkit.org/show_bug.cgi?id=96087

Patch by Sami Kyostila <[email protected]> on 2012-11-14
Reviewed by Simon Fraser.

Source/WebCore:

Don't completely repaint accelerated scrolling layers when the scroll offset
changes.

Test: compositing/overflow/scrolling-without-painting.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::setOffsetFromRenderer):
* platform/graphics/GraphicsLayer.h:
(GraphicsLayer):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):

LayoutTests:

Test that accelerated scrolling layers can be scrolled without repainting
their contents. Note that this test will not pass unless
ENABLE_ACCELERATED_OVERFLOW_SCROLLING is enabled.

* compositing/overflow/scrolling-without-painting-expected.txt: Added.
* compositing/overflow/scrolling-without-painting.html: Added.
* platform/chromium/TestExpectations: Mark test as expected to fail
  by default.
* platform/mac/TestExpectations: Skip the test.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (134627 => 134628)


--- trunk/LayoutTests/ChangeLog	2012-11-14 18:48:59 UTC (rev 134627)
+++ trunk/LayoutTests/ChangeLog	2012-11-14 18:51:51 UTC (rev 134628)
@@ -1,3 +1,20 @@
+2012-11-14  Sami Kyostila  <[email protected]>
+
+        Optimize painting of composited scrolling layers
+        https://bugs.webkit.org/show_bug.cgi?id=96087
+
+        Reviewed by Simon Fraser.
+
+        Test that accelerated scrolling layers can be scrolled without repainting
+        their contents. Note that this test will not pass unless
+        ENABLE_ACCELERATED_OVERFLOW_SCROLLING is enabled.
+
+        * compositing/overflow/scrolling-without-painting-expected.txt: Added.
+        * compositing/overflow/scrolling-without-painting.html: Added.
+        * platform/chromium/TestExpectations: Mark test as expected to fail
+          by default.
+        * platform/mac/TestExpectations: Skip the test.
+
 2012-11-14  Dimitri Glazkov  <[email protected]>
 
         Rebaseline fast/media/mq-js-media-except-01.html after r134618.

Copied: trunk/LayoutTests/compositing/overflow/scrolling-without-painting-expected.txt (from rev 134627, trunk/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt) (0 => 134628)


--- trunk/LayoutTests/compositing/overflow/scrolling-without-painting-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow/scrolling-without-painting-expected.txt	2012-11-14 18:51:51 UTC (rev 134628)
@@ -0,0 +1,47 @@
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 202.00 202.00)
+          (drawsContent 1)
+          (children 4
+            (GraphicsLayer
+              (position 1.00 1.00)
+              (bounds 200.00 200.00)
+              (children 1
+                (GraphicsLayer
+                  (position 0.00 -25.00)
+                  (bounds 185.00 1025.00)
+                  (drawsContent 1)
+                )
+              )
+            )
+            (GraphicsLayer
+              (position 1.00 186.00)
+              (bounds 185.00 15.00)
+              (drawsContent 1)
+            )
+            (GraphicsLayer
+              (position 186.00 1.00)
+              (bounds 15.00 185.00)
+              (drawsContent 1)
+              (repaint rects
+                (rect 0.00 0.00 15.00 185.00)
+              )
+            )
+            (GraphicsLayer
+              (position 186.00 186.00)
+              (bounds 15.00 15.00)
+              (drawsContent 1)
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/overflow/scrolling-without-painting.html (0 => 134628)


--- trunk/LayoutTests/compositing/overflow/scrolling-without-painting.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow/scrolling-without-painting.html	2012-11-14 18:51:51 UTC (rev 134628)
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+
+<!--
+This test checks that accelerated scrolling layers can be scrolled without
+repainting their contents. See https://bugs.webkit.org/show_bug.cgi?id=96087.
+-->
+
+<html>
+<head>
+  <style type="text/css">
+    #scroller {
+        overflow: scroll;
+        -webkit-overflow-scrolling: touch;
+        width: 200px;
+        height: 200px;
+        border: solid thin blue;
+    }
+
+    #content {
+        height: 1000px;
+        margin-top: 25px;
+    }
+  </style>
+  <script type="text/_javascript_">
+      window.addEventListener('load', function() {
+          if (!window.testRunner || !window.internals) {
+              alert('This test requires testRunner to run!');
+              return;
+          }
+          testRunner.dumpAsText(false);
+
+          // First paint the entire view including the scrolling element.
+          var scroller = document.getElementById('scroller');
+          scroller.offsetTop;
+
+          // Scroll down. This should not cause any more repaints to the
+          // scrolling contents.
+          window.internals.startTrackingRepaints(document);
+          scroller.scrollTop = 25;
+
+          var layerTree = document.getElementById('layerTree');
+          layerTree.innerText =
+              window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
+          window.internals.stopTrackingRepaints(document);
+      });
+  </script>
+</head>
+<body>
+  <div id="scroller">
+    <div id="content"></div>
+  </div>
+  <pre id="layerTree">This text will be replaced with the layer tree.</pre>
+</body>
+</html>

Modified: trunk/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt (134627 => 134628)


--- trunk/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt	2012-11-14 18:48:59 UTC (rev 134627)
+++ trunk/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt	2012-11-14 18:51:51 UTC (rev 134628)
@@ -18,7 +18,6 @@
                     (rect 0.00 0.00 185.00 200.00)
                     (rect 0.00 0.00 185.00 200.00)
                     (rect 0.00 0.00 185.00 200.00)
-                    (rect 0.00 0.00 185.00 1200.00)
                   )
                 )
               )

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (134627 => 134628)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-11-14 18:48:59 UTC (rev 134627)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-11-14 18:51:51 UTC (rev 134628)
@@ -3768,6 +3768,8 @@
 # ENABLE_ACCELERATED_OVERFLOW_SCROLLING is not currently enabled in Chromium.
 webkit.org/b/94353 compositing/overflow/scrolling-content-clip-to-viewport.html [ Failure ]
 webkit.org/b/94353 platform/chromium/virtual/softwarecompositing/overflow/scrolling-content-clip-to-viewport.html [ Failure ]
+webkit.org/b/94353 compositing/overflow/scrolling-without-painting.html [ Failure ]
+webkit.org/b/94353 platform/chromium/virtual/softwarecompositing/overflow/scrolling-without-painting.html [ Failure ]
 webkit.org/b/94353 compositing/overflow/updating-scrolling-content.html [ Failure ]
 webkit.org/b/94353 platform/chromium/virtual/softwarecompositing/overflow/updating-scrolling-content.html [ Failure ]
 webkit.org/b/94353 compositing/overflow/textarea-scroll-touch.html [ Failure ]

Modified: trunk/LayoutTests/platform/mac/TestExpectations (134627 => 134628)


--- trunk/LayoutTests/platform/mac/TestExpectations	2012-11-14 18:48:59 UTC (rev 134627)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2012-11-14 18:51:51 UTC (rev 134628)
@@ -856,6 +856,7 @@
 compositing/overflow/scrolling-content-clip-to-viewport.html
 compositing/overflow/textarea-scroll-touch.html
 compositing/overflow/updating-scrolling-content.html
+compositing/overflow/scrolling-without-painting.html
 
 # https://bugs.webkit.org/show_bug.cgi?id=95027
 fast/block/float/016.html

Modified: trunk/Source/WebCore/ChangeLog (134627 => 134628)


--- trunk/Source/WebCore/ChangeLog	2012-11-14 18:48:59 UTC (rev 134627)
+++ trunk/Source/WebCore/ChangeLog	2012-11-14 18:51:51 UTC (rev 134628)
@@ -1,3 +1,22 @@
+2012-11-14  Sami Kyostila  <[email protected]>
+
+        Optimize painting of composited scrolling layers
+        https://bugs.webkit.org/show_bug.cgi?id=96087
+
+        Reviewed by Simon Fraser.
+
+        Don't completely repaint accelerated scrolling layers when the scroll offset
+        changes.
+
+        Test: compositing/overflow/scrolling-without-painting.html
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::setOffsetFromRenderer):
+        * platform/graphics/GraphicsLayer.h:
+        (GraphicsLayer):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):
+
 2012-11-14  Pavel Feldman  <[email protected]>
 
         Web Inspector: keep track of mutation observers and disconnect them upon upload

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (134627 => 134628)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-11-14 18:48:59 UTC (rev 134627)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-11-14 18:51:51 UTC (rev 134628)
@@ -296,7 +296,7 @@
     m_replicaLayer = layer;
 }
 
-void GraphicsLayer::setOffsetFromRenderer(const IntSize& offset)
+void GraphicsLayer::setOffsetFromRenderer(const IntSize& offset, ShouldSetNeedsDisplay shouldSetNeedsDisplay)
 {
     if (offset == m_offsetFromRenderer)
         return;
@@ -304,7 +304,8 @@
     m_offsetFromRenderer = offset;
 
     // If the compositing layer offset changes, we need to repaint.
-    setNeedsDisplay();
+    if (shouldSetNeedsDisplay == SetNeedsDisplay)
+        setNeedsDisplay();
 }
 
 void GraphicsLayer::setBackgroundColor(const Color& color)

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (134627 => 134628)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-11-14 18:48:59 UTC (rev 134627)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-11-14 18:51:51 UTC (rev 134628)
@@ -242,9 +242,14 @@
     const FloatPoint& replicatedLayerPosition() const { return m_replicatedLayerPosition; }
     void setReplicatedLayerPosition(const FloatPoint& p) { m_replicatedLayerPosition = p; }
 
+    enum ShouldSetNeedsDisplay {
+        DontSetNeedsDisplay,
+        SetNeedsDisplay
+    };
+
     // Offset is origin of the renderer minus origin of the graphics layer (so either zero or negative).
     IntSize offsetFromRenderer() const { return m_offsetFromRenderer; }
-    void setOffsetFromRenderer(const IntSize&);
+    void setOffsetFromRenderer(const IntSize&, ShouldSetNeedsDisplay = SetNeedsDisplay);
 
     // The position of the layer (the location of its top-left corner in its parent)
     const FloatPoint& position() const { return m_position; }

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (134627 => 134628)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-11-14 18:48:59 UTC (rev 134627)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2012-11-14 18:51:51 UTC (rev 134628)
@@ -742,9 +742,8 @@
             compositor()->scrollingLayerDidChange(m_owningLayer);
 
         m_scrollingContentsLayer->setSize(scrollSize);
-        // FIXME: Scrolling the content layer does not need to trigger a repaint. The offset will be compensated away during painting.
         // FIXME: The paint offset and the scroll offset should really be separate concepts.
-        m_scrollingContentsLayer->setOffsetFromRenderer(scrollingContentsOffset);
+        m_scrollingContentsLayer->setOffsetFromRenderer(scrollingContentsOffset, GraphicsLayer::DontSetNeedsDisplay);
     }
 
     m_graphicsLayer->setContentsRect(contentsBox());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to