From d9fa52403331e5a023f01b8284e9a86bdf242201 Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Thu, 31 Oct 2019 01:06:14 +0000 Subject: [PATCH] Bug 1592435 - Don't allow a main thread scroll update to interrupt a touch-drag gesture. r=tnikkel This makes the behaviour for touch-drags match the behaviour we already have for pan gesture events. Depends on D51201 Differential Revision: https://phabricator.services.mozilla.com/D51202 --HG-- extra : moz-landing-system : lando --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 10 +++++++--- gfx/layers/apz/src/AsyncPanZoomController.h | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 98e6105a597c..a04254f6752e 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -4992,7 +4992,7 @@ bool AsyncPanZoomController::HasReadyTouchBlock() const { } bool AsyncPanZoomController::CanHandleScrollOffsetUpdate(PanZoomState aState) { - return aState == PAN_MOMENTUM; + return aState == PAN_MOMENTUM || IsPanningState(aState); } void AsyncPanZoomController::SetState(PanZoomState aNewState) { @@ -5061,9 +5061,13 @@ bool AsyncPanZoomController::IsTransformingState(PanZoomState aState) { return !(aState == NOTHING || aState == TOUCHING); } +bool AsyncPanZoomController::IsPanningState(PanZoomState aState) { + return (aState == PANNING || aState == PANNING_LOCKED_X || + aState == PANNING_LOCKED_Y); +} + bool AsyncPanZoomController::IsInPanningState() const { - return (mState == PANNING || mState == PANNING_LOCKED_X || - mState == PANNING_LOCKED_Y); + return IsPanningState(mState); } void AsyncPanZoomController::UpdateZoomConstraints( diff --git a/gfx/layers/apz/src/AsyncPanZoomController.h b/gfx/layers/apz/src/AsyncPanZoomController.h index 3fbbba72d578..b982f0ea263b 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -1229,6 +1229,8 @@ class AsyncPanZoomController { // held whenever this is updated. In practice though... see bug 897017. PanZoomState mState; + static bool IsPanningState(PanZoomState aState); + /** * Returns whether the specified PanZoomState does not need to be reset when * a scroll offset update is processed.