Don't do async overflow scrolling for visibility:hidden scrollers
https://bugs.webkit.org/show_bug.cgi?id=199779
Reviewed by Dean Jackson.
Source/WebCore:
An overflow:scroll with visibility:hidden is not scrollable on macOS, even if it has visible
content. So disable async overflow:scroll when the scroller has non-visible visibility (this also
takes visibility on ancestors into account).
visibility:hidden overflow:scroll can be common because some JS libraries use it
(https://github.com/wnr/element-resize-detector).
Test: compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers.html
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::canUseCompositedScrolling const): Don't use hasVisibleContent() because
that's affected by visible children.
LayoutTests:
* compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers-expected.txt: Added.
* compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers.html: Added.
* platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers-expected.txt: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@247420 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 82127c3..ba636e0f 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,14 @@
+2019-07-13 Simon Fraser <simon.fraser@apple.com>
+
+ Don't do async overflow scrolling for visibility:hidden scrollers
+ https://bugs.webkit.org/show_bug.cgi?id=199779
+
+ Reviewed by Dean Jackson.
+
+ * compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers-expected.txt: Added.
+ * compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers.html: Added.
+ * platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers-expected.txt: Added.
+
2019-07-13 Zalan Bujtas <zalan@apple.com>
Cannot bring up custom media controls at all on v.youku.com
diff --git a/LayoutTests/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers-expected.txt b/LayoutTests/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers-expected.txt
new file mode 100644
index 0000000..30d4553
--- /dev/null
+++ b/LayoutTests/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers-expected.txt
@@ -0,0 +1,36 @@
+s
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 785.00 742.00)
+ (clips 1)
+ (children 1
+ (GraphicsLayer
+ (bounds 785.00 742.00)
+ (contentsOpaque 1)
+ (children 1
+ (GraphicsLayer
+ (position 28.00 46.00)
+ (bounds 304.00 154.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=2 height=2)
+ (position 2.00 2.00)
+ (bounds 285.00 135.00)
+ (clips 1)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=2 height=2)
+ (anchor 0.00 0.00)
+ (bounds 285.00 405.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
diff --git a/LayoutTests/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers.html b/LayoutTests/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers.html
new file mode 100644
index 0000000..0933902
--- /dev/null
+++ b/LayoutTests/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers.html
@@ -0,0 +1,68 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ internal:AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+ <title>visibility:hidden scrollers should not be composited for async scrolling</title>
+ <style>
+ .scroller {
+ margin: 20px;
+ width: 300px;
+ height: 150px;
+ border: 2px solid black;
+ overflow: scroll;
+ }
+
+ .contents {
+ height: 300%;
+ background-image: repeating-linear-gradient(white, silver 100px);
+ }
+
+ .hidden {
+ visibility: hidden;
+ }
+
+ .box {
+ margin: 40px;
+ width: 100px;
+ height: 100px;
+ background-color: blue;
+ }
+
+ .visible {
+ visibility: visible;
+ }
+ </style>
+ <script>
+ if (window.testRunner)
+ testRunner.dumpAsText();
+
+ window.addEventListener('load', () => {
+ if (window.internals)
+ document.getElementById('layers').innerText = window.internals.layerTreeAsText(document, internals.LAYER_TREE_INCLUDES_CLIPPING);
+ }, false);
+ </script>
+s</head>
+<body>
+ <div class="scroller">
+ <div class="contents"></div>
+ </div>
+
+ <div class="hidden scroller">
+ <div class="contents"></div>
+ </div>
+
+ <div class="hidden scroller">
+ <div class="contents">
+ <div class="visible box"></div>
+ </div>
+ </div>
+
+ <div class="hidden">
+ <div class="scroller">
+ <div class="contents">
+ <div class="visible box"></div>
+ </div>
+ </div>
+ </div>
+<pre id="layers"></pre>
+</body>
+</html>
diff --git a/LayoutTests/platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers-expected.txt b/LayoutTests/platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers-expected.txt
new file mode 100644
index 0000000..931fe6e
--- /dev/null
+++ b/LayoutTests/platform/ios-wk2/compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers-expected.txt
@@ -0,0 +1,36 @@
+s
+(GraphicsLayer
+ (anchor 0.00 0.00)
+ (bounds 800.00 744.00)
+ (clips 1)
+ (children 1
+ (GraphicsLayer
+ (bounds 800.00 744.00)
+ (contentsOpaque 1)
+ (children 1
+ (GraphicsLayer
+ (position 28.00 48.00)
+ (bounds 304.00 154.00)
+ (drawsContent 1)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=2 height=2)
+ (position 2.00 2.00)
+ (bounds 300.00 150.00)
+ (clips 1)
+ (children 1
+ (GraphicsLayer
+ (offsetFromRenderer width=2 height=2)
+ (anchor 0.00 0.00)
+ (bounds 300.00 450.00)
+ (drawsContent 1)
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+ )
+)
+
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 09e22ce..f276240 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2019-07-13 Simon Fraser <simon.fraser@apple.com>
+
+ Don't do async overflow scrolling for visibility:hidden scrollers
+ https://bugs.webkit.org/show_bug.cgi?id=199779
+
+ Reviewed by Dean Jackson.
+
+ An overflow:scroll with visibility:hidden is not scrollable on macOS, even if it has visible
+ content. So disable async overflow:scroll when the scroller has non-visible visibility (this also
+ takes visibility on ancestors into account).
+
+ visibility:hidden overflow:scroll can be common because some JS libraries use it
+ (https://github.com/wnr/element-resize-detector).
+
+ Test: compositing/scrolling/async-overflow-scrolling/visibility-hidden-scrollers.html
+
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::canUseCompositedScrolling const): Don't use hasVisibleContent() because
+ that's affected by visible children.
+
2019-07-13 Robin Morisset <rmorisset@apple.com>
[WHLSL] Return statements don't need to keep track of the function they're in
diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp
index 8f11f46..6b6b2ee 100644
--- a/Source/WebCore/rendering/RenderLayer.cpp
+++ b/Source/WebCore/rendering/RenderLayer.cpp
@@ -2271,11 +2271,12 @@
bool RenderLayer::canUseCompositedScrolling() const
{
+ bool isVisible = renderer().style().visibility() == Visibility::Visible;
if (renderer().settings().asyncOverflowScrollingEnabled())
- return scrollsOverflow();
+ return isVisible && scrollsOverflow();
#if PLATFORM(IOS_FAMILY) && ENABLE(OVERFLOW_SCROLLING_TOUCH)
- return scrollsOverflow() && (renderer().style().useTouchOverflowScrolling() || renderer().settings().alwaysUseAcceleratedOverflowScroll());
+ return isVisible && scrollsOverflow() && (renderer().style().useTouchOverflowScrolling() || renderer().settings().alwaysUseAcceleratedOverflowScroll());
#else
return false;
#endif