Skip to content

Commit

Permalink
Backed out changeset 58f10ceb16ba (bug 1756529) for causing mochitest…
Browse files Browse the repository at this point in the history
… failures on test_group_keyboard.html. CLOSED TREE
  • Loading branch information
Iulian Moraru committed Mar 10, 2022
1 parent 14f8f2d commit 9aca2fb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 255 deletions.
7 changes: 0 additions & 7 deletions gfx/layers/apz/public/APZPublicUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "mozilla/DefineEnum.h"
#include "mozilla/ScrollOrigin.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/ScrollTypes.h"

namespace mozilla {

Expand Down Expand Up @@ -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
Expand Down
19 changes: 0 additions & 19 deletions gfx/layers/apz/src/APZPublicUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 5 additions & 8 deletions gfx/layers/apz/src/AsyncPanZoomController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
204 changes: 0 additions & 204 deletions gfx/layers/apz/test/mochitest/helper_bug1756529.html

This file was deleted.

7 changes: 1 addition & 6 deletions gfx/layers/apz/test/mochitest/test_group_keyboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@
{"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: []},
{"file": "helper_bug1756529.html", prefs: [["test.events.async.enabled", true]]},
prefs: smoothness_prefs }
];

if (isKeyApzEnabled()) {
Expand Down
Loading

0 comments on commit 9aca2fb

Please sign in to comment.