Overlay with -webkit-overflow-scrolling:touch doesn't become scrollable after added...
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Nov 2018 08:19:47 +0000 (08:19 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Nov 2018 08:19:47 +0000 (08:19 +0000)
https://bugs.webkit.org/show_bug.cgi?id=158342

Patch by Frederic Wang <fwang@igalia.com> on 2018-11-06
Reviewed by Simon Fraser.

Source/WebCore:

Resizing the content of a -webkit-overflow-scrolling:touch overflow node on iOS may make it
scrollable. However, the RenderLayerBacking's scrolling layer is not properly created
when RenderLayerCompositor::updateScrollCoordinatedLayer is called and hence the UIProcess
receives a null UIScrollView pointer when ScrollingTreeScrollingNodeDelegateIOS performs the
associated update. In debug mode this hits an ASSERT and in release mode the overflow node
remains unscrollable from the user's point of view. This patch fixes this issue by ensuring
the RenderLayerBacking's scrolling layer is created during updateScrollCoordinatedStatus.

Test: fast/scrolling/ios/update-scroll-coordinated-status.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus): Call updateConfiguration()
to ensure the scrolling layer is present and indicate whether a rebuild is necessary.

LayoutTests:

Add a test to ensure the change of scrolling status is reflected in the layer and scrolling
trees. This test should also ASSERT in debug mode without the associated code change.

* fast/scrolling/ios/update-scroll-coordinated-status-expected.txt: Added.
* fast/scrolling/ios/update-scroll-coordinated-status.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@237849 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/scrolling/ios/update-scroll-coordinated-status-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/ios/update-scroll-coordinated-status.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerCompositor.cpp

index c5f1885..d9214a9 100644 (file)
@@ -1,3 +1,16 @@
+2018-11-06  Frederic Wang  <fwang@igalia.com>
+
+        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
+
+        Reviewed by Simon Fraser.
+
+        Add a test to ensure the change of scrolling status is reflected in the layer and scrolling
+        trees. This test should also ASSERT in debug mode without the associated code change.
+
+        * fast/scrolling/ios/update-scroll-coordinated-status-expected.txt: Added.
+        * fast/scrolling/ios/update-scroll-coordinated-status.html: Added.
+
 2018-11-05  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [iOS] Swatch appears squished and off-center in inputs of type color
diff --git a/LayoutTests/fast/scrolling/ios/update-scroll-coordinated-status-expected.txt b/LayoutTests/fast/scrolling/ios/update-scroll-coordinated-status-expected.txt
new file mode 100644 (file)
index 0000000..7f8cc26
--- /dev/null
@@ -0,0 +1,108 @@
+(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 2
+        (GraphicsLayer
+          (position 13.00 18.00)
+          (bounds 210.00 210.00)
+          (drawsContent 1)
+          (visible rect 0.00, 0.00 210.00 x 210.00)
+          (coverage rect -13.00, -18.00 800.00 x 600.00)
+          (intersects coverage rect 1)
+          (contentsScale 2.00)
+        )
+        (GraphicsLayer
+          (position 255.00 18.00)
+          (bounds 210.00 210.00)
+          (drawsContent 1)
+          (visible rect 0.00, 0.00 210.00 x 210.00)
+          (coverage rect -255.00, -18.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
+    (Fixed node
+      (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
+      (viewport rect at last layout at (0,0) size 800x600)
+      (layer position at last layout (13,18))
+      (children 0
+      )
+    )
+    (Fixed node
+      (anchor edges: AnchorEdgeLeft AnchorEdgeTop)
+      (viewport rect at last layout at (0,0) size 800x600)
+      (layer position at last layout (255,18))
+      (children 1
+        (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))
+        )
+      )
+    )
+  )
+)
+
+
diff --git a/LayoutTests/fast/scrolling/ios/update-scroll-coordinated-status.html b/LayoutTests/fast/scrolling/ios/update-scroll-coordinated-status.html
new file mode 100644 (file)
index 0000000..76b2b01
--- /dev/null
@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Update scroll coordinated status</title>
+    <style>
+      .scrollable {
+          position: fixed;
+          width: 200px;
+          height: 200px;
+          overflow: auto;
+          -webkit-overflow-scrolling: touch;
+          border: 5px solid orange;
+          margin: 5px;
+      }
+      .scrollable-content {
+          width: 100px;
+          height: 100px;
+          background: linear-gradient(135deg, yellow, cyan);
+      }
+      .overflowing {
+          height: 400px;
+      }
+    </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 class="scrollable">
+      <div class="scrollable-content overflowing">
+      </div>
+    </div>
+    <div class="scrollable" style="left: 250px">
+      <div class="scrollable-content">
+      </div>
+    </div>
+    <pre id="layerTree"></pre>
+  </body>
+</html>
index 7162b7a..026d594 100644 (file)
@@ -1,3 +1,24 @@
+2018-11-06  Frederic Wang  <fwang@igalia.com>
+
+        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
+
+        Reviewed by Simon Fraser.
+
+        Resizing the content of a -webkit-overflow-scrolling:touch overflow node on iOS may make it
+        scrollable. However, the RenderLayerBacking's scrolling layer is not properly created
+        when RenderLayerCompositor::updateScrollCoordinatedLayer is called and hence the UIProcess
+        receives a null UIScrollView pointer when ScrollingTreeScrollingNodeDelegateIOS performs the
+        associated update. In debug mode this hits an ASSERT and in release mode the overflow node
+        remains unscrollable from the user's point of view. This patch fixes this issue by ensuring
+        the RenderLayerBacking's scrolling layer is created during updateScrollCoordinatedStatus.
+
+        Test: fast/scrolling/ios/update-scroll-coordinated-status.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateScrollCoordinatedStatus): Call updateConfiguration()
+        to ensure the scrolling layer is present and indicate whether a rebuild is necessary.
+
 2018-11-05  Zan Dobersek  <zdobersek@igalia.com>
 
         Place Fontconfig-specific RefPtr specializations in RefPtrFontconfig.h
index b655ff2..956d3a5 100644 (file)
@@ -3544,6 +3544,9 @@ void RenderLayerCompositor::updateScrollCoordinatedStatus(RenderLayer& layer, Op
     if (layer.isComposited())
         layer.backing()->setIsScrollCoordinatedWithViewportConstrainedRole(coordinationRoles.contains(ViewportConstrained));
 
+    if (layer.backing() && layer.backing()->updateConfiguration())
+        setCompositingLayersNeedRebuild();
+
     if (coordinationRoles && canCoordinateScrollingForLayer(layer)) {
         if (m_scrollCoordinatedLayers.add(&layer).isNewEntry)
             m_subframeScrollLayersNeedReattach = true;