Title: [267633] branches/safari-610-branch
Revision
267633
Author
[email protected]
Date
2020-09-26 14:08:45 -0700 (Sat, 26 Sep 2020)

Log Message

Cherry-pick r266923. rdar://problem/69586712

    REGRESSION (Async overflow scroll): Mouse wheel scrolling over an "always-on" overflow scrollbar doesn't work
    https://bugs.webkit.org/show_bug.cgi?id=216381
    <rdar://problem/68593743>

    Reviewed by Antti Koivisto.

    Source/WebCore:

    The scrollbar and scroll corner layers need event regions and scrollingNodeIDs so that
    we hit-test them via CA layers and find the right scrolling node.

    Test: fast/scrolling/mac/mousewheel-over-scrollbar.html

    * rendering/RenderLayerBacking.cpp:
    (WebCore::RenderLayerBacking::updateAfterDescendants):
    (WebCore::RenderLayerBacking::updateEventRegion):
    (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
    (WebCore::RenderLayerBacking::setScrollingNodeIDForRole):

    LayoutTests:

    * fast/scrolling/mac/border-radius-event-region-expected.txt:
    * fast/scrolling/mac/event-region-scrolled-contents-layer-expected.txt:
    * fast/scrolling/mac/event-region-subscroller-overflow-expected.txt:
    * fast/scrolling/mac/event-region-visibility-hidden-expected.txt:
    * fast/scrolling/mac/mousewheel-over-scrollbar-expected.txt: Added.
    * fast/scrolling/mac/mousewheel-over-scrollbar.html: Added.
    * fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt:

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

Modified Paths

Added Paths

Diff

Modified: branches/safari-610-branch/LayoutTests/ChangeLog (267632 => 267633)


--- branches/safari-610-branch/LayoutTests/ChangeLog	2020-09-26 21:08:41 UTC (rev 267632)
+++ branches/safari-610-branch/LayoutTests/ChangeLog	2020-09-26 21:08:45 UTC (rev 267633)
@@ -1,5 +1,57 @@
 2020-09-25  Alan Coon  <[email protected]>
 
+        Cherry-pick r266923. rdar://problem/69586712
+
+    REGRESSION (Async overflow scroll): Mouse wheel scrolling over an "always-on" overflow scrollbar doesn't work
+    https://bugs.webkit.org/show_bug.cgi?id=216381
+    <rdar://problem/68593743>
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    The scrollbar and scroll corner layers need event regions and scrollingNodeIDs so that
+    we hit-test them via CA layers and find the right scrolling node.
+    
+    Test: fast/scrolling/mac/mousewheel-over-scrollbar.html
+    
+    * rendering/RenderLayerBacking.cpp:
+    (WebCore::RenderLayerBacking::updateAfterDescendants):
+    (WebCore::RenderLayerBacking::updateEventRegion):
+    (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
+    (WebCore::RenderLayerBacking::setScrollingNodeIDForRole):
+    
+    LayoutTests:
+    
+    * fast/scrolling/mac/border-radius-event-region-expected.txt:
+    * fast/scrolling/mac/event-region-scrolled-contents-layer-expected.txt:
+    * fast/scrolling/mac/event-region-subscroller-overflow-expected.txt:
+    * fast/scrolling/mac/event-region-visibility-hidden-expected.txt:
+    * fast/scrolling/mac/mousewheel-over-scrollbar-expected.txt: Added.
+    * fast/scrolling/mac/mousewheel-over-scrollbar.html: Added.
+    * fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-09-11  Simon Fraser  <[email protected]>
+
+            REGRESSION (Async overflow scroll): Mouse wheel scrolling over an "always-on" overflow scrollbar doesn't work
+            https://bugs.webkit.org/show_bug.cgi?id=216381
+            <rdar://problem/68593743>
+
+            Reviewed by Antti Koivisto.
+
+            * fast/scrolling/mac/border-radius-event-region-expected.txt:
+            * fast/scrolling/mac/event-region-scrolled-contents-layer-expected.txt:
+            * fast/scrolling/mac/event-region-subscroller-overflow-expected.txt:
+            * fast/scrolling/mac/event-region-visibility-hidden-expected.txt:
+            * fast/scrolling/mac/mousewheel-over-scrollbar-expected.txt: Added.
+            * fast/scrolling/mac/mousewheel-over-scrollbar.html: Added.
+            * fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt:
+
+2020-09-25  Alan Coon  <[email protected]>
+
         Cherry-pick r266887. rdar://problem/69586659
 
     REGRESSION (r257839): clickpay.com - password placeholder text cannot be replaced

Modified: branches/safari-610-branch/LayoutTests/fast/scrolling/mac/border-radius-event-region-expected.txt (267632 => 267633)


--- branches/safari-610-branch/LayoutTests/fast/scrolling/mac/border-radius-event-region-expected.txt	2020-09-26 21:08:41 UTC (rev 267632)
+++ branches/safari-610-branch/LayoutTests/fast/scrolling/mac/border-radius-event-region-expected.txt	2020-09-26 21:08:45 UTC (rev 267633)
@@ -35,16 +35,25 @@
                   (position 0.00 35.00)
                   (bounds 35.00 15.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=35 height=15)
+                  )
                 )
                 (GraphicsLayer
                   (position 35.00 0.00)
                   (bounds 15.00 35.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=15 height=35)
+                  )
                 )
                 (GraphicsLayer
                   (position 35.00 35.00)
                   (bounds 15.00 15.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=15 height=15)
+                  )
                 )
               )
             )

Modified: branches/safari-610-branch/LayoutTests/fast/scrolling/mac/event-region-scrolled-contents-layer-expected.txt (267632 => 267633)


--- branches/safari-610-branch/LayoutTests/fast/scrolling/mac/event-region-scrolled-contents-layer-expected.txt	2020-09-26 21:08:41 UTC (rev 267632)
+++ branches/safari-610-branch/LayoutTests/fast/scrolling/mac/event-region-scrolled-contents-layer-expected.txt	2020-09-26 21:08:45 UTC (rev 267633)
@@ -36,16 +36,25 @@
                   (position 0.00 285.00)
                   (bounds 285.00 15.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=285 height=15)
+                  )
                 )
                 (GraphicsLayer
                   (position 285.00 0.00)
                   (bounds 15.00 285.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=15 height=285)
+                  )
                 )
                 (GraphicsLayer
                   (position 285.00 285.00)
                   (bounds 15.00 15.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=15 height=15)
+                  )
                 )
               )
             )

Modified: branches/safari-610-branch/LayoutTests/fast/scrolling/mac/event-region-subscroller-overflow-expected.txt (267632 => 267633)


--- branches/safari-610-branch/LayoutTests/fast/scrolling/mac/event-region-subscroller-overflow-expected.txt	2020-09-26 21:08:41 UTC (rev 267632)
+++ branches/safari-610-branch/LayoutTests/fast/scrolling/mac/event-region-subscroller-overflow-expected.txt	2020-09-26 21:08:45 UTC (rev 267633)
@@ -57,16 +57,25 @@
                   (position 0.00 35.00)
                   (bounds 35.00 15.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=35 height=15)
+                  )
                 )
                 (GraphicsLayer
                   (position 35.00 0.00)
                   (bounds 15.00 35.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=15 height=35)
+                  )
                 )
                 (GraphicsLayer
                   (position 35.00 35.00)
                   (bounds 15.00 15.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=15 height=15)
+                  )
                 )
               )
             )

Modified: branches/safari-610-branch/LayoutTests/fast/scrolling/mac/event-region-visibility-hidden-expected.txt (267632 => 267633)


--- branches/safari-610-branch/LayoutTests/fast/scrolling/mac/event-region-visibility-hidden-expected.txt	2020-09-26 21:08:41 UTC (rev 267632)
+++ branches/safari-610-branch/LayoutTests/fast/scrolling/mac/event-region-visibility-hidden-expected.txt	2020-09-26 21:08:45 UTC (rev 267633)
@@ -37,16 +37,25 @@
                   (position 0.00 35.00)
                   (bounds 35.00 15.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=35 height=15)
+                  )
                 )
                 (GraphicsLayer
                   (position 35.00 0.00)
                   (bounds 15.00 35.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=15 height=35)
+                  )
                 )
                 (GraphicsLayer
                   (position 35.00 35.00)
                   (bounds 15.00 15.00)
                   (drawsContent 1)
+                  (event region
+                    (rect (0,0) width=15 height=15)
+                  )
                 )
               )
             )

Added: branches/safari-610-branch/LayoutTests/fast/scrolling/mac/mousewheel-over-scrollbar-expected.txt (0 => 267633)


--- branches/safari-610-branch/LayoutTests/fast/scrolling/mac/mousewheel-over-scrollbar-expected.txt	                        (rev 0)
+++ branches/safari-610-branch/LayoutTests/fast/scrolling/mac/mousewheel-over-scrollbar-expected.txt	2020-09-26 21:08:45 UTC (rev 267633)
@@ -0,0 +1,13 @@
+asdf
+
+Test scroll over content
+PASS overflowScrollEventCount > 0 is true
+PASS windowScrollEventCount == 0 is true
+
+Test scroll over border
+PASS overflowScrollEventCount > 0 is true
+PASS windowScrollEventCount == 0 is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: branches/safari-610-branch/LayoutTests/fast/scrolling/mac/mousewheel-over-scrollbar.html (0 => 267633)


--- branches/safari-610-branch/LayoutTests/fast/scrolling/mac/mousewheel-over-scrollbar.html	                        (rev 0)
+++ branches/safari-610-branch/LayoutTests/fast/scrolling/mac/mousewheel-over-scrollbar.html	2020-09-26 21:08:45 UTC (rev 267633)
@@ -0,0 +1,107 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        body {
+            height: 1000px;
+        }
+        .scroller {
+            top: 10px;
+            left: 10px;
+            height: 300px;
+            width: 300px;
+            border: 20px solid gray;
+            padding: 5px;
+            overflow-y: scroll;
+        }
+        .content {
+            height: 400%;
+        }
+
+        ::-webkit-scrollbar {
+            width: 50px
+        }
+
+        ::-webkit-scrollbar-track {
+            background: silver;
+        }
+
+        ::-webkit-scrollbar-thumb {
+            background-color: gray;
+        }
+    </style>
+    <script src=""
+    <script src=""
+    <script>
+        var jsTestIsAsync = true;
+
+        var scroller;
+        var overflowScrollEventCount = 0;
+        var windowScrollEventCount = 0;
+
+        async function resetScrollPositions()
+        {
+            window.scrollTo(0, 0);
+            scroller.scrollTop = 0;
+            
+            // Wait for scroll events to fire.
+            await UIHelper.renderingUpdate();
+
+            overflowScrollEventCount = 0;
+            windowScrollEventCount = 0;
+        }
+        
+        async function testScrollOverContent()
+        {
+            debug('');
+            debug('Test scroll over content');
+            await resetScrollPositions();
+            await UIHelper.mouseWheelScrollAt(100, 100);
+
+            shouldBe('overflowScrollEventCount > 0', 'true');
+            shouldBe('windowScrollEventCount == 0', 'true');
+        }
+
+        async function testScrollOverScrollbar()
+        {
+            debug('');
+            debug('Test scroll over border');
+            await resetScrollPositions();
+            
+            let bounds = scroller.getBoundingClientRect();
+            await UIHelper.mouseWheelScrollAt(bounds.right - 50, bounds.top + 50);
+            
+            shouldBe('overflowScrollEventCount > 0', 'true');
+            shouldBe('windowScrollEventCount == 0', 'true');
+        }
+
+        async function scrollTest()
+        {
+            await testScrollOverContent();
+            await testScrollOverScrollbar();
+
+            finishJSTest();
+        }
+
+        window.addEventListener('load', () => {
+            scroller = document.querySelector('.scroller');
+            scroller.addEventListener('scroll', () => {
+                ++overflowScrollEventCount;
+            }, false);
+
+            window.addEventListener('scroll', () => {
+                ++windowScrollEventCount;
+            }, false);
+
+            setTimeout(scrollTest, 0);
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="scroller">
+        <div class="content">asdf</div>
+    </div>
+    <div id="console"></div>
+    <script src=""
+</body>
+</html>

Modified: branches/safari-610-branch/LayoutTests/fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt (267632 => 267633)


--- branches/safari-610-branch/LayoutTests/fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt	2020-09-26 21:08:41 UTC (rev 267632)
+++ branches/safari-610-branch/LayoutTests/fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt	2020-09-26 21:08:45 UTC (rev 267633)
@@ -55,16 +55,25 @@
                           (position 0.00 625.00)
                           (bounds 425.00 15.00)
                           (drawsContent 1)
+                          (event region
+                            (rect (0,0) width=425 height=15)
+                          )
                         )
                         (GraphicsLayer
                           (position 425.00 0.00)
                           (bounds 15.00 625.00)
                           (drawsContent 1)
+                          (event region
+                            (rect (0,0) width=15 height=625)
+                          )
                         )
                         (GraphicsLayer
                           (position 425.00 625.00)
                           (bounds 15.00 15.00)
                           (drawsContent 1)
+                          (event region
+                            (rect (0,0) width=15 height=15)
+                          )
                         )
                       )
                     )

Modified: branches/safari-610-branch/Source/WebCore/ChangeLog (267632 => 267633)


--- branches/safari-610-branch/Source/WebCore/ChangeLog	2020-09-26 21:08:41 UTC (rev 267632)
+++ branches/safari-610-branch/Source/WebCore/ChangeLog	2020-09-26 21:08:45 UTC (rev 267633)
@@ -1,5 +1,60 @@
 2020-09-25  Alan Coon  <[email protected]>
 
+        Cherry-pick r266923. rdar://problem/69586712
+
+    REGRESSION (Async overflow scroll): Mouse wheel scrolling over an "always-on" overflow scrollbar doesn't work
+    https://bugs.webkit.org/show_bug.cgi?id=216381
+    <rdar://problem/68593743>
+    
+    Reviewed by Antti Koivisto.
+    
+    Source/WebCore:
+    
+    The scrollbar and scroll corner layers need event regions and scrollingNodeIDs so that
+    we hit-test them via CA layers and find the right scrolling node.
+    
+    Test: fast/scrolling/mac/mousewheel-over-scrollbar.html
+    
+    * rendering/RenderLayerBacking.cpp:
+    (WebCore::RenderLayerBacking::updateAfterDescendants):
+    (WebCore::RenderLayerBacking::updateEventRegion):
+    (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
+    (WebCore::RenderLayerBacking::setScrollingNodeIDForRole):
+    
+    LayoutTests:
+    
+    * fast/scrolling/mac/border-radius-event-region-expected.txt:
+    * fast/scrolling/mac/event-region-scrolled-contents-layer-expected.txt:
+    * fast/scrolling/mac/event-region-subscroller-overflow-expected.txt:
+    * fast/scrolling/mac/event-region-visibility-hidden-expected.txt:
+    * fast/scrolling/mac/mousewheel-over-scrollbar-expected.txt: Added.
+    * fast/scrolling/mac/mousewheel-over-scrollbar.html: Added.
+    * fast/scrolling/mac/negative-z-index-overflow-scroll-expected.txt:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266923 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2020-09-11  Simon Fraser  <[email protected]>
+
+            REGRESSION (Async overflow scroll): Mouse wheel scrolling over an "always-on" overflow scrollbar doesn't work
+            https://bugs.webkit.org/show_bug.cgi?id=216381
+            <rdar://problem/68593743>
+
+            Reviewed by Antti Koivisto.
+
+            The scrollbar and scroll corner layers need event regions and scrollingNodeIDs so that
+            we hit-test them via CA layers and find the right scrolling node.
+
+            Test: fast/scrolling/mac/mousewheel-over-scrollbar.html
+
+            * rendering/RenderLayerBacking.cpp:
+            (WebCore::RenderLayerBacking::updateAfterDescendants):
+            (WebCore::RenderLayerBacking::updateEventRegion):
+            (WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
+            (WebCore::RenderLayerBacking::setScrollingNodeIDForRole):
+
+2020-09-25  Alan Coon  <[email protected]>
+
         Cherry-pick r266899. rdar://problem/69586659
 
     Address a post-commit review comment after r266887

Modified: branches/safari-610-branch/Source/WebCore/rendering/RenderLayerBacking.cpp (267632 => 267633)


--- branches/safari-610-branch/Source/WebCore/rendering/RenderLayerBacking.cpp	2020-09-26 21:08:41 UTC (rev 267632)
+++ branches/safari-610-branch/Source/WebCore/rendering/RenderLayerBacking.cpp	2020-09-26 21:08:45 UTC (rev 267633)
@@ -1535,7 +1535,15 @@
     m_graphicsLayer->setContentsVisible(m_owningLayer.hasVisibleContent() || hasVisibleNonCompositedDescendants());
     if (m_scrollContainerLayer) {
         m_scrollContainerLayer->setContentsVisible(renderer().style().visibility() == Visibility::Visible);
-        m_scrollContainerLayer->setUserInteractionEnabled(renderer().style().pointerEvents() != PointerEvents::None);
+
+        bool userInteractive = renderer().style().pointerEvents() != PointerEvents::None;
+        m_scrollContainerLayer->setUserInteractionEnabled(userInteractive);
+        if (m_layerForHorizontalScrollbar)
+            m_layerForHorizontalScrollbar->setUserInteractionEnabled(userInteractive);
+        if (m_layerForVerticalScrollbar)
+            m_layerForVerticalScrollbar->setUserInteractionEnabled(userInteractive);
+        if (m_layerForScrollCorner)
+            m_layerForScrollCorner->setUserInteractionEnabled(userInteractive);
     }
 
 #if USE(OWNING_LAYER_BEAR_TRAP)
@@ -1743,6 +1751,20 @@
 
     TraceScope scope(ComputeEventRegionsStart, ComputeEventRegionsEnd);
 
+    auto visibleToHitTesting = renderer().visibleToHitTesting();
+
+    auto setEventRegionToLayerBounds = [&](GraphicsLayer* graphicsLayer) {
+        if (!graphicsLayer)
+            return;
+
+        EventRegion eventRegion;
+        auto eventRegionContext = eventRegion.makeContext();
+        if (visibleToHitTesting)
+            eventRegionContext.unite(enclosingIntRect(FloatRect({ }, graphicsLayer->size())), renderer().style());
+
+        graphicsLayer->setEventRegion(WTFMove(eventRegion));
+    };
+
     auto updateEventRegionForLayer = [&](GraphicsLayer& graphicsLayer) {
         GraphicsContext nullContext(nullptr);
         EventRegion eventRegion;
@@ -1753,13 +1775,7 @@
         auto eventRegionContext = eventRegion.makeContext();
         auto layerOffset = graphicsLayer.scrollOffset() - roundedIntSize(graphicsLayer.offsetFromRenderer());
 
-        if (renderer().visibleToHitTesting()) {
-            if (&graphicsLayer == m_scrollContainerLayer) {
-                eventRegionContext.unite(enclosingIntRect(FloatRect({ }, graphicsLayer.size())), renderer().style());
-                graphicsLayer.setEventRegion(WTFMove(eventRegion));
-                return;
-            }
-
+        if (visibleToHitTesting) {
             if (&graphicsLayer == m_scrolledContentsLayer) {
                 // Initialize scrolled contents layer with layer-sized event region as it can all used for scrolling.
                 // This avoids generating unnecessarily complex event regions. We still need to to do the paint to capture touch-action regions.
@@ -1777,8 +1793,10 @@
 
     updateEventRegionForLayer(*m_graphicsLayer);
 
-    if (m_scrollContainerLayer)
-        updateEventRegionForLayer(*m_scrollContainerLayer);
+    setEventRegionToLayerBounds(m_scrollContainerLayer.get());
+    setEventRegionToLayerBounds(m_layerForHorizontalScrollbar.get());
+    setEventRegionToLayerBounds(m_layerForVerticalScrollbar.get());
+    setEventRegionToLayerBounds(m_layerForScrollCorner.get());
 
     if (m_scrolledContentsLayer)
         updateEventRegionForLayer(*m_scrolledContentsLayer);
@@ -2277,6 +2295,12 @@
 #if ENABLE(SCROLLING_THREAD)
         if (m_scrollContainerLayer)
             m_scrollContainerLayer->setScrollingNodeID(0);
+        if (m_layerForHorizontalScrollbar)
+            m_layerForHorizontalScrollbar->setScrollingNodeID(0);
+        if (m_layerForVerticalScrollbar)
+            m_layerForVerticalScrollbar->setScrollingNodeID(0);
+        if (m_layerForScrollCorner)
+            m_layerForScrollCorner->setScrollingNodeID(0);
 #endif
     }
 
@@ -2315,6 +2339,13 @@
 #if ENABLE(SCROLLING_THREAD)
         if (m_scrollContainerLayer)
             m_scrollContainerLayer->setScrollingNodeID(m_scrollingNodeID);
+
+        if (m_layerForHorizontalScrollbar)
+            m_layerForHorizontalScrollbar->setScrollingNodeID(m_scrollingNodeID);
+        if (m_layerForVerticalScrollbar)
+            m_layerForVerticalScrollbar->setScrollingNodeID(m_scrollingNodeID);
+        if (m_layerForScrollCorner)
+            m_layerForScrollCorner->setScrollingNodeID(m_scrollingNodeID);
 #endif
         break;
     case ScrollCoordinationRole::ScrollingProxy:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to