Title: [262774] trunk
Revision
262774
Author
[email protected]
Date
2020-06-08 22:29:22 -0700 (Mon, 08 Jun 2020)

Log Message

Horizontally scrolling elements are broken when revealed by toggling visibility
https://bugs.webkit.org/show_bug.cgi?id=212439
<rdar://problem/63739559>

Reviewed by Zalan Bujtas.

Source/WebCore:

When revealing an overflow:scroll by toggling the visibility property, make sure that
we use composited scrolling.

computeScrollDimensions() is only updated on layout, so we need to recompute m_hasCompositedScrollableOverflow
on style change as well.

Test: compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::computeScrollDimensions):
(WebCore::RenderLayer::computeHasCompositedScrollableOverflow):
(WebCore::RenderLayer::calculateClipRects const):
* rendering/RenderLayer.h:

LayoutTests:

* compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller-expected.txt: Added.
* compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller.html: Added.
* platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller-expected.txt: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (262773 => 262774)


--- trunk/LayoutTests/ChangeLog	2020-06-09 05:21:05 UTC (rev 262773)
+++ trunk/LayoutTests/ChangeLog	2020-06-09 05:29:22 UTC (rev 262774)
@@ -1,3 +1,15 @@
+2020-06-08  Simon Fraser  <[email protected]>
+
+        Horizontally scrolling elements are broken when revealed by toggling visibility
+        https://bugs.webkit.org/show_bug.cgi?id=212439
+        <rdar://problem/63739559>
+
+        Reviewed by Zalan Bujtas.
+
+        * compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller-expected.txt: Added.
+        * compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller.html: Added.
+        * platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller-expected.txt: Added.
+
 2020-06-08  Diego Pino Garcia  <[email protected]>
 
         [GTK] Gardening, update test expectations after r262763

Added: trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller-expected.txt (0 => 262774)


--- trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller-expected.txt	2020-06-09 05:29:22 UTC (rev 262774)
@@ -0,0 +1,43 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 402.00 117.00)
+          (drawsContent 1)
+          (children 2
+            (GraphicsLayer
+              (offsetFromRenderer width=1 height=1)
+              (position 1.00 1.00)
+              (bounds 400.00 100.00)
+              (children 1
+                (GraphicsLayer
+                  (offsetFromRenderer width=1 height=1)
+                  (anchor 0.00 0.00)
+                  (bounds 1200.00 100.00)
+                )
+              )
+            )
+            (GraphicsLayer
+              (position 1.00 1.00)
+              (bounds 400.00 115.00)
+              (children 1
+                (GraphicsLayer
+                  (position 0.00 100.00)
+                  (bounds 400.00 15.00)
+                  (drawsContent 1)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller.html (0 => 262774)


--- trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller.html	2020-06-09 05:29:22 UTC (rev 262774)
@@ -0,0 +1,43 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+<style>
+    #scroller {
+        overflow: auto;
+        width: 400px;
+        border: 1px solid black;
+        position: relative;
+        visibility: hidden;
+    }
+
+    .contents {
+        width: 300%;
+        height: 100px;
+    }
+</style>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    window.addEventListener('load', () => {
+        setTimeout(() => {
+            document.getElementById('scroller').style.visibility = 'visible';
+            if (window.internals)
+                document.getElementById('layers').innerText = window.internals.layerTreeAsText(document);
+
+            if (window.testRunner)
+                testRunner.notifyDone();
+        }, 0);
+    }, false);
+</script>
+</head>
+<body>
+<div id="scroller">
+    <div class="contents"></div>
+</div>
+<pre id="layers"></pre>
+</body>
+</html>
+

Added: trunk/LayoutTests/platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller-expected.txt (0 => 262774)


--- trunk/LayoutTests/platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller-expected.txt	2020-06-09 05:29:22 UTC (rev 262774)
@@ -0,0 +1,32 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 402.00 117.00)
+          (drawsContent 1)
+          (children 1
+            (GraphicsLayer
+              (offsetFromRenderer width=1 height=1)
+              (position 1.00 1.00)
+              (bounds 400.00 115.00)
+              (children 1
+                (GraphicsLayer
+                  (offsetFromRenderer width=1 height=1)
+                  (anchor 0.00 0.00)
+                  (bounds 1200.00 100.00)
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+

Modified: trunk/Source/WebCore/ChangeLog (262773 => 262774)


--- trunk/Source/WebCore/ChangeLog	2020-06-09 05:21:05 UTC (rev 262773)
+++ trunk/Source/WebCore/ChangeLog	2020-06-09 05:29:22 UTC (rev 262774)
@@ -1,3 +1,25 @@
+2020-06-08  Simon Fraser  <[email protected]>
+
+        Horizontally scrolling elements are broken when revealed by toggling visibility
+        https://bugs.webkit.org/show_bug.cgi?id=212439
+        <rdar://problem/63739559>
+
+        Reviewed by Zalan Bujtas.
+
+        When revealing an overflow:scroll by toggling the visibility property, make sure that
+        we use composited scrolling.
+
+        computeScrollDimensions() is only updated on layout, so we need to recompute m_hasCompositedScrollableOverflow
+        on style change as well.
+
+        Test: compositing/scrolling/async-overflow-scrolling/toggle-visibility-on-scroller.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::computeScrollDimensions):
+        (WebCore::RenderLayer::computeHasCompositedScrollableOverflow):
+        (WebCore::RenderLayer::calculateClipRects const):
+        * rendering/RenderLayer.h:
+
 2020-06-08  Sam Weinig  <[email protected]>
 
         Extended Color: Rename Color::lighten() and Color::darken() to Color::lightened() and Color::darkened()

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (262773 => 262774)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2020-06-09 05:21:05 UTC (rev 262773)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2020-06-09 05:29:22 UTC (rev 262774)
@@ -3741,6 +3741,11 @@
     int scrollableTopOverflow = roundToInt(overflowTop() - box->borderTop());
     setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow));
     
+    computeHasCompositedScrollableOverflow();
+}
+
+void RenderLayer::computeHasCompositedScrollableOverflow()
+{
     m_hasCompositedScrollableOverflow = canUseCompositedScrolling() && (hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
 }
 
@@ -6673,11 +6678,16 @@
     // FIXME: RenderLayer already handles visibility changes through our visibility dirty bits. This logic could
     // likely be folded along with the rest.
     if (oldStyle) {
-        if (oldStyle->usedZIndex() != renderer().style().usedZIndex() || oldStyle->visibility() != renderer().style().visibility()) {
+        bool visibilityChanged = oldStyle->visibility() != renderer().style().visibility();
+        if (oldStyle->usedZIndex() != renderer().style().usedZIndex() || visibilityChanged) {
             dirtyStackingContextZOrderLists();
             if (isStackingContext())
                 dirtyZOrderLists();
         }
+
+        // Visibility is input to canUseCompositedScrolling().
+        if (visibilityChanged)
+            computeHasCompositedScrollableOverflow();
     }
 
     if (renderer().isHTMLMarquee() && renderer().style().marqueeBehavior() != MarqueeBehavior::None && renderer().isBox()) {

Modified: trunk/Source/WebCore/rendering/RenderLayer.h (262773 => 262774)


--- trunk/Source/WebCore/rendering/RenderLayer.h	2020-06-09 05:21:05 UTC (rev 262773)
+++ trunk/Source/WebCore/rendering/RenderLayer.h	2020-06-09 05:29:22 UTC (rev 262774)
@@ -1104,6 +1104,8 @@
     bool listBackgroundIsKnownToBeOpaqueInRect(const LayerList&, const LayoutRect&) const;
 
     void computeScrollDimensions();
+    void computeHasCompositedScrollableOverflow();
+
     bool hasHorizontalOverflow() const;
     bool hasVerticalOverflow() const;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to