From 27cbe35110fa404098ef074098fd7bfc1f9d847b Mon Sep 17 00:00:00 2001 From: Alexandru Michis Date: Sun, 22 Aug 2021 03:15:08 +0300 Subject: [PATCH] Backed out changeset 6df43bd2a7bc (bug 1724358) for causing gv-junit failures in testOverscrollBehaviorNoneAuto --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 26 ++-- gfx/layers/apz/src/Axis.h | 2 - .../apz/test/mochitest/helper_empty.html | 4 - ...ents_handoff_on_non_scrollable_iframe.html | 113 ------------------ .../mochitest/test_group_wheelevents.html | 1 - 5 files changed, 10 insertions(+), 136 deletions(-) delete mode 100644 gfx/layers/apz/test/mochitest/helper_empty.html delete mode 100644 gfx/layers/apz/test/mochitest/helper_wheelevents_handoff_on_non_scrollable_iframe.html diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index f02359e87540..5e8b46ac8314 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2181,16 +2181,10 @@ bool AsyncPanZoomController::CanScroll(const InputData& aEvent) const { ScrollDirections AsyncPanZoomController::GetAllowedHandoffDirections() const { ScrollDirections result; RecursiveMutexAutoLock lock(mRecursiveMutex); - - // In Fission there can be non-scrollable APZCs. It's unclear whether - // overscroll-behavior should be respected for these - // (see https://github.com/w3c/csswg-drafts/issues/6523) but - // we currently don't, to match existing practice. - const bool isScrollable = mX.CanScroll() || mY.CanScroll(); - if (!isScrollable || mX.OverscrollBehaviorAllowsHandoff()) { + if (mX.OverscrollBehaviorAllowsHandoff()) { result += ScrollDirection::eHorizontal; } - if (!isScrollable || mY.OverscrollBehaviorAllowsHandoff()) { + if (mY.OverscrollBehaviorAllowsHandoff()) { result += ScrollDirection::eVertical; } return result; @@ -3659,14 +3653,13 @@ Maybe AsyncPanZoomController::GetCurrentAnimationDestination( ParentLayerPoint AsyncPanZoomController::AdjustHandoffVelocityForOverscrollBehavior( ParentLayerPoint& aHandoffVelocity) const { - + RecursiveMutexAutoLock lock(mRecursiveMutex); ParentLayerPoint residualVelocity; - ScrollDirections handoffDirections = GetAllowedHandoffDirections(); - if (!handoffDirections.contains(ScrollDirection::eHorizontal)) { + if (!mX.OverscrollBehaviorAllowsHandoff()) { residualVelocity.x = aHandoffVelocity.x; aHandoffVelocity.x = 0; } - if (!handoffDirections.contains(ScrollDirection::eVertical)) { + if (!mY.OverscrollBehaviorAllowsHandoff()) { residualVelocity.y = aHandoffVelocity.y; aHandoffVelocity.y = 0; } @@ -3674,8 +3667,9 @@ AsyncPanZoomController::AdjustHandoffVelocityForOverscrollBehavior( } bool AsyncPanZoomController::OverscrollBehaviorAllowsSwipe() const { + RecursiveMutexAutoLock lock(mRecursiveMutex); // Swipe navigation is a "non-local" overscroll behavior like handoff. - return GetAllowedHandoffDirections().contains(ScrollDirection::eHorizontal); + return mX.OverscrollBehaviorAllowsHandoff(); } void AsyncPanZoomController::HandleFlingOverscroll( @@ -3799,11 +3793,11 @@ bool AsyncPanZoomController::CallDispatchScroll( // Obey overscroll-behavior. ParentLayerPoint endPoint = aEndPoint; if (aOverscrollHandoffState.mChainIndex > 0) { - ScrollDirections handoffDirections = GetAllowedHandoffDirections(); - if (!handoffDirections.contains(ScrollDirection::eHorizontal)) { + RecursiveMutexAutoLock lock(mRecursiveMutex); + if (!mX.OverscrollBehaviorAllowsHandoff()) { endPoint.x = aStartPoint.x; } - if (!handoffDirections.contains(ScrollDirection::eVertical)) { + if (!mY.OverscrollBehaviorAllowsHandoff()) { endPoint.y = aStartPoint.y; } if (aStartPoint == endPoint) { diff --git a/gfx/layers/apz/src/Axis.h b/gfx/layers/apz/src/Axis.h index 1e313b8929fc..669d7d635dc9 100644 --- a/gfx/layers/apz/src/Axis.h +++ b/gfx/layers/apz/src/Axis.h @@ -368,8 +368,6 @@ class Axis { const FrameMetrics& GetFrameMetrics() const; const ScrollMetadata& GetScrollMetadata() const; - // Do not use this function directly, use - // AsyncPanZoomController::GetAllowedHandoffDirections instead. virtual OverscrollBehavior GetOverscrollBehavior() const = 0; // Adjust a requested overscroll amount for resistance, yielding a smaller diff --git a/gfx/layers/apz/test/mochitest/helper_empty.html b/gfx/layers/apz/test/mochitest/helper_empty.html deleted file mode 100644 index 68cd9179f55d..000000000000 --- a/gfx/layers/apz/test/mochitest/helper_empty.html +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/gfx/layers/apz/test/mochitest/helper_wheelevents_handoff_on_non_scrollable_iframe.html b/gfx/layers/apz/test/mochitest/helper_wheelevents_handoff_on_non_scrollable_iframe.html deleted file mode 100644 index eec230e71dac..000000000000 --- a/gfx/layers/apz/test/mochitest/helper_wheelevents_handoff_on_non_scrollable_iframe.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - scroll handoff on non scrollable iframe document with overscroll-behavior: none - - - - - - - -
- - - diff --git a/gfx/layers/apz/test/mochitest/test_group_wheelevents.html b/gfx/layers/apz/test/mochitest/test_group_wheelevents.html index 3e1c3a2f7fd3..fd1b6e1024fc 100644 --- a/gfx/layers/apz/test/mochitest/test_group_wheelevents.html +++ b/gfx/layers/apz/test/mochitest/test_group_wheelevents.html @@ -43,7 +43,6 @@ var subtests = [ {"file": "helper_scroll_over_scrollbar.html", "prefs": scrollbar_prefs}, {"file": "helper_scroll_tables_perspective.html", "prefs": prefs}, {"file": "helper_wheelevents_handoff_on_iframe.html", "prefs": prefs}, - {"file": "helper_wheelevents_handoff_on_non_scrollable_iframe.html", "prefs": prefs}, ]; // Only Windows has the test api implemented for this test.