Title: [134456] trunk
Revision
134456
Author
commit-qu...@webkit.org
Date
2012-11-13 11:40:31 -0800 (Tue, 13 Nov 2012)

Log Message

Allow painting outside overflow clip in accelerated scrolling layers
https://bugs.webkit.org/show_bug.cgi?id=100524

Patch by Sami Kyostila <skyos...@chromium.org> on 2012-11-13
Reviewed by Simon Fraser.

Source/WebCore:

In preparation for avoiding repaints when scrolling child layers, make it
possible to paint outside the overflow clip.

Test: compositing/overflow/updating-scrolling-content.html

* rendering/LayoutState.h:
(LayoutState):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paint):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::applyCachedClipAndScrollOffsetForRepaint):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::repaintBlockSelectionGaps):

LayoutTests:

Added a test to check painting outside the overflow clip. Note that this will
not pass unless ENABLE_ACCELERATED_OVERFLOW_SCROLLING is enabled.

* compositing/overflow/updating-scrolling-content-expected.txt: Added.
* compositing/overflow/updating-scrolling-content.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 (134455 => 134456)


--- trunk/LayoutTests/ChangeLog	2012-11-13 19:33:01 UTC (rev 134455)
+++ trunk/LayoutTests/ChangeLog	2012-11-13 19:40:31 UTC (rev 134456)
@@ -1,3 +1,19 @@
+2012-11-13  Sami Kyostila  <skyos...@chromium.org>
+
+        Allow painting outside overflow clip in accelerated scrolling layers
+        https://bugs.webkit.org/show_bug.cgi?id=100524
+
+        Reviewed by Simon Fraser.
+
+        Added a test to check painting outside the overflow clip. Note that this will
+        not pass unless ENABLE_ACCELERATED_OVERFLOW_SCROLLING is enabled.
+
+        * compositing/overflow/updating-scrolling-content-expected.txt: Added.
+        * compositing/overflow/updating-scrolling-content.html: Added.
+        * platform/chromium/TestExpectations: Mark test as expected to fail
+          by default.
+        * platform/mac/TestExpectations: Skip the test.
+
 2012-11-13  Dimitri Glazkov  <dglaz...@chromium.org>
 
         [Chromium] Remove the test that is now passing.

Added: trunk/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt (0 => 134456)


--- trunk/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow/updating-scrolling-content-expected.txt	2012-11-13 19:40:31 UTC (rev 134456)
@@ -0,0 +1,50 @@
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 200.00 200.00)
+          (children 4
+            (GraphicsLayer
+              (bounds 200.00 200.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 185.00 1200.00)
+                  (drawsContent 1)
+                  (repaint rects
+                    (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)
+                  )
+                )
+              )
+            )
+            (GraphicsLayer
+              (position 0.00 185.00)
+              (bounds 185.00 15.00)
+              (drawsContent 1)
+            )
+            (GraphicsLayer
+              (position 185.00 0.00)
+              (bounds 15.00 185.00)
+              (drawsContent 1)
+              (repaint rects
+                (rect 0.00 0.00 15.00 185.00)
+              )
+            )
+            (GraphicsLayer
+              (position 185.00 185.00)
+              (bounds 15.00 15.00)
+              (drawsContent 1)
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/overflow/updating-scrolling-content.html (0 => 134456)


--- trunk/LayoutTests/compositing/overflow/updating-scrolling-content.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow/updating-scrolling-content.html	2012-11-13 19:40:31 UTC (rev 134456)
@@ -0,0 +1,64 @@
+<!DOCTYPE html>
+
+<!--
+This test checks that the contents of accelerated scrolling layers are properly
+updated also outside the current overflow clip. See
+https://bugs.webkit.org/show_bug.cgi?id=100524.
+-->
+
+<html>
+<head>
+  <style type="text/css">
+    #scroller {
+        overflow: scroll;
+        -webkit-overflow-scrolling: touch;
+        width: 200px;
+        height: 200px;
+    }
+
+    #indicator {
+        background: red;
+        height: 200px;
+    }
+
+    #content {
+        height: 1000px;
+    }
+  </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);
+
+          var scroller = document.getElementById('scroller');
+          var indicator = document.getElementById('indicator');
+
+          // Make sure the scrolling content is painted before we start.
+          scroller.offsetTop;
+
+          // Scroll all the way to the bottom and change the color of the
+          // indicator (which is now outside the overflow clip).
+          scroller.scrollTop = 1000;
+          window.internals.startTrackingRepaints(document);
+          indicator.style.background = '';
+
+          // Scroll back up so that the updated (green) indicator is visible.
+          var layerTree = document.getElementById('layerTree');
+          scroller.scrollTop = 0;
+          layerTree.innerText =
+              window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_REPAINT_RECTS);
+          window.internals.stopTrackingRepaints(document);
+      });
+  </script>
+</head>
+<body>
+  <div id="scroller">
+    <div id="indicator"></div>
+    <div id="content"></div>
+  </div>
+  <pre id="layerTree">This text will be replaced with the layer tree.</pre>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (134455 => 134456)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-11-13 19:33:01 UTC (rev 134455)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-11-13 19:40:31 UTC (rev 134456)
@@ -3728,6 +3728,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/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 ]
 webkit.org/b/94353 platform/chromium/virtual/softwarecompositing/overflow/textarea-scroll-touch.html [ Failure ]
 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (134455 => 134456)


--- trunk/LayoutTests/platform/mac/TestExpectations	2012-11-13 19:33:01 UTC (rev 134455)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2012-11-13 19:40:31 UTC (rev 134456)
@@ -852,6 +852,7 @@
 compositing/overflow/overflow-overlay-with-touch.html
 compositing/overflow/scrolling-content-clip-to-viewport.html
 compositing/overflow/textarea-scroll-touch.html
+compositing/overflow/updating-scrolling-content.html
 
 # https://bugs.webkit.org/show_bug.cgi?id=95027
 fast/block/float/016.html

Modified: trunk/Source/WebCore/ChangeLog (134455 => 134456)


--- trunk/Source/WebCore/ChangeLog	2012-11-13 19:33:01 UTC (rev 134455)
+++ trunk/Source/WebCore/ChangeLog	2012-11-13 19:40:31 UTC (rev 134456)
@@ -1,3 +1,24 @@
+2012-11-13  Sami Kyostila  <skyos...@chromium.org>
+
+        Allow painting outside overflow clip in accelerated scrolling layers
+        https://bugs.webkit.org/show_bug.cgi?id=100524
+
+        Reviewed by Simon Fraser.
+
+        In preparation for avoiding repaints when scrolling child layers, make it
+        possible to paint outside the overflow clip.
+
+        Test: compositing/overflow/updating-scrolling-content.html
+
+        * rendering/LayoutState.h:
+        (LayoutState):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paint):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::applyCachedClipAndScrollOffsetForRepaint):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::repaintBlockSelectionGaps):
+
 2012-11-13  Patrick Gansterer  <par...@webkit.org>
 
         Port SimpleFontDataWin.cpp to WinCE

Modified: trunk/Source/WebCore/rendering/LayoutState.h (134455 => 134456)


--- trunk/Source/WebCore/rendering/LayoutState.h	2012-11-13 19:33:01 UTC (rev 134455)
+++ trunk/Source/WebCore/rendering/LayoutState.h	2012-11-13 19:40:31 UTC (rev 134456)
@@ -129,6 +129,8 @@
     ExclusionShapeInsideInfo* m_exclusionShapeInsideInfo;
 #endif
 
+    // FIXME: Distinguish between the layout clip rect and the paint clip rect which may be larger,
+    // e.g., because of composited scrolling.
     LayoutRect m_clipRect;
     
     // x/y offset from container. Includes relative positioning and scroll offsets.

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (134455 => 134456)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-11-13 19:33:01 UTC (rev 134455)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2012-11-13 19:40:31 UTC (rev 134456)
@@ -2758,7 +2758,7 @@
     // FIXME: Could eliminate the isRoot() check if we fix background painting so that the RenderView
     // paints the root's background.
     if (!isRoot()) {
-        LayoutRect overflowBox = visualOverflowRect();
+        LayoutRect overflowBox = overflowRectForPaintRejection();
         flipForWritingMode(overflowBox);
         overflowBox.inflate(maximalOutlineSize(paintInfo.phase));
         overflowBox.moveBy(adjustedPaintOffset);

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (134455 => 134456)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2012-11-13 19:33:01 UTC (rev 134455)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2012-11-13 19:40:31 UTC (rev 134456)
@@ -617,6 +617,11 @@
     return (hasOverflowClip() && (scrollsOverflow() || (node() && node()->rendererIsEditable()))) || (node() && node()->isDocumentNode());
 }
 
+bool RenderBox::usesCompositedScrolling() const
+{
+    return hasOverflowClip() && hasLayer() && layer()->usesCompositedScrolling();
+}
+
 void RenderBox::autoscroll()
 {
     if (layer())
@@ -652,6 +657,10 @@
 {
     paintRect.move(-scrolledContentOffset()); // For overflow:auto/scroll/hidden.
 
+    // Do not clip scroll layer contents to reduce the number of repaints while scrolling.
+    if (usesCompositedScrolling())
+        return;
+
     // height() is inaccurate if we're in the middle of a layout of this RenderBox, so use the
     // layer's size instead. Even if the layer's size is wrong, the layer itself will repaint
     // anyway if its size does change.
@@ -3928,6 +3937,17 @@
     return rect;
 }
 
+LayoutRect RenderBox::overflowRectForPaintRejection() const
+{
+    LayoutRect overflowRect = visualOverflowRect();
+    if (!m_overflow || !usesCompositedScrolling())
+        return overflowRect;
+
+    overflowRect.unite(layoutOverflowRect());
+    overflowRect.move(-scrolledContentOffset());
+    return overflowRect;
+}
+
 LayoutUnit RenderBox::offsetLeft() const
 {
     return adjustedPositionRelativeToOffsetParent(topLeftLocation()).x();

Modified: trunk/Source/WebCore/rendering/RenderBox.h (134455 => 134456)


--- trunk/Source/WebCore/rendering/RenderBox.h	2012-11-13 19:33:01 UTC (rev 134455)
+++ trunk/Source/WebCore/rendering/RenderBox.h	2012-11-13 19:40:31 UTC (rev 134456)
@@ -175,6 +175,8 @@
     virtual LayoutRect visualOverflowRect() const { return m_overflow ? m_overflow->visualOverflowRect() : borderBoxRect(); }
     LayoutUnit logicalLeftVisualOverflow() const { return style()->isHorizontalWritingMode() ? visualOverflowRect().x() : visualOverflowRect().y(); }
     LayoutUnit logicalRightVisualOverflow() const { return style()->isHorizontalWritingMode() ? visualOverflowRect().maxX() : visualOverflowRect().maxY(); }
+
+    LayoutRect overflowRectForPaintRejection() const;
     
     void addLayoutOverflow(const LayoutRect&);
     void addVisualOverflow(const LayoutRect&);
@@ -433,6 +435,7 @@
     bool scrollsOverflow() const { return scrollsOverflowX() || scrollsOverflowY(); }
     bool scrollsOverflowX() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || hasAutoHorizontalScrollbar()); }
     bool scrollsOverflowY() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || hasAutoVerticalScrollbar()); }
+    bool usesCompositedScrolling() const;
     
     bool hasUnsplittableScrollingOverflow() const;
     bool isUnsplittableForPagination() const;

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (134455 => 134456)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-11-13 19:33:01 UTC (rev 134455)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-11-13 19:40:31 UTC (rev 134456)
@@ -4326,7 +4326,7 @@
 
     LayoutRect rect = m_blockSelectionGapsBounds;
     rect.move(-scrolledContentOffset());
-    if (renderer()->hasOverflowClip())
+    if (renderer()->hasOverflowClip() && !usesCompositedScrolling())
         rect.intersect(toRenderBox(renderer())->overflowClipRect(LayoutPoint(), 0)); // FIXME: Regions not accounted for.
     if (renderer()->hasClip())
         rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint(), 0)); // FIXME: Regions not accounted for.
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to