twitch.tv: embedded video hovers down the screen when scrolling on iPad
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jun 2019 18:36:03 +0000 (18:36 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 13 Jun 2019 18:36:03 +0000 (18:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=198832
<rdar://problem/51541439>

Reviewed by Simon Fraser.

Source/WebCore:

Test: compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling.html

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollTo):

Overflow scroll layer may have composited descendants that are its paint order siblings. We need to invalidate
the tree of the paint order parent for compositing update (instead of just the tree of the overflow scroll layer).

This matches what RenderLayer::updateLayerPosition() does.

LayoutTests:

* compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling-expected.html: Added.
* compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling-expected.html [new file with mode: 0644]
LayoutTests/compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayer.cpp

index 5d5a20d..5d4d28b 100644 (file)
@@ -1,3 +1,14 @@
+2019-06-13  Antti Koivisto  <antti@apple.com>
+
+        twitch.tv: embedded video hovers down the screen when scrolling on iPad
+        https://bugs.webkit.org/show_bug.cgi?id=198832
+        <rdar://problem/51541439>
+
+        Reviewed by Simon Fraser.
+
+        * compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling-expected.html: Added.
+        * compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling.html: Added.
+
 2019-06-13  Youenn Fablet  <youenn@apple.com>
 
         Import WPT websockets tests
diff --git a/LayoutTests/compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling-expected.html b/LayoutTests/compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling-expected.html
new file mode 100644 (file)
index 0000000..514f7ed
--- /dev/null
@@ -0,0 +1,31 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<style>
+.scroll {
+    overflow:scroll;
+    width: 500px;
+    height: 500px;
+    border: 2px solid yellow;
+}
+.content {
+    overflow:hidden;
+    width: 500px;
+    height: 1500px;
+    border: 10px solid green;
+}
+.stuff {
+    position:relative;
+    top: 200px;
+    width: 50px;
+    height: 50px;
+    background: red;
+}
+</style>
+<div class="scroll" id="scroller">
+    <div class="content">
+        <div class="stuff">
+        </div>
+    </div>
+</div>
+<script>
+scroller.scrollTo(0, 100);
+</script>
diff --git a/LayoutTests/compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling.html b/LayoutTests/compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling.html
new file mode 100644 (file)
index 0000000..381227c
--- /dev/null
@@ -0,0 +1,32 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<style>
+.scroll {
+    overflow:scroll;
+    width: 500px;
+    height: 500px;
+    border: 2px solid yellow;
+}
+.content {
+    overflow:hidden;
+    width: 500px;
+    height: 1500px;
+    border: 10px solid green;
+}
+.stuff {
+    position:relative;
+    top: 200px;
+    width: 50px;
+    height: 50px;
+    background: red;
+    will-change:transform;
+}
+</style>
+<div class="scroll" id="scroller">
+    <div class="content">
+        <div class="stuff">
+        </div>
+    </div>
+</div>
+<script>
+scroller.scrollTo(0, 100);
+</script>
index 3edf461..e7dc3d9 100644 (file)
@@ -1,3 +1,21 @@
+2019-06-13  Antti Koivisto  <antti@apple.com>
+
+        twitch.tv: embedded video hovers down the screen when scrolling on iPad
+        https://bugs.webkit.org/show_bug.cgi?id=198832
+        <rdar://problem/51541439>
+
+        Reviewed by Simon Fraser.
+
+        Test: compositing/scrolling/async-overflow-scrolling/overflow-scroll-paint-order-sibling.html
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollTo):
+
+        Overflow scroll layer may have composited descendants that are its paint order siblings. We need to invalidate
+        the tree of the paint order parent for compositing update (instead of just the tree of the overflow scroll layer).
+
+        This matches what RenderLayer::updateLayerPosition() does.
+
 2019-06-13  Youenn Fablet  <youenn@apple.com>
 
         SocketStreamHandle should not be destroyed in a background thread
index a6a3046..6b6e8b0 100644 (file)
@@ -2515,7 +2515,11 @@ void RenderLayer::scrollTo(const ScrollPosition& position)
             // when that completes.
             if (usesCompositedScrolling()) {
                 setNeedsCompositingGeometryUpdate();
-                setDescendantsNeedUpdateBackingAndHierarchyTraversal();
+
+                // Scroll position can affect the location of a composited descendant (which may be a sibling in z-order),
+                // so trigger a descendant walk from the paint-order parent.
+                if (auto* paintParent = paintOrderParent())
+                    paintParent->setDescendantsNeedUpdateBackingAndHierarchyTraversal();
             }
 
             updateCompositingLayersAfterScroll();