Diff
Modified: trunk/LayoutTests/ChangeLog (291496 => 291497)
--- trunk/LayoutTests/ChangeLog 2022-03-18 21:53:45 UTC (rev 291496)
+++ trunk/LayoutTests/ChangeLog 2022-03-18 21:59:15 UTC (rev 291497)
@@ -1,3 +1,13 @@
+2022-03-18 Nikolaos Mouchtaris <nmouchta...@apple.com>
+
+ Allow history swipe in scroller with overscroll-behavior
+ https://bugs.webkit.org/show_bug.cgi?id=235851
+
+ Reviewed by Simon Fraser.
+
+ * scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior-expected.txt: Added.
+ * scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior.html: Added.
+
2022-03-18 Simon Fraser <simon.fra...@apple.com>
REGRESSION (r290628): Scrubber makes a visual trail when scrubbing on tv.youtube.com
Added: trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior-expected.txt (0 => 291497)
--- trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior-expected.txt (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior-expected.txt 2022-03-18 21:59:15 UTC (rev 291497)
@@ -0,0 +1,14 @@
+Scrolls vertically
+Scrolls horizontally
+A back swipe, over a scrolled-to-left overflow, should start a navigation gesture.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Swipe to the left
+PASS minXOffset is 0
+PASS maxXOffset is -1000
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior.html (0 => 291497)
--- trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior.html (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior.html 2022-03-18 21:59:15 UTC (rev 291497)
@@ -0,0 +1,116 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+ <style>
+ body {
+ height: 2000px;
+ }
+
+ .scroller {
+ margin: 10px;
+ width: 500px;
+ height: 400px;
+ overflow: auto;
+ border: 2px solid black;
+ }
+
+ .horizontal .scroller {
+ width: 400px;
+ height: 400px;
+ margin: 10px;
+ overscroll-behavior: contain;
+ }
+
+ .filler {
+ height: 200px;
+ width: 100%;
+ margin: 10px;
+ background-color: silver;
+ }
+
+ .horizontal .filler {
+ height: 80%;
+ width: 200%;
+ background-color: silver;
+ }
+ </style>
+ <script src=""
+ <script src=""
+
+ <script>
+ jsTestIsAsync = true;
+
+ var minXOffset = 0;
+ var maxXOffset = -1000;
+
+ async function onScrollCompletion(x, y)
+ {
+ eventSender.monitorWheelEvents();
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(1, 0, "began", "none");
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(10, 0, "changed", "none");
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(10, 0, "changed", "none");
+ await UIHelper.animationFrame();
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(10, 0, "changed", "none");
+ eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
+ return UIHelper.waitForScrollCompletion();
+ }
+
+ async function onSwipeCallback()
+ {
+ return new Promise(resolve => {
+ testRunner.installDidBeginSwipeCallback(resolve);
+ });
+ }
+
+ async function scrollTest()
+ {
+ description('A back swipe, over a scrolled-to-left overflow, should start a navigation gesture.');
+
+ if (window.testRunner) {
+ testRunner.setNavigationGesturesEnabled(true);
+ }
+
+ history.pushState({ name: 'backstate' }, 'back');
+
+ window.addEventListener('scroll', () => {
+ minXOffset = Math.min(minXOffset, window.pageXOffset);
+ maxXOffset = Math.max(maxXOffset, window.pageXOffset);
+ }, false);
+
+ if (!window.eventSender) {
+ finishJSTest();
+ return;
+ }
+
+ const mouseLocationX = 150; // Over the horizontally scrollable overflow.
+ const mouseLocationY = 300;
+
+ debug('Swipe to the left');
+
+ await Promise.all([onSwipeCallback(), onScrollCompletion(mouseLocationX, mouseLocationY)]);
+
+ // Should not have received any scroll events.
+ shouldBe('minXOffset', '0');
+ shouldBe('maxXOffset', '-1000');
+
+ finishJSTest();
+ }
+
+ window.addEventListener('load', () => {
+ scrollTest();
+ }, false);
+ </script>
+</head>
+<body>
+ <div id="outer" class="scroller">
+ <div class="filler">Scrolls vertically</div>
+ <div id="inner" class="horizontal scroller">
+ <div class="filler">Scrolls horizontally</div>
+ </div>
+ <div class="filler"></div>
+ </div>
+ <div id="console"></div>
+ <script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (291496 => 291497)
--- trunk/Source/WebCore/ChangeLog 2022-03-18 21:53:45 UTC (rev 291496)
+++ trunk/Source/WebCore/ChangeLog 2022-03-18 21:59:15 UTC (rev 291497)
@@ -1,3 +1,24 @@
+2022-03-18 Nikolaos Mouchtaris <nmouchta...@apple.com>
+
+ Allow history swipe in scroller with overscroll-behavior
+ https://bugs.webkit.org/show_bug.cgi?id=235851
+
+ Reviewed by Simon Fraser.
+
+ Re-add code to allow history swipe. Does so by returning unhandled if a horizontal
+ swipe is used. Also add test to make sure history swipes are allowed in scrolling nodes
+ with overscroll-behavior.
+
+ Test: scrollingcoordinator/mac/latching/horizontal-overflow-back-swipe-overscroll-behavior.html
+
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::handleWheelEventWithNode):
+ * page/scrolling/ScrollingTreeScrollingNode.cpp:
+ (WebCore::ScrollingTreeScrollingNode::shouldRubberBand const):
+ (WebCore::ScrollingTreeScrollingNode::computeScrollPropagation const):
+ (WebCore::ScrollingTreeScrollingNode::shouldBlockScrollPropagation const): Deleted.
+ * page/scrolling/ScrollingTreeScrollingNode.h:
+
2022-03-18 Chris Dumez <cdu...@apple.com>
Avoid calls to [CLLocationManager authorizationStatus] & [CLLocationManager locationServicesEnabled]
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (291496 => 291497)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2022-03-18 21:53:45 UTC (rev 291496)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2022-03-18 21:59:15 UTC (rev 291497)
@@ -217,7 +217,10 @@
if (result.needsMainThreadProcessing() || eventTargeting != EventTargeting::Propagate)
return result;
- if (scrollingNode.shouldBlockScrollPropagation(adjustedWheelEvent.delta())) {
+ auto scrollPropagationInfo = scrollingNode.computeScrollPropagation(adjustedWheelEvent.delta());
+ if (scrollPropagationInfo.shouldBlockScrollPropagation) {
+ if (!scrollPropagationInfo.isHandled)
+ return WheelEventHandlingResult::unhandled();
m_latchingController.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), processingSteps, adjustedWheelEvent, m_allowLatching);
m_gestureState.nodeDidHandleEvent(scrollingNode.scrollingNodeID(), adjustedWheelEvent);
return WheelEventHandlingResult::handled();
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (291496 => 291497)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2022-03-18 21:53:45 UTC (rev 291496)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp 2022-03-18 21:59:15 UTC (rev 291497)
@@ -128,7 +128,8 @@
// The stateless wheel event doesn't trigger rubber-band.
// Also rubberband when we should block scroll propagation
// at this node, which has overscroll behavior that is not none.
- return (isLatchedNode() || eventTargeting == EventTargeting::NodeOnly || (isRootNode() && !wheelEvent.isNonGestureEvent()) || (shouldBlockScrollPropagation(wheelEvent.delta()) && overscrollBehaviorAllowsRubberBand()));
+ auto scrollPropagationInfo = computeScrollPropagation(wheelEvent.delta());
+ return (isLatchedNode() || eventTargeting == EventTargeting::NodeOnly || (isRootNode() && !wheelEvent.isNonGestureEvent()) || ( scrollPropagationInfo.shouldBlockScrollPropagation && scrollPropagationInfo.isHandled && overscrollBehaviorAllowsRubberBand()));
}
bool ScrollingTreeScrollingNode::canHandleWheelEvent(const PlatformWheelEvent& wheelEvent, EventTargeting eventTargeting) const
@@ -418,9 +419,26 @@
return wheelEvent;
}
-bool ScrollingTreeScrollingNode::shouldBlockScrollPropagation(const FloatSize& delta) const
+ScrollPropagationInfo ScrollingTreeScrollingNode::computeScrollPropagation(const FloatSize& delta) const
{
- return ((horizontalOverscrollBehaviorPreventsPropagation() || verticalOverscrollBehaviorPreventsPropagation()) && ((horizontalOverscrollBehaviorPreventsPropagation() && verticalOverscrollBehaviorPreventsPropagation()) || (horizontalOverscrollBehaviorPreventsPropagation() && !delta.height()) || (verticalOverscrollBehaviorPreventsPropagation() && !delta.width())));
+ ScrollPropagationInfo propagation;
+ if (!horizontalOverscrollBehaviorPreventsPropagation() && !verticalOverscrollBehaviorPreventsPropagation())
+ return propagation;
+
+ // History swipe case
+ if (horizontalOverscrollBehaviorPreventsPropagation() && !delta.height() && delta.width()) {
+ propagation.shouldBlockScrollPropagation = true;
+ propagation.isHandled = false;
+ return propagation;
+ }
+
+ if ((horizontalOverscrollBehaviorPreventsPropagation() && verticalOverscrollBehaviorPreventsPropagation())
+ || (horizontalOverscrollBehaviorPreventsPropagation() && !delta.height())
+ || (verticalOverscrollBehaviorPreventsPropagation() && !delta.width())) {
+ propagation.shouldBlockScrollPropagation = true;
+ propagation.isHandled = true;
+ }
+ return propagation;
}
} // namespace WebCore
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (291496 => 291497)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2022-03-18 21:53:45 UTC (rev 291496)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2022-03-18 21:59:15 UTC (rev 291497)
@@ -39,6 +39,11 @@
class ScrollingStateScrollingNode;
struct WheelEventHandlingResult;
+struct ScrollPropagationInfo {
+ bool shouldBlockScrollPropagation { false };
+ bool isHandled { false };
+};
+
class WEBCORE_EXPORT ScrollingTreeScrollingNode : public ScrollingTreeNode {
friend class ScrollingTreeScrollingNodeDelegate;
#if PLATFORM(MAC)
@@ -165,7 +170,7 @@
bool horizontalOverscrollBehaviorPreventsPropagation() const { return m_scrollableAreaParameters.horizontalOverscrollBehavior != OverscrollBehavior::Auto; }
bool verticalOverscrollBehaviorPreventsPropagation() const { return m_scrollableAreaParameters.verticalOverscrollBehavior != OverscrollBehavior::Auto; }
PlatformWheelEvent eventForPropagation(const PlatformWheelEvent&) const;
- bool shouldBlockScrollPropagation(const FloatSize&) const;
+ ScrollPropagationInfo computeScrollPropagation(const FloatSize&) const;
bool overscrollBehaviorAllowsRubberBand() const { return m_scrollableAreaParameters.horizontalOverscrollBehavior != OverscrollBehavior::None || m_scrollableAreaParameters.verticalOverscrollBehavior != OverscrollBehavior::None; }
bool shouldRubberBand(const PlatformWheelEvent&, EventTargeting) const;
void dumpProperties(WTF::TextStream&, OptionSet<ScrollingStateTreeAsTextBehavior>) const override;