Bug 1337990 - Support cross-apz axis lock with touch-action enabled, and add a gtest for it. r=kats

MozReview-Commit-ID: AwPgwyYw2fV

--HG--
extra : rebase_source : 1b81771499bf74b9feaa5bd530234f643d0267c3
This commit is contained in:
Botond Ballo 2017-02-08 19:25:31 -05:00
Родитель 86233b8e5e
Коммит 4638f16b5d
2 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -2210,8 +2210,14 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
// Handling of cross sliding will need to be added in this method after touch-action released
// enabled by default.
MOZ_ASSERT(GetCurrentTouchBlock());
RefPtr<const OverscrollHandoffChain> overscrollHandoffChain =
GetCurrentInputBlock()->GetOverscrollHandoffChain();
bool canScrollHorizontal = !mX.IsAxisLocked() &&
overscrollHandoffChain->CanScrollInDirection(this, ScrollDirection::HORIZONTAL);
bool canScrollVertical = !mY.IsAxisLocked() &&
overscrollHandoffChain->CanScrollInDirection(this, ScrollDirection::VERTICAL);
if (GetCurrentTouchBlock()->TouchActionAllowsPanningXY()) {
if (mX.CanScrollNow() && mY.CanScrollNow()) {
if (canScrollHorizontal && canScrollVertical) {
if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
mY.SetAxisLocked(true);
SetState(PANNING_LOCKED_X);
@ -2221,7 +2227,7 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
} else {
SetState(PANNING);
}
} else if (mX.CanScrollNow() || mY.CanScrollNow()) {
} else if (canScrollHorizontal || canScrollVertical) {
SetState(PANNING);
} else {
SetState(NOTHING);

Просмотреть файл

@ -536,3 +536,8 @@ TEST_F(APZScrollHandoffTester, CrossApzcAxisLock_NoTouchAction) {
SCOPED_GFX_PREF(TouchActionEnabled, bool, false);
TestCrossApzcAxisLock();
}
TEST_F(APZScrollHandoffTester, CrossApzcAxisLock_TouchAction) {
SCOPED_GFX_PREF(TouchActionEnabled, bool, true);
TestCrossApzcAxisLock();
}