diff --git a/gfx/layers/ipc/AsyncPanZoomController.cpp b/gfx/layers/ipc/AsyncPanZoomController.cpp index 91a998e7743e..dae6a0dbc1b5 100644 --- a/gfx/layers/ipc/AsyncPanZoomController.cpp +++ b/gfx/layers/ipc/AsyncPanZoomController.cpp @@ -148,7 +148,7 @@ AsyncPanZoomController::HandleInputEvent(const nsInputEvent& aEvent, nsEventStatus AsyncPanZoomController::HandleInputEvent(const InputData& aEvent) { nsEventStatus rv = nsEventStatus_eIgnore; - if (mGestureEventListener) { + if (mGestureEventListener && !mDisableNextTouchBatch) { nsEventStatus rv = mGestureEventListener->HandleInputEvent(aEvent); if (rv == nsEventStatus_eConsumeNoDefault) return rv; @@ -823,6 +823,9 @@ void AsyncPanZoomController::NotifyDOMTouchListenerAdded() { void AsyncPanZoomController::CancelDefaultPanZoom() { mDisableNextTouchBatch = true; + if (mGestureEventListener) { + mGestureEventListener->CancelGesture(); + } } } diff --git a/gfx/layers/ipc/GestureEventListener.cpp b/gfx/layers/ipc/GestureEventListener.cpp index e5f1f40ce261..e3a338934222 100644 --- a/gfx/layers/ipc/GestureEventListener.cpp +++ b/gfx/layers/ipc/GestureEventListener.cpp @@ -260,5 +260,10 @@ AsyncPanZoomController* GestureEventListener::GetAsyncPanZoomController() { return mAsyncPanZoomController; } +void GestureEventListener::CancelGesture() { + mTouches.Clear(); + mState = GESTURE_NONE; +} + } } diff --git a/gfx/layers/ipc/GestureEventListener.h b/gfx/layers/ipc/GestureEventListener.h index 4a227a4f2768..e715e2020760 100644 --- a/gfx/layers/ipc/GestureEventListener.h +++ b/gfx/layers/ipc/GestureEventListener.h @@ -47,6 +47,13 @@ public: */ nsEventStatus HandleInputEvent(const InputData& aEvent); + /** + * Cancels any currently active gesture. May not properly handle situations + * that require extra work at the gesture's end, like a pinch which only + * requests a repaint once it has ended. + */ + void CancelGesture(); + /** * Returns the AsyncPanZoomController stored on this class and used for * callbacks.