Diff
Modified: trunk/LayoutTests/ChangeLog (271089 => 271090)
--- trunk/LayoutTests/ChangeLog 2020-12-26 17:42:33 UTC (rev 271089)
+++ trunk/LayoutTests/ChangeLog 2020-12-26 18:28:39 UTC (rev 271090)
@@ -1,3 +1,15 @@
+2020-12-26 Simon Fraser <[email protected]>
+
+ Fix scrolling issues when scrolling on only one axis is enabled
+ https://bugs.webkit.org/show_bug.cgi?id=220134
+
+ Reviewed by Sam Weinig.
+
+ * fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow-expected.txt: Added.
+ * fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow.html: Added.
+ * fast/scrolling/mac/overflow-hidden-on-one-axis-expected.txt: Added.
+ * fast/scrolling/mac/overflow-hidden-on-one-axis.html: Added.
+
2020-12-23 Ryan Haddad <[email protected]>
REGRESSION: [ Mac ] media/video-buffering-allowed.html is flaky timeout
Added: trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow-expected.txt (0 => 271090)
--- trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow-expected.txt 2020-12-26 18:28:39 UTC (rev 271090)
@@ -0,0 +1,13 @@
+Tests that sieways scrolling in an overflow-x:hidden scroller scrolls the enclosing scroller
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS innerScroller.scrollLeft is 0
+PASS innerScroller.scrollTop is 0
+PASS outerScroller.scrollLeft > 0 is true
+PASS outerScroller.scrollTop is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow.html (0 => 271090)
--- trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow.html 2020-12-26 18:28:39 UTC (rev 271090)
@@ -0,0 +1,104 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+<style>
+ body {
+ height: 2500px;
+ }
+
+ .scroller {
+ border: 1px solid black;
+ }
+
+ .outer.scroller {
+ width: 500px;
+ height: 300px;
+ overflow: auto;
+ }
+
+ .inner.scroller {
+ width: 400px;
+ height: 250px;
+ overflow-x: hidden;
+ overflow-y: auto;
+ margin: 10px;
+ }
+
+ .contents {
+ height: 300%;
+ width: 300%;
+ }
+
+ .wide {
+ width: 300%;
+ height: 10px;
+ background-color: gray;
+ }
+
+ </style>
+<script src=""
+<script src=""
+<script>
+ jsTestIsAsync = true;
+
+ let innerScroller;
+ let outerScroller;
+
+ function checkForScroll()
+ {
+ innerScroller = document.querySelector('.inner.scroller');
+ outerScroller = document.querySelector('.outer.scroller');
+
+ shouldBe('innerScroller.scrollLeft', '0');
+ shouldBe('innerScroller.scrollTop', '0');
+
+ shouldBeTrue('outerScroller.scrollLeft > 0');
+ shouldBe('outerScroller.scrollTop', '0');
+
+ finishJSTest();
+ }
+
+ async function scrollTest()
+ {
+ eventSender.mouseMoveTo(100, 100);
+
+ // Sideways scroll.
+ eventSender.monitorWheelEvents();
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(-1, 0, 'began', 'none');
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'changed', 'none');
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'none', 'begin');
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'none', 'continue');
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end');
+ await UIHelper.waitForScrollCompletion();
+
+ checkForScroll();
+ }
+
+ function setupTopLevel()
+ {
+ description("Tests that sieways scrolling in an overflow-x:hidden scroller scrolls the enclosing scroller");
+ if (window.eventSender) {
+ setTimeout(scrollTest, 0);
+ return;
+ }
+
+ finishJSTest();
+ }
+
+ window.addEventListener('load', () => {
+ setupTopLevel();
+ }, false);
+</script>
+</head>
+<body>
+ <div class="outer scroller">
+ <div class="inner scroller">
+ <div class="contents"></div>
+ </div>
+ <div class="wide"></div>
+ </div>
+<div id="console"></div>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-expected.txt (0 => 271090)
--- trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis-expected.txt 2020-12-26 18:28:39 UTC (rev 271090)
@@ -0,0 +1,13 @@
+Tests that sieways scrolling in an overflow-x:hidden scroller scrolls the enclosing scroller
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS innerScroller.scrollLeft is 0
+PASS innerScroller.scrollTop is 0
+PASS outerScroller.scrollLeft > 0 is true
+PASS outerScroller.scrollTop is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis.html (0 => 271090)
--- trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis.html (rev 0)
+++ trunk/LayoutTests/fast/scrolling/mac/overflow-hidden-on-one-axis.html 2020-12-26 18:28:39 UTC (rev 271090)
@@ -0,0 +1,104 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ body {
+ height: 2500px;
+ }
+
+ .scroller {
+ border: 1px solid black;
+ }
+
+ .outer.scroller {
+ width: 500px;
+ height: 300px;
+ overflow: auto;
+ }
+
+ .inner.scroller {
+ width: 400px;
+ height: 250px;
+ overflow-x: hidden;
+ overflow-y: auto;
+ margin: 10px;
+ }
+
+ .contents {
+ height: 300%;
+ width: 300%;
+ }
+
+ .wide {
+ width: 300%;
+ height: 10px;
+ background-color: gray;
+ }
+
+ </style>
+<script src=""
+<script src=""
+<script>
+ jsTestIsAsync = true;
+
+ let innerScroller;
+ let outerScroller;
+
+ function checkForScroll()
+ {
+ innerScroller = document.querySelector('.inner.scroller');
+ outerScroller = document.querySelector('.outer.scroller');
+
+ shouldBe('innerScroller.scrollLeft', '0');
+ shouldBe('innerScroller.scrollTop', '0');
+
+ shouldBeTrue('outerScroller.scrollLeft > 0');
+ shouldBe('outerScroller.scrollTop', '0');
+
+ finishJSTest();
+ }
+
+ async function scrollTest()
+ {
+ eventSender.mouseMoveTo(100, 100);
+
+ // Sideways scroll.
+ eventSender.monitorWheelEvents();
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(-1, 0, 'began', 'none');
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'changed', 'none');
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'none', 'begin');
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(-10, 0, 'none', 'continue');
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end');
+ await UIHelper.waitForScrollCompletion();
+
+ checkForScroll();
+ }
+
+ function setupTopLevel()
+ {
+ description("Tests that sieways scrolling in an overflow-x:hidden scroller scrolls the enclosing scroller");
+ if (window.eventSender) {
+ setTimeout(scrollTest, 0);
+ return;
+ }
+
+ finishJSTest();
+ }
+
+ window.addEventListener('load', () => {
+ setupTopLevel();
+ }, false);
+</script>
+</head>
+<body>
+ <div class="outer scroller">
+ <div class="inner scroller">
+ <div class="contents"></div>
+ </div>
+ <div class="wide"></div>
+ </div>
+<div id="console"></div>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (271089 => 271090)
--- trunk/Source/WebCore/ChangeLog 2020-12-26 17:42:33 UTC (rev 271089)
+++ trunk/Source/WebCore/ChangeLog 2020-12-26 18:28:39 UTC (rev 271090)
@@ -1,3 +1,37 @@
+2020-12-26 Simon Fraser <[email protected]>
+
+ Fix scrolling issues when scrolling on only one axis is enabled
+ https://bugs.webkit.org/show_bug.cgi?id=220134
+
+ Reviewed by Sam Weinig.
+
+ If an overflow:scroll has overflow on an axis, but overflow:hidden on that
+ axis, then there are various issues with finding the correct scroller and
+ latching.
+
+ This affects nested scrollers where inner and outer and scrollable on different
+ axes, and the inner scroller has overflow, but overflow:hidden on the cross axis.
+
+ The fix involves adding checks for scrolling being allowed in code that fetches
+ pinned state, and code that looks for scrollable areas for a given event delta.
+
+ Tests: fast/scrolling/mac/overflow-hidden-on-one-axis-async-overflow.html
+ fast/scrolling/mac/overflow-hidden-on-one-axis.html
+
+ * page/mac/EventHandlerMac.mm:
+ (WebCore::findEnclosingScrollableContainer):
+ * page/scrolling/ScrollingTreeScrollingNode.cpp:
+ (WebCore::ScrollingTreeScrollingNode::edgePinnedState const):
+ * page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeDelegateMac::isPinnedForScrollDeltaOnAxis const):
+ * platform/ScrollableArea.cpp:
+ (WebCore::ScrollableArea::isPinnedForScrollDeltaOnAxis const):
+ (WebCore::ScrollableArea::isPinnedForScrollDelta const): Check for non-zero deltas.
+ isPinnedForScrollDeltaOnAxis() returns false if a delta is zero, so we don't want to say
+ we're not pinned if a delta is zero. The logic of this code really needs to be inverted
+ to talk about scrollability, not pinning.
+ (WebCore::ScrollableArea::edgePinnedState const):
+
2020-12-26 Sam Weinig <[email protected]>
Simplify adding new color spaces to WebCore
Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (271089 => 271090)
--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2020-12-26 17:42:33 UTC (rev 271089)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm 2020-12-26 18:28:39 UTC (rev 271090)
@@ -819,9 +819,11 @@
if (wheelEvent.phase() == PlatformWheelEventPhase::MayBegin || wheelEvent.phase() == PlatformWheelEventPhase::Cancelled)
return candidate;
- if ((biasedDelta.height() > 0 && !scrollableArea->scrolledToTop()) || (biasedDelta.height() < 0 && !scrollableArea->scrolledToBottom())
- || (biasedDelta.width() > 0 && !scrollableArea->scrolledToLeft()) || (biasedDelta.width() < 0 && !scrollableArea->scrolledToRight()))
+ if (biasedDelta.height() && !scrollableArea->isPinnedForScrollDeltaOnAxis(-biasedDelta.height(), ScrollEventAxis::Vertical))
return candidate;
+
+ if (biasedDelta.width() && !scrollableArea->isPinnedForScrollDeltaOnAxis(-biasedDelta.width(), ScrollEventAxis::Horizontal))
+ return candidate;
}
return nullptr;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (271089 => 271090)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2020-12-26 17:42:33 UTC (rev 271089)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2020-12-26 18:28:39 UTC (rev 271090)
@@ -198,12 +198,15 @@
auto minScrollPosition = minimumScrollPosition();
auto maxScrollPosition = maximumScrollPosition();
+ bool horizontallyUnscrollable = !allowsHorizontalScrolling();
+ bool verticallyUnscrollable = !allowsVerticalScrolling();
+
// Top, right, bottom, left.
return {
- scrollPosition.y() <= minScrollPosition.y(),
- scrollPosition.x() >= maxScrollPosition.x(),
- scrollPosition.y() >= maxScrollPosition.y(),
- scrollPosition.x() <= minScrollPosition.x()
+ verticallyUnscrollable || scrollPosition.y() <= minScrollPosition.y(),
+ horizontallyUnscrollable || scrollPosition.x() >= maxScrollPosition.x(),
+ verticallyUnscrollable || scrollPosition.y() >= maxScrollPosition.y(),
+ horizontallyUnscrollable || scrollPosition.x() <= minScrollPosition.x()
};
}
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm (271089 => 271090)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2020-12-26 17:42:33 UTC (rev 271089)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm 2020-12-26 18:28:39 UTC (rev 271090)
@@ -220,6 +220,9 @@
auto scrollPosition = currentScrollPosition();
switch (axis) {
case ScrollEventAxis::Vertical:
+ if (!allowsVerticalScrolling())
+ return true;
+
if (scrollDelta < 0) {
auto topOffset = scrollPosition.y() - minimumScrollPosition().y();
return topOffset <= scrollLimit;
@@ -231,6 +234,9 @@
}
break;
case ScrollEventAxis::Horizontal:
+ if (!allowsHorizontalScrolling())
+ return true;
+
if (scrollDelta < 0) {
auto leftOffset = scrollPosition.x() - minimumScrollPosition().x();
return leftOffset <= scrollLimit;
Modified: trunk/Source/WebCore/platform/ScrollableArea.cpp (271089 => 271090)
--- trunk/Source/WebCore/platform/ScrollableArea.cpp 2020-12-26 17:42:33 UTC (rev 271089)
+++ trunk/Source/WebCore/platform/ScrollableArea.cpp 2020-12-26 18:28:39 UTC (rev 271090)
@@ -634,6 +634,9 @@
auto scrollPosition = this->scrollPosition();
switch (axis) {
case ScrollEventAxis::Vertical:
+ if (!allowsVerticalScrolling())
+ return true;
+
if (scrollDelta < 0) // top
return scrollPosition.y() <= minimumScrollPosition().y();
@@ -642,6 +645,9 @@
break;
case ScrollEventAxis::Horizontal:
+ if (!allowsHorizontalScrolling())
+ return true;
+
if (scrollDelta < 0) // left
return scrollPosition.x() <= minimumScrollPosition().x();
@@ -656,7 +662,8 @@
bool ScrollableArea::isPinnedForScrollDelta(const FloatSize& scrollDelta) const
{
- return isPinnedForScrollDeltaOnAxis(scrollDelta.width(), ScrollEventAxis::Horizontal) && isPinnedForScrollDeltaOnAxis(scrollDelta.height(), ScrollEventAxis::Vertical);
+ return (!scrollDelta.width() || isPinnedForScrollDeltaOnAxis(scrollDelta.width(), ScrollEventAxis::Horizontal))
+ && (!scrollDelta.height() || isPinnedForScrollDeltaOnAxis(scrollDelta.height(), ScrollEventAxis::Vertical));
}
RectEdges<bool> ScrollableArea::edgePinnedState() const
@@ -665,12 +672,15 @@
auto minScrollPosition = minimumScrollPosition();
auto maxScrollPosition = maximumScrollPosition();
+ bool horizontallyUnscrollable = !allowsHorizontalScrolling();
+ bool verticallyUnscrollable = !allowsVerticalScrolling();
+
// Top, right, bottom, left.
return {
- scrollPosition.y() <= minScrollPosition.y(),
- scrollPosition.x() >= maxScrollPosition.x(),
- scrollPosition.y() >= maxScrollPosition.y(),
- scrollPosition.x() <= minScrollPosition.x()
+ verticallyUnscrollable || scrollPosition.y() <= minScrollPosition.y(),
+ horizontallyUnscrollable || scrollPosition.x() >= maxScrollPosition.x(),
+ verticallyUnscrollable || scrollPosition.y() >= maxScrollPosition.y(),
+ horizontallyUnscrollable || scrollPosition.x() <= minScrollPosition.x()
};
}