Title: [238266] trunk
Revision
238266
Author
[email protected]
Date
2018-11-15 21:02:56 -0800 (Thu, 15 Nov 2018)

Log Message

Overlay with -webkit-overflow-scrolling:touch doesn't become scrollable after added text makes it taller
https://bugs.webkit.org/show_bug.cgi?id=158342
rdar://problem/26652811

Reviewed by Zalan Bujtas.
Source/WebCore:

Patch partly by Frédéric Wang.

This commit fixes an issue when resizing the content of a -webkit-overflow-scrolling: touch
overflow node on iOS. Indeed, the RenderLayerBacking's scrolling layer may not be properly
created and hence the UIProcess receives a null UIScrollView pointer. This triggers an
assertion in debug mode and prevents the user from scrolling the overflow node in release
mode. This was partially fixed by the refactoring of bug 90342 but this commit addresses
the remaining issues by forcing a configuration update after layout in order to ensure that
RenderLayerBacking's scrolling layer is available. For an overflow element that is not yet
composited, trigger a post-layout update that is necessary to check if we need to make it
composited when it gains scrollable overflow.

Tests: fast/scrolling/ios/change-scrollability-on-content-resize-nested.html
       fast/scrolling/ios/change-scrollability-on-content-resize.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateScrollInfoAfterLayout): Force a configuration update so that
RenderLayerCompositor::updateBackingAndHierarchy will later instantiate
RenderLayerBacking::m_scrollingLayer.

LayoutTests:

Patch partly by Frédéric Wang.

Add a test to check that scrollability of composited/non-composited overflow divs is properly
updated. This test used to fail and assert before #238090. A second test with nested divs
stills exhibit the issue and is fixed by the present commit.

* fast/scrolling/ios/change-scrollability-on-content-resize-expected.txt: Added.
* fast/scrolling/ios/change-scrollability-on-content-resize-nested-expected.txt: Added.
* fast/scrolling/ios/change-scrollability-on-content-resize-nested.html: Added.
* fast/scrolling/ios/change-scrollability-on-content-resize.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238265 => 238266)


--- trunk/LayoutTests/ChangeLog	2018-11-16 03:09:31 UTC (rev 238265)
+++ trunk/LayoutTests/ChangeLog	2018-11-16 05:02:56 UTC (rev 238266)
@@ -1,3 +1,22 @@
+2018-11-15  Simon Fraser  <[email protected]>
+
+        Overlay with -webkit-overflow-scrolling:touch doesn't become scrollable after added text makes it taller
+        https://bugs.webkit.org/show_bug.cgi?id=158342
+        rdar://problem/26652811
+
+        Reviewed by Zalan Bujtas.
+
+        Patch partly by Frédéric Wang.
+
+        Add a test to check that scrollability of composited/non-composited overflow divs is properly
+        updated. This test used to fail and assert before #238090. A second test with nested divs
+        stills exhibit the issue and is fixed by the present commit.
+
+        * fast/scrolling/ios/change-scrollability-on-content-resize-expected.txt: Added.
+        * fast/scrolling/ios/change-scrollability-on-content-resize-nested-expected.txt: Added.
+        * fast/scrolling/ios/change-scrollability-on-content-resize-nested.html: Added.
+        * fast/scrolling/ios/change-scrollability-on-content-resize.html: Added.
+
 2018-11-15  Truitt Savell  <[email protected]>
 
         Unreviewed, rolling out r238244.

Added: trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-expected.txt (0 => 238266)


--- trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-expected.txt	2018-11-16 05:02:56 UTC (rev 238266)
@@ -0,0 +1,175 @@
+0
+1
+2
+3
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (visible rect 0.00, 0.00 800.00 x 600.00)
+  (coverage rect 0.00, 0.00 800.00 x 600.00)
+  (intersects coverage rect 1)
+  (contentsScale 2.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (visible rect 0.00, 0.00 800.00 x 600.00)
+      (coverage rect 0.00, 0.00 800.00 x 600.00)
+      (intersects coverage rect 1)
+      (contentsScale 2.00)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (bounds 800.00 600.00)
+          (drawsContent 1)
+          (visible rect 0.00, 0.00 800.00 x 600.00)
+          (coverage rect 0.00, 0.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 2.00)
+          (children 6
+            (GraphicsLayer
+              (bounds 50.00 50.00)
+              (contentsOpaque 1)
+              (transform [0.87 0.50 0.00 0.00] [-0.50 0.87 0.00 0.00] [0.00 0.00 1.00 0.00] [175.00 0.00 -5.00 1.00])
+              (visible rect 0.00, 0.00 50.00 x 50.00)
+              (coverage rect -160.71, -296.65 992.82 x 919.62)
+              (intersects coverage rect 1)
+              (contentsScale 2.00)
+            )
+            (GraphicsLayer
+              (position 250.00 0.00)
+              (bounds 50.00 50.00)
+              (contentsOpaque 1)
+              (transform [0.87 0.50 0.00 0.00] [-0.50 0.87 0.00 0.00] [0.00 0.00 1.00 0.00] [175.00 0.00 -5.00 1.00])
+              (visible rect 0.00, 0.00 50.00 x 50.00)
+              (coverage rect -377.21, -171.65 992.82 x 919.62)
+              (intersects coverage rect 1)
+              (contentsScale 2.00)
+            )
+            (GraphicsLayer
+              (bounds 800.00 600.00)
+              (drawsContent 1)
+              (visible rect 0.00, 0.00 800.00 x 600.00)
+              (coverage rect 0.00, 0.00 800.00 x 600.00)
+              (intersects coverage rect 1)
+              (contentsScale 2.00)
+            )
+            (GraphicsLayer
+              (position 5.00 5.00)
+              (bounds 210.00 210.00)
+              (drawsContent 1)
+              (visible rect 0.00, 0.00 210.00 x 210.00)
+              (coverage rect -5.00, -5.00 800.00 x 600.00)
+              (intersects coverage rect 1)
+              (contentsScale 2.00)
+            )
+            (GraphicsLayer
+              (position 255.00 5.00)
+              (bounds 210.00 210.00)
+              (drawsContent 1)
+              (visible rect 0.00, 0.00 210.00 x 210.00)
+              (coverage rect -255.00, -5.00 800.00 x 600.00)
+              (intersects coverage rect 1)
+              (contentsScale 2.00)
+              (children 1
+                (GraphicsLayer
+                  (offsetFromRenderer width=-5 height=-5)
+                  (position 5.00 5.00)
+                  (bounds 200.00 200.00)
+                  (visible rect 0.00, 0.00 200.00 x 200.00)
+                  (coverage rect 0.00, 0.00 200.00 x 200.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 2.00)
+                  (children 1
+                    (GraphicsLayer
+                      (offsetFromRenderer width=5 height=5)
+                      (bounds 200.00 400.00)
+                      (drawsContent 1)
+                      (visible rect 0.00, 0.00 200.00 x 200.00)
+                      (coverage rect 0.00, 0.00 200.00 x 200.00)
+                      (intersects coverage rect 1)
+                      (contentsScale 2.00)
+                    )
+                  )
+                )
+              )
+            )
+            (GraphicsLayer
+              (position 255.00 255.00)
+              (bounds 210.00 210.00)
+              (drawsContent 1)
+              (visible rect 0.00, 0.00 210.00 x 210.00)
+              (coverage rect -255.00, -255.00 800.00 x 600.00)
+              (intersects coverage rect 1)
+              (contentsScale 2.00)
+              (children 1
+                (GraphicsLayer
+                  (offsetFromRenderer width=-5 height=-5)
+                  (position 5.00 5.00)
+                  (bounds 200.00 200.00)
+                  (visible rect 0.00, 0.00 200.00 x 200.00)
+                  (coverage rect 0.00, 0.00 200.00 x 200.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 2.00)
+                  (children 1
+                    (GraphicsLayer
+                      (offsetFromRenderer width=5 height=5)
+                      (bounds 200.00 400.00)
+                      (drawsContent 1)
+                      (visible rect 0.00, 0.00 200.00 x 200.00)
+                      (coverage rect 0.00, 0.00 200.00 x 200.00)
+                      (intersects coverage rect 1)
+                      (contentsScale 2.00)
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
+
+
+(Frame scrolling node
+  (scrollable area size 800 600)
+  (contents size 800 600)
+  (scrollable area parameters 
+    (horizontal scroll elasticity 1)
+    (vertical scroll elasticity 1)
+    (horizontal scrollbar mode 0)
+    (vertical scrollbar mode 0))
+  (visual viewport enabled 1)
+  (layout viewport at (0,0) size 800x600)
+  (min layout viewport origin (0,0))
+  (max layout viewport origin (0,0))
+  (behavior for fixed 0)
+  (children 2
+    (Overflow scrolling node
+      (scrollable area size 200 200)
+      (contents size 200 400)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 1)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0))
+    )
+    (Overflow scrolling node
+      (scrollable area size 200 200)
+      (contents size 200 400)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 1)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0))
+    )
+  )
+)
+
+

Added: trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-nested-expected.txt (0 => 238266)


--- trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-nested-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-nested-expected.txt	2018-11-16 05:02:56 UTC (rev 238266)
@@ -0,0 +1,92 @@
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (visible rect 0.00, 0.00 800.00 x 600.00)
+  (coverage rect 0.00, 0.00 800.00 x 600.00)
+  (intersects coverage rect 1)
+  (contentsScale 2.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (visible rect 0.00, 0.00 800.00 x 600.00)
+      (coverage rect 0.00, 0.00 800.00 x 600.00)
+      (intersects coverage rect 1)
+      (contentsScale 2.00)
+      (tile cache coverage 0, 0 800 x 600)
+      (tile size 800 x 600)
+      (top left tile 0, 0 tiles grid 1 x 1)
+      (in window 1)
+      (children 1
+        (GraphicsLayer
+          (position 8.00 13.00)
+          (bounds 300.00 200.00)
+          (visible rect 0.00, 0.00 300.00 x 200.00)
+          (coverage rect -8.00, -13.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 2.00)
+          (children 1
+            (GraphicsLayer
+              (bounds 300.00 200.00)
+              (visible rect 0.00, 0.00 300.00 x 200.00)
+              (coverage rect 0.00, 0.00 300.00 x 200.00)
+              (intersects coverage rect 1)
+              (contentsScale 2.00)
+              (children 1
+                (GraphicsLayer
+                  (bounds 300.00 400.00)
+                  (drawsContent 1)
+                  (visible rect 0.00, 0.00 300.00 x 200.00)
+                  (coverage rect 0.00, 0.00 300.00 x 200.00)
+                  (intersects coverage rect 1)
+                  (contentsScale 2.00)
+                  (children 1
+                    (GraphicsLayer
+                      (bounds 200.00 50.00)
+                      (contentsOpaque 1)
+                      (transform [1.00 0.00 0.00 0.00] [0.00 1.00 0.00 0.00] [0.00 0.00 1.00 0.00] [50.00 100.00 0.00 1.00])
+                      (visible rect 0.00, 0.00 200.00 x 50.00)
+                      (coverage rect -50.00, -100.00 300.00 x 200.00)
+                      (intersects coverage rect 1)
+                      (contentsScale 2.00)
+                    )
+                  )
+                )
+              )
+            )
+          )
+        )
+      )
+    )
+  )
+)
+
+
+
+(Frame scrolling node
+  (scrollable area size 800 600)
+  (contents size 800 600)
+  (scrollable area parameters 
+    (horizontal scroll elasticity 1)
+    (vertical scroll elasticity 1)
+    (horizontal scrollbar mode 0)
+    (vertical scrollbar mode 0))
+  (visual viewport enabled 1)
+  (layout viewport at (0,0) size 800x600)
+  (min layout viewport origin (0,0))
+  (max layout viewport origin (0,0))
+  (behavior for fixed 0)
+  (children 1
+    (Overflow scrolling node
+      (scrollable area size 300 200)
+      (contents size 300 400)
+      (scrollable area parameters 
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 1)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0))
+    )
+  )
+)
+
+

Added: trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-nested.html (0 => 238266)


--- trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-nested.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize-nested.html	2018-11-16 05:02:56 UTC (rev 238266)
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Change scrollability on content resize (nested)</title>
+    <meta name="viewport" content="width=device-width">
+    <style>
+        #root {
+            width: 300px;
+            height: 200px;
+            position: absolute;
+        }
+        #scroller {
+            width: 100%;
+            height: 100%;
+            overflow-x: hidden;
+            overflow-y: scroll;
+            -webkit-overflow-scrolling: touch;
+            position: relative;
+        }
+        #content {
+            background-color: yellow;
+        }
+        #compositedDiv {
+            position: absolute;
+            top: 0;
+            left: 0;
+            width: 200px;
+            height: 50px;
+            background: lightblue;
+            transform: translate3d(50px, 100px, 0px);
+        }
+    </style>
+    <script>
+      if (window.testRunner) {
+          testRunner.dumpAsText();
+          testRunner.waitUntilDone();
+      }
+
+      function doTest() {
+          requestAnimationFrame(() => {
+              document.getElementById('content').style.height = "400px";
+              if (window.testRunner && window.internals) {
+                  requestAnimationFrame(() => {
+                      document.getElementById('layerTree').innerText = internals.layerTreeAsText(document,
+                              internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES) + "\n\n" +
+                          internals.scrollingStateTreeAsText() + "\n";
+                      testRunner.notifyDone();
+                  });
+              }
+          });
+      }
+      window.addEventListener('load', doTest, false);
+    </script>
+  </head>
+  <body>
+    <div id="root">
+      <div id="scroller">
+        <div id="content">
+          <div id="compositedDiv"></div>
+        </div>
+      </div>
+    </div>
+    <pre id="layerTree"></pre>
+</body>
+</html>

Added: trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize.html (0 => 238266)


--- trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/ios/change-scrollability-on-content-resize.html	2018-11-16 05:02:56 UTC (rev 238266)
@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Change scrollability on content resize</title>
+    <meta name="viewport" content="width=device-width">
+    <style>
+        .scrollable {
+            position: absolute;
+            left: 0px;
+            top: 0px;
+            width: 200px;
+            height: 200px;
+            overflow: auto;
+            -webkit-overflow-scrolling: touch;
+            border: 5px solid orange;
+            margin: 5px;
+        }
+        .scrollable-content {
+            width: 100px;
+            height: 100px;
+            background: lightgreen;
+        }
+        .overflowing {
+            height: 400px;
+        }
+        .composited {
+            z-index: -1;
+            position: absolute;
+            left: 0px;
+            top: 0px;
+            width: 50px;
+            height: 50px;
+            transform: translate3d(175px, 0px, -5px) rotate(30deg);
+            background: blue;
+        }
+        #compositedBecomeNonScrollable {
+            position: absolute;
+            left: 0px;
+            top: 0px;
+        }
+        #compositedBecomeScrollable {
+            position: absolute;
+            left: 250px;
+            top: 0px;
+        }
+        #nonCompositedBecomeNonScrollable {
+            position: absolute;
+            left: 0px;
+            top: 250px;
+        }
+        #nonCompositedBecomeScrollable {
+            position: absolute;
+            left: 250px;
+            top: 250px;
+        }
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+        }
+
+        function doTest() {
+            requestAnimationFrame(() => {
+                document.querySelectorAll('.scrollable-content').forEach((div) => {
+                    div.classList.toggle('overflowing');
+                });
+                if (window.testRunner && window.internals) {
+                    requestAnimationFrame(() => {
+                        document.getElementById('layerTree').innerText = internals.layerTreeAsText(document,
+                                internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES) + "\n\n" +
+                            internals.scrollingStateTreeAsText() + "\n";
+                        testRunner.notifyDone();
+                    });
+                }
+            });
+        }
+        window.addEventListener('load', doTest, false);
+    </script>
+  </head>
+  <body>
+    <div id="compositedBecomeNonScrollable">
+        <div class="scrollable">
+            <div class="scrollable-content overflowing">
+                0
+            </div>
+        </div>
+        <div class="composited"></div>
+    </div>
+    <div id="compositedBecomeScrollable">
+        <div class="scrollable">
+            <div class="scrollable-content">
+                1
+            </div>
+        </div>
+        <div class="composited"></div>
+    </div>
+    <div id="nonCompositedBecomeNonScrollable">
+        <div class="scrollable">
+            <div class="scrollable-content overflowing">
+                2
+            </div>
+        </div>
+    </div>
+    <div id="nonCompositedBecomeScrollable">
+        <div class="scrollable">
+            <div class="scrollable-content">
+                3
+            </div>
+        </div>
+    </div>
+    <pre id="layerTree"></pre>
+  </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (238265 => 238266)


--- trunk/Source/WebCore/ChangeLog	2018-11-16 03:09:31 UTC (rev 238265)
+++ trunk/Source/WebCore/ChangeLog	2018-11-16 05:02:56 UTC (rev 238266)
@@ -1,3 +1,31 @@
+2018-11-15  Simon Fraser  <[email protected]>
+
+        Overlay with -webkit-overflow-scrolling:touch doesn't become scrollable after added text makes it taller
+        https://bugs.webkit.org/show_bug.cgi?id=158342
+        rdar://problem/26652811
+
+        Reviewed by Zalan Bujtas.
+        
+        Patch partly by Frédéric Wang.
+
+        This commit fixes an issue when resizing the content of a -webkit-overflow-scrolling: touch
+        overflow node on iOS. Indeed, the RenderLayerBacking's scrolling layer may not be properly
+        created and hence the UIProcess receives a null UIScrollView pointer. This triggers an
+        assertion in debug mode and prevents the user from scrolling the overflow node in release
+        mode. This was partially fixed by the refactoring of bug 90342 but this commit addresses
+        the remaining issues by forcing a configuration update after layout in order to ensure that
+        RenderLayerBacking's scrolling layer is available. For an overflow element that is not yet
+        composited, trigger a post-layout update that is necessary to check if we need to make it
+        composited when it gains scrollable overflow.
+
+        Tests: fast/scrolling/ios/change-scrollability-on-content-resize-nested.html
+               fast/scrolling/ios/change-scrollability-on-content-resize.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateScrollInfoAfterLayout): Force a configuration update so that
+        RenderLayerCompositor::updateBackingAndHierarchy will later instantiate
+        RenderLayerBacking::m_scrollingLayer.
+
 2018-11-15  Fujii Hironori  <[email protected]>
 
         [curl] warning: delete called on non-final 'WebCore::CurlDownload' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (238265 => 238266)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-11-16 03:09:31 UTC (rev 238265)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2018-11-16 05:02:56 UTC (rev 238266)
@@ -3571,9 +3571,16 @@
     if (originalScrollOffset != scrollOffset())
         scrollToOffsetWithoutAnimation(IntPoint(scrollOffset()));
 
-    if (isComposited())
+    if (isComposited()) {
         setNeedsCompositingGeometryUpdate();
+        setNeedsCompositingConfigurationUpdate();
+    }
 
+#if PLATFORM(IOS_FAMILY)
+    if (canUseAcceleratedTouchScrolling())
+        setNeedsPostLayoutCompositingUpdate();
+#endif
+
     updateScrollSnapState();
 }
 

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (238265 => 238266)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2018-11-16 03:09:31 UTC (rev 238265)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2018-11-16 05:02:56 UTC (rev 238266)
@@ -718,7 +718,6 @@
     if (updateAncestorClippingLayer(compositor().clippedByAncestor(m_owningLayer)))
         layerConfigChanged = true;
 
-    // Requires layout.
     if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), requiresVerticalScrollbarLayer(), requiresScrollCornerLayer()))
         layerConfigChanged = true;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to