Title: [290545] trunk
Revision
290545
Author
[email protected]
Date
2022-02-25 23:58:41 -0800 (Fri, 25 Feb 2022)

Log Message

Scrollbars disappear when very long or wide
https://bugs.webkit.org/show_bug.cgi?id=237232
Source/WebCore:

<rdar://17540446>

Reviewed by Tim Horton.

Our tiling logic does not play nicely with AppKit's NSScrollerImps, probably because we
inadvertently unparent its layers.

Fix by disallowing GraphicsLayers for scrollbars from going into tiled mode, for
both root and overflow scrollbars.

Test: fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar.html

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::GraphicsLayer):
* platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setAllowsTiling):
(WebCore::GraphicsLayer::allowsTiling const):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::requiresTiledLayer const):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateOverflowControlsLayers):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateOverflowControlsLayers):

LayoutTests:

Reviewed by Tim Horton.

* fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar-expected-mismatch.html: Added.
* fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290544 => 290545)


--- trunk/LayoutTests/ChangeLog	2022-02-26 05:42:38 UTC (rev 290544)
+++ trunk/LayoutTests/ChangeLog	2022-02-26 07:58:41 UTC (rev 290545)
@@ -1,3 +1,13 @@
+2022-02-25  Simon Fraser  <[email protected]>
+
+        Scrollbars disappear when very long or wide
+        https://bugs.webkit.org/show_bug.cgi?id=237232
+
+        Reviewed by Tim Horton.
+
+        * fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar-expected-mismatch.html: Added.
+        * fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar.html: Added.
+
 2022-02-25  Chris Dumez  <[email protected]>
 
         SharedArrayBuffer posted to AudioWorkletProcessor is not actually shared with the main thread

Added: trunk/LayoutTests/fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar-expected-mismatch.html (0 => 290545)


--- trunk/LayoutTests/fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar-expected-mismatch.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar-expected-mismatch.html	2022-02-26 07:58:41 UTC (rev 290545)
@@ -0,0 +1,35 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ MockScrollbarsEnabled=false AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        .scroller {
+            height: 200px;
+            width: 2096px; /* Wider than the 2048 tiling threshold */
+            border: 1px solid black;
+            overflow-x: scroll;
+        }
+
+        .content {
+            width: 200%;
+        }
+    </style>
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        if (window.internals)
+            internals.setUsesOverlayScrollbars(true);
+
+        window.addEventListener('load', () => {
+            setTimeout(() => {
+                testRunner.notifyDone();
+            }, 0);
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="scroller">
+        <div class="content">Scrolled content</div>
+    </div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar.html (0 => 290545)


--- trunk/LayoutTests/fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar.html	                        (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar.html	2022-02-26 07:58:41 UTC (rev 290545)
@@ -0,0 +1,49 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ MockScrollbarsEnabled=false AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+    <style>
+        .scroller {
+            height: 200px;
+            width: 2096px; /* Wider than the 2048 tiling threshold */
+            border: 1px solid black;
+            overflow-x: scroll;
+        }
+
+        .content {
+            width: 200%;
+        }
+    </style>
+    <script src=""
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        if (window.internals)
+            internals.setUsesOverlayScrollbars(true);
+
+        async function runTest()
+        {
+            let scroller = document.querySelector('.scroller');
+            await UIHelper.mouseWheelMayBeginAt(100, 100);
+            await UIHelper.waitForCondition(() => {
+                let state = internals.horizontalScrollbarState(scroller);
+                console.log(state);
+                return state.indexOf('visible_thumb') != -1;
+            });
+            
+            testRunner.notifyDone();
+        }
+        
+        window.addEventListener('load', () => {
+            setTimeout(() => {
+                runTest();
+            }, 20);
+        }, false);
+    </script>
+</head>
+<body>
+    <div class="scroller">
+        <div class="content">Scrolled content</div>
+    </div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (290544 => 290545)


--- trunk/Source/WebCore/ChangeLog	2022-02-26 05:42:38 UTC (rev 290544)
+++ trunk/Source/WebCore/ChangeLog	2022-02-26 07:58:41 UTC (rev 290545)
@@ -1,3 +1,31 @@
+2022-02-25  Simon Fraser  <[email protected]>
+
+        Scrollbars disappear when very long or wide
+        https://bugs.webkit.org/show_bug.cgi?id=237232
+        <rdar://17540446>
+
+        Reviewed by Tim Horton.
+
+        Our tiling logic does not play nicely with AppKit's NSScrollerImps, probably because we
+        inadvertently unparent its layers.
+
+        Fix by disallowing GraphicsLayers for scrollbars from going into tiled mode, for
+        both root and overflow scrollbars.
+
+        Test: fast/scrolling/mac/scrollbars/very-wide-overlay-scrollbar.html
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::GraphicsLayer):
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::GraphicsLayer::setAllowsTiling):
+        (WebCore::GraphicsLayer::allowsTiling const):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::requiresTiledLayer const):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::updateOverflowControlsLayers):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateOverflowControlsLayers):
+
 2022-02-25  Said Abou-Hallawa  <[email protected]>
 
         [GPU Process] Implement RemoteImageBufferProxy::drawConsuming()

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (290544 => 290545)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2022-02-26 05:42:38 UTC (rev 290544)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2022-02-26 07:58:41 UTC (rev 290545)
@@ -143,6 +143,7 @@
     , m_contentsRectClipsDescendants(false)
     , m_acceleratesDrawing(false)
     , m_usesDisplayListDrawing(false)
+    , m_allowsTiling(true)
     , m_appliesPageScale(false)
     , m_showDebugBorder(false)
     , m_showRepaintCounter(false)

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (290544 => 290545)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2022-02-26 05:42:38 UTC (rev 290544)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2022-02-26 07:58:41 UTC (rev 290545)
@@ -589,6 +589,9 @@
     virtual void setAllowsBackingStoreDetaching(bool) { }
     virtual bool allowsBackingStoreDetaching() const { return true; }
 
+    virtual void setAllowsTiling(bool allowsTiling) { m_allowsTiling = allowsTiling; }
+    virtual bool allowsTiling() const { return m_allowsTiling; }
+
     virtual void deviceOrPageScaleFactorChanged() { }
     WEBCORE_EXPORT void noteDeviceOrPageScaleFactorChangedIncludingDescendants();
 
@@ -743,6 +746,7 @@
     bool m_contentsRectClipsDescendants : 1;
     bool m_acceleratesDrawing : 1;
     bool m_usesDisplayListDrawing : 1;
+    bool m_allowsTiling : 1;
     bool m_appliesPageScale : 1; // Set for the layer which has the page scale applied to it.
     bool m_showDebugBorder : 1;
     bool m_showRepaintCounter : 1;

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (290544 => 290545)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2022-02-26 05:42:38 UTC (rev 290544)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2022-02-26 07:58:41 UTC (rev 290545)
@@ -4374,7 +4374,7 @@
 
 bool GraphicsLayerCA::requiresTiledLayer(float pageScaleFactor) const
 {
-    if (!m_drawsContent || isPageTiledBackingLayer())
+    if (!m_drawsContent || isPageTiledBackingLayer() || !allowsTiling())
         return false;
 
     // FIXME: catch zero-size height or width here (or earlier)?

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (290544 => 290545)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2022-02-26 05:42:38 UTC (rev 290544)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2022-02-26 07:58:41 UTC (rev 290545)
@@ -2125,9 +2125,10 @@
 
         if (needLayer) {
             layer = createGraphicsLayer(layerName);
-            if (drawsContent)
+            if (drawsContent) {
                 layer->setAllowsBackingStoreDetaching(false);
-            else {
+                layer->setAllowsTiling(false);
+            } else {
                 layer->setPaintingPhase({ });
                 layer->setDrawsContent(false);
             }

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (290544 => 290545)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2022-02-26 05:42:38 UTC (rev 290544)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2022-02-26 07:58:41 UTC (rev 290545)
@@ -4031,6 +4031,7 @@
         if (!m_layerForHorizontalScrollbar) {
             m_layerForHorizontalScrollbar = GraphicsLayer::create(graphicsLayerFactory(), *this);
             m_layerForHorizontalScrollbar->setAllowsBackingStoreDetaching(false);
+            m_layerForHorizontalScrollbar->setAllowsTiling(false);
             m_layerForHorizontalScrollbar->setShowDebugBorder(m_showDebugBorders);
             m_layerForHorizontalScrollbar->setName(MAKE_STATIC_STRING_IMPL("horizontal scrollbar container"));
 #if PLATFORM(COCOA) && USE(CA)
@@ -4052,6 +4053,7 @@
         if (!m_layerForVerticalScrollbar) {
             m_layerForVerticalScrollbar = GraphicsLayer::create(graphicsLayerFactory(), *this);
             m_layerForVerticalScrollbar->setAllowsBackingStoreDetaching(false);
+            m_layerForVerticalScrollbar->setAllowsTiling(false);
             m_layerForVerticalScrollbar->setShowDebugBorder(m_showDebugBorders);
             m_layerForVerticalScrollbar->setName(MAKE_STATIC_STRING_IMPL("vertical scrollbar container"));
 #if PLATFORM(COCOA) && USE(CA)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to