Title: [127620] trunk
Revision
127620
Author
[email protected]
Date
2012-09-05 11:53:29 -0700 (Wed, 05 Sep 2012)

Log Message

Enable/disable composited scrolling based on overflow
https://bugs.webkit.org/show_bug.cgi?id=95323

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

Source/WebCore:

When an overflow:{auto,overlay} and -webkit-overflow-scrolling:touch
element gains or loses overflow, we should correspondingly enable and
disable composited scrolling depending on whether the element can be
scrolled or not.

The previous logic in RenderLayer::usesCompositedScrolling() already
checked for actual overflow, but we also need to recompute the
compositing requirements when the amount of overflow changes during
layout. Additionally, layers using composited scrolling are marked as
self-painting to ensure they are always promoted to composited layers
when needed.

Test: compositing/overflow/overflow-auto-with-touch-toggle.html

Note that the behavior for maintaining a stacking context even without
the presense of overflow is covered by platform/chromium/compositing/overflow/overflow-scrolling-touch-stacking-context.html.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateScrollInfoAfterLayout):
(WebCore::RenderLayer::shouldBeSelfPaintingLayer):

LayoutTests:

Added a new test for making sure composited scrolling is enabled when overflow
is introduced.

Note that this test will pass only if OVERFLOW_SCROLLING is enabled.

* compositing/overflow/overflow-auto-with-touch-toggle-expected.txt: Added.
* compositing/overflow/overflow-auto-with-touch-toggle.html: Added.
* platform/chromium/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (127619 => 127620)


--- trunk/LayoutTests/ChangeLog	2012-09-05 18:46:24 UTC (rev 127619)
+++ trunk/LayoutTests/ChangeLog	2012-09-05 18:53:29 UTC (rev 127620)
@@ -1,3 +1,19 @@
+2012-09-05  Sami Kyostila  <[email protected]>
+
+        Enable/disable composited scrolling based on overflow
+        https://bugs.webkit.org/show_bug.cgi?id=95323
+
+        Reviewed by Simon Fraser.
+
+        Added a new test for making sure composited scrolling is enabled when overflow
+        is introduced.
+
+        Note that this test will pass only if OVERFLOW_SCROLLING is enabled.
+
+        * compositing/overflow/overflow-auto-with-touch-toggle-expected.txt: Added.
+        * compositing/overflow/overflow-auto-with-touch-toggle.html: Added.
+        * platform/chromium/TestExpectations:
+
 2012-09-05  Max Vujovic  <[email protected]>
 
         [CSS Shaders] Update custom filter tests to use the new security model

Added: trunk/LayoutTests/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt (0 => 127620)


--- trunk/LayoutTests/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt	2012-09-05 18:53:29 UTC (rev 127620)
@@ -0,0 +1,41 @@
+(GraphicsLayer
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 300.00 300.00)
+          (children 4
+            (GraphicsLayer
+              (bounds 300.00 300.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 1000.00 1000.00)
+                  (drawsContent 1)
+                )
+              )
+            )
+            (GraphicsLayer
+              (position 0.00 285.00)
+              (bounds 285.00 15.00)
+              (drawsContent 1)
+            )
+            (GraphicsLayer
+              (position 285.00 0.00)
+              (bounds 15.00 285.00)
+              (drawsContent 1)
+            )
+            (GraphicsLayer
+              (position 285.00 285.00)
+              (bounds 15.00 15.00)
+              (drawsContent 1)
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/overflow/overflow-auto-with-touch-toggle.html (0 => 127620)


--- trunk/LayoutTests/compositing/overflow/overflow-auto-with-touch-toggle.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/overflow/overflow-auto-with-touch-toggle.html	2012-09-05 18:53:29 UTC (rev 127620)
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <style>
+    .scroller {
+      width: 300px;
+      height: 300px;
+      overflow: auto;
+      -webkit-overflow-scrolling: touch;
+    }
+
+    #column {
+      /* Initially the content doesn't overflow so it won't be composited. */
+      width: 100px;
+      height: 100px;
+      background: silver;
+    }
+  </style>
+  <script>
+    if (window.testRunner)
+      testRunner.dumpAsText();
+
+    window.addEventListener('load', function() {
+      // Introducing overflow should enable composited scrolling.
+      var column = document.getElementById('column');
+      column.style.width = '1000px';
+      column.style.height = '1000px';
+      if (window.testRunner)
+        document.getElementById('layers').innerHTML = testRunner.layerTreeAsText();
+    }, true);
+  </script>
+</head>
+
+<body>
+  <div class="scroller">
+    <div id="column">
+    </div>
+  </div>
+  <pre id="layers">Layer tree goes here in DRT</pre>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (127619 => 127620)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-09-05 18:46:24 UTC (rev 127619)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-09-05 18:53:29 UTC (rev 127620)
@@ -3453,6 +3453,7 @@
 // Failing on Linux (Content Shell) only now
 BUGWK94353 LINUX ANDROID : compositing/overflow/nested-scrolling.html = IMAGE+TEXT PASS
 BUGWK94353 : compositing/overflow/overflow-auto-with-touch.html = TEXT
+BUGWK94353 : compositing/overflow/overflow-auto-with-touch-toggle.html = TEXT
 BUGWK94353 : compositing/overflow/overflow-overlay-with-touch.html = TEXT
 
 BUGWK90488 SLOW WIN : http/tests/inspector/network-preflight-options.html = PASS

Modified: trunk/Source/WebCore/ChangeLog (127619 => 127620)


--- trunk/Source/WebCore/ChangeLog	2012-09-05 18:46:24 UTC (rev 127619)
+++ trunk/Source/WebCore/ChangeLog	2012-09-05 18:53:29 UTC (rev 127620)
@@ -1,3 +1,31 @@
+2012-09-05  Sami Kyostila  <[email protected]>
+
+        Enable/disable composited scrolling based on overflow
+        https://bugs.webkit.org/show_bug.cgi?id=95323
+
+        Reviewed by Simon Fraser.
+
+        When an overflow:{auto,overlay} and -webkit-overflow-scrolling:touch
+        element gains or loses overflow, we should correspondingly enable and
+        disable composited scrolling depending on whether the element can be
+        scrolled or not.
+
+        The previous logic in RenderLayer::usesCompositedScrolling() already
+        checked for actual overflow, but we also need to recompute the
+        compositing requirements when the amount of overflow changes during
+        layout. Additionally, layers using composited scrolling are marked as
+        self-painting to ensure they are always promoted to composited layers
+        when needed.
+
+        Test: compositing/overflow/overflow-auto-with-touch-toggle.html
+
+        Note that the behavior for maintaining a stacking context even without
+        the presense of overflow is covered by platform/chromium/compositing/overflow/overflow-scrolling-touch-stacking-context.html.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateScrollInfoAfterLayout):
+        (WebCore::RenderLayer::shouldBeSelfPaintingLayer):
+
 2012-09-05  Mike Fenton  <[email protected]>
 
         [BlackBerry] PlatformKeyboardEvent::getCurrentModifierState should initialize values.

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (127619 => 127620)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-09-05 18:46:24 UTC (rev 127619)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-09-05 18:53:29 UTC (rev 127620)
@@ -2655,6 +2655,12 @@
 
     if (originalScrollOffset != scrollOffset())
         scrollToOffsetWithoutAnimation(toPoint(scrollOffset()));
+
+#if USE(ACCELERATED_COMPOSITING)
+    // Composited scrolling may need to be enabled or disabled if the amount of overflow changed.
+    if (renderer()->view() && compositor()->updateLayerCompositingState(this))
+        compositor()->setCompositingLayersNeedRebuild();
+#endif
 }
 
 void RenderLayer::paintOverflowControls(GraphicsContext* context, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls)
@@ -4847,6 +4853,7 @@
 {
     return !isNormalFlowOnly()
         || hasOverlayScrollbars()
+        || usesCompositedScrolling()
         || renderer()->hasReflection()
         || renderer()->hasMask()
         || renderer()->isTableRow()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to