Skip to content

Commit

Permalink
Backed out changeset 6aefdcf0d53b (bug 1773378) for causing mochitest…
Browse files Browse the repository at this point in the history
… failures on browser_test_background_tab_scroll.js. CLOSED TREE
  • Loading branch information
crisscozmuta committed Jul 20, 2022
1 parent a45b6d1 commit dcedbd6
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 42 deletions.
23 changes: 1 addition & 22 deletions gfx/layers/apz/src/AsyncPanZoomController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,10 +829,6 @@ AsyncPanZoomController::GetAxisLockMode() {
return static_cast<AxisLockMode>(StaticPrefs::apz_axis_lock_mode());
}

bool AsyncPanZoomController::UsingStatefulAxisLock() const {
return (GetAxisLockMode() == STANDARD || GetAxisLockMode() == STICKY);
}

/* static */ AsyncPanZoomController::PinchLockMode
AsyncPanZoomController::GetPinchLockMode() {
return static_cast<PinchLockMode>(StaticPrefs::apz_pinch_lock_mode());
Expand Down Expand Up @@ -2571,7 +2567,7 @@ nsEventStatus AsyncPanZoomController::OnPanBegin(

StartTouch(aEvent.mLocalPanStartPoint, aEvent.mTimeStamp);

if (!UsingStatefulAxisLock()) {
if (GetAxisLockMode() == FREE) {
SetState(PANNING);
return nsEventStatus_eConsumeNoDefault;
}
Expand Down Expand Up @@ -2659,21 +2655,6 @@ AsyncPanZoomController::GetDisplacementsForPanGesture(
logicalPanDisplacement,
GetCurrentPanGestureBlock()->GetAllowedScrollDirections());

if (GetAxisLockMode() == DOMINANT_AXIS) {
// Given a pan gesture and both directions have a delta, implement
// dominant axis scrolling and only use the delta for the larger
// axis.
if (logicalPanDisplacement.y != 0 && logicalPanDisplacement.x != 0) {
if (fabs(logicalPanDisplacement.y) >= fabs(logicalPanDisplacement.x)) {
logicalPanDisplacement.x = 0;
physicalPanDisplacement.x = 0;
} else {
logicalPanDisplacement.y = 0;
physicalPanDisplacement.y = 0;
}
}
}

return {logicalPanDisplacement, physicalPanDisplacement};
}

Expand Down Expand Up @@ -3260,8 +3241,6 @@ void AsyncPanZoomController::HandlePanning(double aAngle) {
!mY.IsAxisLocked() && overscrollHandoffChain->CanScrollInDirection(
this, ScrollDirection::eVertical);

MOZ_ASSERT(UsingStatefulAxisLock());

if (!canScrollHorizontal || !canScrollVertical) {
SetState(PANNING);
} else if (apz::IsCloseToHorizontal(
Expand Down
3 changes: 0 additions & 3 deletions gfx/layers/apz/src/AsyncPanZoomController.h
Original file line number Diff line number Diff line change
Expand Up @@ -942,13 +942,10 @@ class AsyncPanZoomController {
FREE, /* No locking at all */
STANDARD, /* Default axis locking mode that remains locked until pan ends */
STICKY, /* Allow lock to be broken, with hysteresis */
DOMINANT_AXIS, /* Only allow movement on one axis */
};

static AxisLockMode GetAxisLockMode();

bool UsingStatefulAxisLock() const;

enum PinchLockMode {
PINCH_FREE, /* No locking at all */
PINCH_STANDARD, /* Default pinch locking mode that remains locked until
Expand Down
6 changes: 4 additions & 2 deletions gfx/layers/apz/test/gtest/TestAxisLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,9 @@ TEST_F(APZCAxisLockTester, BreakAxisLockByLockAngle) {
}

TEST_F(APZCAxisLockTester, TestDominantAxisScrolling) {
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 3);
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 2);
SCOPED_GFX_PREF_FLOAT("apz.axis_lock.lock_angle", M_PI / 4.0f);
SCOPED_GFX_PREF_FLOAT("apz.axis_lock.breakout_angle", M_PI / 4.0f);

int panY;
int panX;
Expand All @@ -421,7 +423,7 @@ TEST_F(APZCAxisLockTester, TestDominantAxisScrolling) {

// In dominant axis mode, test pan gesture events with varying gesture
// angles and ensure that we only pan on one axis.
for (panX = 0, panY = 50; panY >= 0; panY -= 10, panX += 5) {
for (panX = 0, panY = 50; panY >= 0; panY -= 10, panX += 10) {
// Gesture that should be locked onto one axis
QueueMockHitResult(ScrollableLayerGuid::START_SCROLL_ID);
PanGesture(PanGestureInput::PANGESTURE_START, manager,
Expand Down
1 change: 0 additions & 1 deletion gfx/layers/apz/test/gtest/TestGestureDetector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class APZCGestureDetectorTester : public APZCBasicTester {

#ifndef MOZ_WIDGET_ANDROID // Currently fails on Android
TEST_F(APZCGestureDetectorTester, Pan_After_Pinch) {
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 2);
SCOPED_GFX_PREF_FLOAT("apz.axis_lock.lock_angle", M_PI / 6.0f);
SCOPED_GFX_PREF_FLOAT("apz.axis_lock.breakout_angle", M_PI / 8.0f);

Expand Down
8 changes: 0 additions & 8 deletions gfx/layers/apz/test/gtest/TestOverscroll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,6 @@ TEST_F(APZCOverscrollTester, DisallowOverscrollInSingleLineTextControl) {
// pan momentum scrolling.
TEST_F(APZCOverscrollTester,
HorizontalOverscrollAnimationWithVerticalPanMomentumScrolling) {
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 2);
SCOPED_GFX_PREF_BOOL("apz.overscroll.enabled", true);

ScrollMetadata metadata;
Expand Down Expand Up @@ -930,7 +929,6 @@ TEST_F(APZCOverscrollTester,
// but having OverscrollAnimation on both axes initially.
TEST_F(APZCOverscrollTester,
BothAxesOverscrollAnimationWithPanMomentumScrolling) {
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 2);
SCOPED_GFX_PREF_BOOL("apz.overscroll.enabled", true);

ScrollMetadata metadata;
Expand Down Expand Up @@ -1117,7 +1115,6 @@ TEST_F(APZCOverscrollTester,
TEST_F(
APZCOverscrollTester,
VerticalOverscrollAnimationInAdditionToExistingHorizontalOverscrollAnimation) {
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 2);
SCOPED_GFX_PREF_BOOL("apz.overscroll.enabled", true);

ScrollMetadata metadata;
Expand Down Expand Up @@ -1608,7 +1605,6 @@ class APZCOverscrollTesterMock : public APZCTreeManagerTester {

#ifndef MOZ_WIDGET_ANDROID // Currently fails on Android
TEST_F(APZCOverscrollTesterMock, OverscrollHandoff) {
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 2);
SCOPED_GFX_PREF_BOOL("apz.overscroll.enabled", true);

const char* treeShape = "x(x)";
Expand Down Expand Up @@ -1642,7 +1638,6 @@ TEST_F(APZCOverscrollTesterMock, OverscrollHandoff) {

#ifndef MOZ_WIDGET_ANDROID // Currently fails on Android
TEST_F(APZCOverscrollTesterMock, VerticalOverscrollHandoffToScrollableRoot) {
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 2);
SCOPED_GFX_PREF_BOOL("apz.overscroll.enabled", true);

// Create a layer tree having two vertical scrollable layers.
Expand Down Expand Up @@ -1674,7 +1669,6 @@ TEST_F(APZCOverscrollTesterMock, VerticalOverscrollHandoffToScrollableRoot) {

#ifndef MOZ_WIDGET_ANDROID // Currently fails on Android
TEST_F(APZCOverscrollTesterMock, NoOverscrollHandoffToNonScrollableRoot) {
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 2);
SCOPED_GFX_PREF_BOOL("apz.overscroll.enabled", true);

// Create a layer tree having non-scrollable root and a vertical scrollable
Expand Down Expand Up @@ -1707,7 +1701,6 @@ TEST_F(APZCOverscrollTesterMock, NoOverscrollHandoffToNonScrollableRoot) {

#ifndef MOZ_WIDGET_ANDROID // Currently fails on Android
TEST_F(APZCOverscrollTesterMock, NoOverscrollHandoffOrthogonalPanGesture) {
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 2);
SCOPED_GFX_PREF_BOOL("apz.overscroll.enabled", true);

// Create a layer tree having horizontal scrollable root and a vertical
Expand Down Expand Up @@ -1901,7 +1894,6 @@ TEST_F(APZCOverscrollTesterMock, RetriggeredOverscrollAnimationVelocity) {

#ifndef MOZ_WIDGET_ANDROID // Only applies to GenericOverscrollEffect
TEST_F(APZCOverscrollTesterMock, OverscrollIntoPreventDefault) {
SCOPED_GFX_PREF_INT("apz.axis_lock.mode", 2);
SCOPED_GFX_PREF_BOOL("apz.overscroll.enabled", true);

const char* treeShape = "x";
Expand Down
14 changes: 8 additions & 6 deletions modules/libpref/init/StaticPrefList.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,11 @@

- name: apz.axis_lock.breakout_angle
type: AtomicFloat
#if defined(XP_MACOSX) && defined(NIGHTLY_BUILD)
value: float(M_PI / 4.0) # 45 degrees
#else
value: float(M_PI / 8.0) # 22.5 degrees
#endif
mirror: always
include: <cmath>

Expand All @@ -362,23 +366,21 @@

- name: apz.axis_lock.lock_angle
type: AtomicFloat
#if defined(XP_MACOSX) && defined(NIGHTLY_BUILD)
value: float(M_PI / 4.0) # 45 degrees
#else
value: float(M_PI / 6.0) # 30 degrees
#endif
mirror: always
include: <cmath>

# Whether to lock touch scrolling to one axis at a time.
# 0 = FREE (No locking at all)
# 1 = STANDARD (Once locked, remain locked until scrolling ends)
# 2 = STICKY (Allow lock to be broken, with hysteresis)
# 3 = DOMINANT_AXIS (Only allow movement on one axis at a time, only
# applies to touchpad scrolling)
- name: apz.axis_lock.mode
type: RelaxedAtomicInt32
#if defined(XP_MACOSX) && defined(NIGHTLY_BUILD)
value: 3
#else
value: 2
#endif
mirror: always

- name: apz.content_response_timeout
Expand Down

0 comments on commit dcedbd6

Please sign in to comment.