From b824530498e73508c3645aaf7d9894b3eebbaab6 Mon Sep 17 00:00:00 2001 From: Cristian Tuns Date: Sat, 19 Mar 2022 08:40:08 -0400 Subject: [PATCH] Backed out changeset 4be195c46471 (bug 1756529) for causing mochitest failures in test_group_keyboard.html CLOSED TREE --- gfx/layers/apz/public/APZPublicUtils.h | 7 - gfx/layers/apz/src/APZPublicUtils.cpp | 19 -- gfx/layers/apz/src/AsyncPanZoomController.cpp | 13 +- .../apz/test/mochitest/helper_bug1756529.html | 214 ------------------ .../test/mochitest/test_group_keyboard.html | 19 +- layout/base/PresShell.cpp | 17 +- 6 files changed, 12 insertions(+), 277 deletions(-) delete mode 100644 gfx/layers/apz/test/mochitest/helper_bug1756529.html diff --git a/gfx/layers/apz/public/APZPublicUtils.h b/gfx/layers/apz/public/APZPublicUtils.h index 6433008b4c55..31225e398ec0 100644 --- a/gfx/layers/apz/public/APZPublicUtils.h +++ b/gfx/layers/apz/public/APZPublicUtils.h @@ -17,7 +17,6 @@ #include "mozilla/DefineEnum.h" #include "mozilla/ScrollOrigin.h" #include "mozilla/gfx/Point.h" -#include "mozilla/ScrollTypes.h" namespace mozilla { @@ -68,12 +67,6 @@ gfx::IntSize GetDisplayportAlignmentMultiplier(const ScreenSize& aBaseSize); ScrollAnimationBezierPhysicsSettings ComputeBezierAnimationSettingsForOrigin( ScrollOrigin aOrigin); -/** - * Calculate if the scrolling should be instant or smooth based based on - * preferences and the origin - */ -ScrollMode GetScrollModeForOrigin(ScrollOrigin origin); - } // namespace apz } // namespace layers diff --git a/gfx/layers/apz/src/APZPublicUtils.cpp b/gfx/layers/apz/src/APZPublicUtils.cpp index 6902e0738ce3..49489312704c 100644 --- a/gfx/layers/apz/src/APZPublicUtils.cpp +++ b/gfx/layers/apz/src/APZPublicUtils.cpp @@ -87,25 +87,6 @@ ScrollAnimationBezierPhysicsSettings ComputeBezierAnimationSettingsForOrigin( return ScrollAnimationBezierPhysicsSettings{minMS, maxMS, intervalRatio}; } -ScrollMode GetScrollModeForOrigin(ScrollOrigin origin) { - if (!StaticPrefs::general_smoothScroll()) return ScrollMode::Instant; - switch (origin) { - case ScrollOrigin::Lines: - return StaticPrefs::general_smoothScroll_lines() ? ScrollMode::Smooth - : ScrollMode::Instant; - case ScrollOrigin::Pages: - return StaticPrefs::general_smoothScroll_pages() ? ScrollMode::Smooth - : ScrollMode::Instant; - case ScrollOrigin::Other: - return StaticPrefs::general_smoothScroll_other() ? ScrollMode::Smooth - : ScrollMode::Instant; - default: - MOZ_ASSERT(false, "Unknown keyboard scroll origin"); - return StaticPrefs::general_smoothScroll() ? ScrollMode::Smooth - : ScrollMode::Instant; - } -} - } // namespace apz } // namespace layers } // namespace mozilla diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index e1a699373609..ac828dbdc0a0 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -69,7 +69,6 @@ #include "mozilla/layers/APZUtils.h" // for AsyncTransform #include "mozilla/layers/CompositorController.h" // for CompositorController #include "mozilla/layers/DirectionUtils.h" // for GetAxis{Start,End,Length,Scale} -#include "mozilla/layers/APZPublicUtils.h" // for GetScrollMode #include "mozilla/mozalloc.h" // for operator new, etc #include "mozilla/Unused.h" // for unused #include "mozilla/FloatingPoint.h" // for FuzzyEquals* @@ -1949,15 +1948,12 @@ nsEventStatus AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent) { // Calculate the destination for this keyboard scroll action CSSPoint destination = GetKeyboardDestination(aEvent.mAction); - ScrollOrigin scrollOrigin = - SmoothScrollAnimation::GetScrollOriginForAction(aEvent.mAction.mType); bool scrollSnapped = MaybeAdjustDestinationForScrollSnapping(aEvent, destination); - ScrollMode scrollMode = apz::GetScrollModeForOrigin(scrollOrigin); RecordScrollPayload(aEvent.mTimeStamp); - // If the scrolling is instant, then scroll immediately to the destination - if (scrollMode == ScrollMode::Instant) { + // If smooth scrolling is disabled, then scroll immediately to the destination + if (!StaticPrefs::general_smoothScroll()) { CancelAnimation(); ParentLayerPoint startPoint, endPoint; @@ -2010,8 +2006,9 @@ nsEventStatus AsyncPanZoomController::OnKeyboard(const KeyboardInput& aEvent) { nsPoint initialPosition = CSSPoint::ToAppUnits(Metrics().GetVisualScrollOffset()); - StartAnimation( - new SmoothScrollAnimation(*this, initialPosition, scrollOrigin)); + StartAnimation(new SmoothScrollAnimation( + *this, initialPosition, + SmoothScrollAnimation::GetScrollOriginForAction(aEvent.mAction.mType))); } // Convert velocity from ParentLayerPoints/ms to ParentLayerPoints/s and then diff --git a/gfx/layers/apz/test/mochitest/helper_bug1756529.html b/gfx/layers/apz/test/mochitest/helper_bug1756529.html deleted file mode 100644 index 757bb2712b5c..000000000000 --- a/gfx/layers/apz/test/mochitest/helper_bug1756529.html +++ /dev/null @@ -1,214 +0,0 @@ - - - - - - Page scrolling bug test, helper page - - - - - - - - SmoothScrollPage not honored with MSD physics bug. - -
-

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Tellus in metus vulputate eu. Vestibulum morbi blandit cursus risus at ultrices mi tempus imperdiet. Congue quisque egestas diam in. Pretium vulputate sapien nec sagittis aliquam malesuada bibendum arcu. Eleifend mi in nulla posuere. Proin libero nunc consequat interdum varius. Risus pretium quam vulputate dignissim suspendisse in est. Lacus vel facilisis volutpat est. Donec pretium vulputate sapien nec. Feugiat sed lectus vestibulum mattis. Platea dictumst quisque sagittis purus. Vulputate eu scelerisque felis imperdiet proin fermentum leo vel. Enim facilisis gravida neque convallis a cras semper auctor. Placerat orci nulla pellentesque dignissim enim sit.

-

Augue neque gravida in fermentum et sollicitudin ac. Mattis enim ut tellus elementum sagittis vitae et. Malesuada nunc vel risus commodo viverra maecenas accumsan. Viverra nibh cras pulvinar mattis nunc sed. Lectus nulla at volutpat diam ut venenatis tellus in. Non tellus orci ac auctor. Magna etiam tempor orci eu lobortis. Malesuada nunc vel risus commodo viverra maecenas accumsan lacus vel. Sagittis orci a scelerisque purus. Tellus pellentesque eu tincidunt tortor. Vulputate dignissim suspendisse in est ante in. Tristique et egestas quis ipsum suspendisse. Quisque egestas diam in arcu cursus. Massa massa ultricies mi quis hendrerit dolor magna eget. Mattis nunc sed blandit libero volutpat sed. Consectetur purus ut faucibus pulvinar elementum integer enim.

-

Vestibulum lorem sed risus ultricies tristique nulla. Imperdiet nulla malesuada pellentesque elit eget gravida. Feugiat nisl pretium fusce id velit ut tortor pretium. Commodo ullamcorper a lacus vestibulum sed arcu non odio. Id nibh tortor id aliquet lectus proin nibh nisl condimentum. Amet volutpat consequat mauris nunc congue nisi vitae suscipit tellus. Neque ornare aenean euismod elementum. Semper quis lectus nulla at. Massa sed elementum tempus egestas. Praesent elementum facilisis leo vel fringilla est ullamcorper eget nulla. Pellentesque elit eget gravida cum sociis natoque penatibus et. Massa enim nec dui nunc mattis enim. Laoreet suspendisse interdum consectetur libero id faucibus nisl. Fusce ut placerat orci nulla.

-

Vitae tempus quam pellentesque nec nam aliquam. Vestibulum mattis ullamcorper velit sed ullamcorper morbi tincidunt ornare. Nam libero justo laoreet sit amet. Arcu non sodales neque sodales. Nec ultrices dui sapien eget mi proin sed. Parturient montes nascetur ridiculus mus mauris vitae ultricies. Lacus sed viverra tellus in hac habitasse. Orci phasellus egestas tellus rutrum. Leo a diam sollicitudin tempor id eu nisl. Diam phasellus vestibulum lorem sed risus ultricies tristique nulla. Lectus nulla at volutpat diam ut venenatis tellus in. Cursus metus aliquam eleifend mi in nulla. Et ultrices neque ornare aenean euismod. Sit amet aliquam id diam maecenas ultricies mi. Volutpat diam ut venenatis tellus in metus vulputate eu.

-

Pellentesque elit ullamcorper dignissim cras tincidunt. Morbi tincidunt augue interdum velit euismod. Diam vel quam elementum pulvinar etiam non quam. Eget duis at tellus at urna. Posuere ac ut consequat semper viverra nam libero justo laoreet. Ac turpis egestas maecenas pharetra convallis posuere. Ultrices tincidunt arcu non sodales neque sodales ut etiam sit. In eu mi bibendum neque egestas. Pellentesque sit amet porttitor eget dolor morbi. Ac tortor dignissim convallis aenean et tortor at. Elementum tempus egestas sed sed risus pretium quam. Nisi scelerisque eu ultrices vitae auctor eu augue. Urna duis convallis convallis tellus id interdum velit laoreet id. Auctor eu augue ut lectus arcu bibendum at varius vel.

-
- - diff --git a/gfx/layers/apz/test/mochitest/test_group_keyboard.html b/gfx/layers/apz/test/mochitest/test_group_keyboard.html index 9469be8cf9bf..df9be8a49887 100644 --- a/gfx/layers/apz/test/mochitest/test_group_keyboard.html +++ b/gfx/layers/apz/test/mochitest/test_group_keyboard.html @@ -22,17 +22,6 @@ var smoothness_prefs = [ ["general.smoothScroll.lines.durationMinMS", 1500] ]; -var bug1756529_prefs= [ - // Increase distance of line scroll (units here are "number of lines") so - // that a smooth scroll animation reliably takes multiple frames. - ["toolkit.scrollbox.verticalScrollDistance", 5], - // The test performs a single-tap gesture between test cases to cancel the - // animation from the previous test case. For test cases that run fast (e.g. - // instant scrolling), two single-taps could occur close enough in succession - // that they get interpreted as a double-tap. - ["apz.allow_double_tap_zooming", false] -]; - var subtests = [ {"file": "helper_key_scroll.html", prefs: [["apz.test.logging_enabled", true], ["test.events.async.enabled", true]]}, @@ -44,13 +33,7 @@ var subtests = [ {"file": "helper_relative_scroll_smoothness.html?input-type=native-key&scroll-method=scrollTo", prefs: smoothness_prefs }, {"file": "helper_relative_scroll_smoothness.html?input-type=native-key&scroll-method=scrollTop", - prefs: smoothness_prefs }, - // Run helper_bug1756529.html twice, first exercising the main-thread keyboard - // scrolling codepaths (e.g. PresShell::ScrollPage()), and once exercising the - // APZ keyboard scrolling codepaths. - {"file": "helper_bug1756529.html", prefs: bug1756529_prefs}, - {"file": "helper_bug1756529.html", prefs: [...bug1756529_prefs, - ["test.events.async.enabled", true]]}, + prefs: smoothness_prefs } ]; if (isKeyApzEnabled()) { diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp index 616046a48cae..22fe67b70424 100644 --- a/layout/base/PresShell.cpp +++ b/layout/base/PresShell.cpp @@ -187,7 +187,6 @@ #include "mozilla/layers/WebRenderLayerManager.h" #include "mozilla/layers/WebRenderUserData.h" #include "mozilla/layout/ScrollAnchorContainer.h" -#include "mozilla/layers/APZPublicUtils.h" #include "mozilla/ProfilerLabels.h" #include "mozilla/ProfilerMarkers.h" #include "mozilla/ScrollTypes.h" @@ -2381,10 +2380,9 @@ NS_IMETHODIMP PresShell::ScrollPage(bool aForward) { nsIScrollableFrame* scrollFrame = GetScrollableFrameToScroll(VerticalScrollDirection); - ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Pages); if (scrollFrame) { scrollFrame->ScrollBy( - nsIntPoint(0, aForward ? 1 : -1), ScrollUnit::PAGES, scrollMode, + nsIntPoint(0, aForward ? 1 : -1), ScrollUnit::PAGES, ScrollMode::Smooth, nullptr, mozilla::ScrollOrigin::NotSpecified, nsIScrollableFrame::NOT_MOMENTUM, nsIScrollableFrame::ENABLE_SNAP); } @@ -2395,14 +2393,13 @@ NS_IMETHODIMP PresShell::ScrollLine(bool aForward) { nsIScrollableFrame* scrollFrame = GetScrollableFrameToScroll(VerticalScrollDirection); - ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Lines); if (scrollFrame) { int32_t lineCount = Preferences::GetInt("toolkit.scrollbox.verticalScrollDistance", NS_DEFAULT_VERTICAL_SCROLL_DISTANCE); scrollFrame->ScrollBy( nsIntPoint(0, aForward ? lineCount : -lineCount), ScrollUnit::LINES, - scrollMode, nullptr, mozilla::ScrollOrigin::NotSpecified, + ScrollMode::Smooth, nullptr, mozilla::ScrollOrigin::NotSpecified, nsIScrollableFrame::NOT_MOMENTUM, nsIScrollableFrame::ENABLE_SNAP); } return NS_OK; @@ -2412,15 +2409,14 @@ NS_IMETHODIMP PresShell::ScrollCharacter(bool aRight) { nsIScrollableFrame* scrollFrame = GetScrollableFrameToScroll(HorizontalScrollDirection); - ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Lines); if (scrollFrame) { int32_t h = Preferences::GetInt("toolkit.scrollbox.horizontalScrollDistance", NS_DEFAULT_HORIZONTAL_SCROLL_DISTANCE); scrollFrame->ScrollBy( - nsIntPoint(aRight ? h : -h, 0), ScrollUnit::LINES, scrollMode, nullptr, - mozilla::ScrollOrigin::NotSpecified, nsIScrollableFrame::NOT_MOMENTUM, - nsIScrollableFrame::ENABLE_SNAP); + nsIntPoint(aRight ? h : -h, 0), ScrollUnit::LINES, ScrollMode::Smooth, + nullptr, mozilla::ScrollOrigin::NotSpecified, + nsIScrollableFrame::NOT_MOMENTUM, nsIScrollableFrame::ENABLE_SNAP); } return NS_OK; } @@ -2429,10 +2425,9 @@ NS_IMETHODIMP PresShell::CompleteScroll(bool aForward) { nsIScrollableFrame* scrollFrame = GetScrollableFrameToScroll(VerticalScrollDirection); - ScrollMode scrollMode = apz::GetScrollModeForOrigin(ScrollOrigin::Other); if (scrollFrame) { scrollFrame->ScrollBy( - nsIntPoint(0, aForward ? 1 : -1), ScrollUnit::WHOLE, scrollMode, + nsIntPoint(0, aForward ? 1 : -1), ScrollUnit::WHOLE, ScrollMode::Smooth, nullptr, mozilla::ScrollOrigin::NotSpecified, nsIScrollableFrame::NOT_MOMENTUM, nsIScrollableFrame::ENABLE_SNAP); }