From 4d872ae182965a5d5812ba5600c193067c8ba295 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Fri, 7 Aug 2015 14:39:34 -0400 Subject: [PATCH] Bug 1193062 - Add a PAN_MOMENTUM state. r=kats This was discussed in bug 1107716. --HG-- extra : commitid : 8EvQL9qrm3X extra : rebase_source : 3785c8ac8e7e90f171cf9091f6fc50d76d34f703 extra : histedit_source : ffc8c6cd57f535b03621e149bb300e60683d1612 --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 5 +++++ gfx/layers/apz/src/AsyncPanZoomController.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index ab106de01e50..94b68928a9e8 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -1075,6 +1075,7 @@ nsEventStatus AsyncPanZoomController::OnTouchStart(const MultiTouchInput& aEvent case SMOOTH_SCROLL: case OVERSCROLL_ANIMATION: case WHEEL_SCROLL: + case PAN_MOMENTUM: CurrentTouchBlock()->GetOverscrollHandoffChain()->CancelAnimations(ExcludeOverscroll); // Fall through. case NOTHING: { @@ -1145,6 +1146,7 @@ nsEventStatus AsyncPanZoomController::OnTouchMove(const MultiTouchInput& aEvent) case PANNING: case PANNING_LOCKED_X: case PANNING_LOCKED_Y: + case PAN_MOMENTUM: TrackTouch(aEvent); return nsEventStatus_eConsumeNoDefault; @@ -1209,6 +1211,7 @@ nsEventStatus AsyncPanZoomController::OnTouchEnd(const MultiTouchInput& aEvent) case PANNING: case PANNING_LOCKED_X: case PANNING_LOCKED_Y: + case PAN_MOMENTUM: { CurrentTouchBlock()->GetOverscrollHandoffChain()->FlushRepaints(); mX.EndTouch(aEvent.mTime); @@ -1730,6 +1733,7 @@ nsEventStatus AsyncPanZoomController::OnPanMomentumStart(const PanGestureInput& } mPanGestureState = MakeUnique(this, true); + SetState(PAN_MOMENTUM); return nsEventStatus_eConsumeNoDefault; } @@ -1744,6 +1748,7 @@ nsEventStatus AsyncPanZoomController::OnPanMomentumEnd(const PanGestureInput& aE // animation started, but I guess it doesn't really matter for now. mX.CancelTouch(); mY.CancelTouch(); + SetState(NOTHING); RequestContentRepaint(); diff --git a/gfx/layers/apz/src/AsyncPanZoomController.h b/gfx/layers/apz/src/AsyncPanZoomController.h index 4e91af3aaa11..ba319e7103cc 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -754,6 +754,8 @@ protected: PANNING_LOCKED_X, /* touch-start followed by move (i.e. panning with axis lock) X axis */ PANNING_LOCKED_Y, /* as above for Y axis */ + PAN_MOMENTUM, /* like PANNING, but controlled by momentum PanGestureInput events */ + CROSS_SLIDING_X, /* Panning disabled while user does a horizontal gesture on a vertically-scrollable view. This used for the Windows Metro "cross-slide" gesture. */