Trying to scroll the compose pane on gmail.com scrolls the message list behind
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Apr 2019 16:38:03 +0000 (16:38 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Apr 2019 16:38:03 +0000 (16:38 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196426
<rdar://problem/49402667>

Reviewed by Darin Adler.

Source/WebCore:

Test: fast/scrolling/ios/event-region-visibility-hidden.html

We fail to gather event region from desdendants of non-overflowing elements with 'visibility:hidden'.

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::paintObject):

Skip the subtree walk only if the current region covers the box already.

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

Remove the (wrong) optimization, we bail out quickly on first renderer if possible so this is not high value.

LayoutTests:

* fast/scrolling/ios/event-region-visibility-hidden-expected.txt: Added.
* fast/scrolling/ios/event-region-visibility-hidden.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/scrolling/ios/event-region-visibility-hidden-expected.txt [new file with mode: 0644]
LayoutTests/fast/scrolling/ios/event-region-visibility-hidden.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderLayer.cpp

index 64f2867..f49d27c 100644 (file)
@@ -1,3 +1,14 @@
+2019-04-01  Antti Koivisto  <antti@apple.com>
+
+        Trying to scroll the compose pane on gmail.com scrolls the message list behind
+        https://bugs.webkit.org/show_bug.cgi?id=196426
+        <rdar://problem/49402667>
+
+        Reviewed by Darin Adler.
+
+        * fast/scrolling/ios/event-region-visibility-hidden-expected.txt: Added.
+        * fast/scrolling/ios/event-region-visibility-hidden.html: Added.
+
 2019-04-01  Cathie Chen  <cathiechen@igalia.com>
 
         Change expectation for imported/w3c/web-platform-tests/resize-observer/eventloop.html.
diff --git a/LayoutTests/fast/scrolling/ios/event-region-visibility-hidden-expected.txt b/LayoutTests/fast/scrolling/ios/event-region-visibility-hidden-expected.txt
new file mode 100644 (file)
index 0000000..faea0cd
--- /dev/null
@@ -0,0 +1,47 @@
+  
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 800.00 600.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 800.00 600.00)
+      (contentsOpaque 1)
+      (children 4
+        (GraphicsLayer
+          (position 8.00 8.00)
+          (bounds 204.00 204.00)
+          (drawsContent 1)
+          (event region
+            (rect (2,2) width=50 height=50)
+          )
+        )
+        (GraphicsLayer
+          (position 216.00 8.00)
+          (bounds 204.00 204.00)
+          (drawsContent 1)
+          (event region
+            (rect (2,2) width=50 height=50)
+          )
+        )
+        (GraphicsLayer
+          (position 424.00 8.00)
+          (bounds 204.00 204.00)
+          (drawsContent 1)
+          (event region
+            (rect (152,152) width=50 height=50)
+          )
+        )
+        (GraphicsLayer
+          (position 8.00 217.00)
+          (bounds 204.00 204.00)
+          (drawsContent 1)
+          (event region
+            (rect (152,152) width=50 height=50)
+          )
+        )
+      )
+    )
+  )
+)
+
diff --git a/LayoutTests/fast/scrolling/ios/event-region-visibility-hidden.html b/LayoutTests/fast/scrolling/ios/event-region-visibility-hidden.html
new file mode 100644 (file)
index 0000000..26196e1
--- /dev/null
@@ -0,0 +1,53 @@
+<html>
+<style>
+.testdiv {
+    display: inline-block;
+    border: 2px solid blue;
+    position: relative;
+    height: 200px;
+    width: 200px;
+    background-color: blue;
+    will-change: transform;
+}
+.inner {
+    height: 50px;
+    width: 50px;
+    background-color: green;
+}
+.positioned {
+    position: absolute;
+    left: 150px;
+    top: 150px;
+}
+</style>
+<script>
+window.onload = function () {
+    if (!window.internals)
+        return;
+    if (window.testRunner)
+        testRunner.dumpAsText();
+
+    document.body.offsetLeft;
+
+    test2.style.visibility = 'visible';
+    test4.style.visibility = 'visible';
+
+    results.innerText += internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_EVENT_REGION);
+}
+</script>
+<body>
+<div class="testdiv" style="visibility:hidden">
+    <div class="inner" style="visibility:visible"></div>
+</div>
+<div class="testdiv" style="visibility:hidden">
+    <div class="inner" id="test2"></div>
+</div>
+<div class="testdiv" style="visibility:hidden">
+    <div class="inner positioned" style="visibility:visible"></div>
+</div>
+<div class="testdiv" style="visibility:hidden">
+    <div class="inner positioned" id="test4"></div>
+</div>
+<pre id="results"></pre>
+</body>
+</html>
index 477eb29..9348559 100644 (file)
@@ -1,3 +1,25 @@
+2019-04-01  Antti Koivisto  <antti@apple.com>
+
+        Trying to scroll the compose pane on gmail.com scrolls the message list behind
+        https://bugs.webkit.org/show_bug.cgi?id=196426
+        <rdar://problem/49402667>
+
+        Reviewed by Darin Adler.
+
+        Test: fast/scrolling/ios/event-region-visibility-hidden.html
+
+        We fail to gather event region from desdendants of non-overflowing elements with 'visibility:hidden'.
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::paintObject):
+
+        Skip the subtree walk only if the current region covers the box already.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintList):
+
+        Remove the (wrong) optimization, we bail out quickly on first renderer if possible so this is not high value.
+
 2019-04-01  Emilio Cobos Ãlvarez  <emilio@crisal.io>
 
         Be less strict about closing blocks in attribute and functional pseudo-element selectors.
index 2a1b0b2..96f85f5 100644 (file)
@@ -1248,8 +1248,8 @@ void RenderBlock::paintObject(PaintInfo& paintInfo, const LayoutPoint& paintOffs
             paintInfo.eventRegion->unite(borderRegion);
         }
 
-        // No need to check descendants if we don't have overflow.
-        if (!hasVisualOverflow())
+        // No need to check descendants if we don't have overflow and the area is already covered.
+        if (!hasVisualOverflow() && paintInfo.eventRegion->contains(enclosingIntRect(borderRect)))
             return;
     }
 
index bd11f90..de2789f 100644 (file)
@@ -4488,9 +4488,6 @@ void RenderLayer::paintList(LayerList layerIterator, GraphicsContext& context, c
     if (!hasSelfPaintingLayerDescendant())
         return;
 
-    if (paintFlags.contains(PaintLayerCollectingEventRegion) && renderBox() && !renderBox()->hasRenderOverflow())
-        return;
-
 #if !ASSERT_DISABLED
     LayerListMutationDetector mutationChecker(*this);
 #endif