diff --git a/gfx/layers/ipc/AsyncPanZoomController.cpp b/gfx/layers/ipc/AsyncPanZoomController.cpp index c66b7c0a089a..49e84414fbf0 100644 --- a/gfx/layers/ipc/AsyncPanZoomController.cpp +++ b/gfx/layers/ipc/AsyncPanZoomController.cpp @@ -1378,9 +1378,24 @@ void AsyncPanZoomController::ContentReceivedTouch(bool aPreventDefault) { } } -void AsyncPanZoomController::SetState(PanZoomState aState) { - MonitorAutoLock monitor(mMonitor); - mState = aState; +void AsyncPanZoomController::SetState(PanZoomState aNewState) { + + PanZoomState oldState; + + // Intentional scoping for mutex + { + MonitorAutoLock monitor(mMonitor); + oldState = mState; + mState = aNewState; + } + + if (mGeckoContentController) { + if (oldState == PANNING && aNewState != PANNING) { + mGeckoContentController->HandlePanEnd(); + } else if (oldState != PANNING && aNewState == PANNING) { + mGeckoContentController->HandlePanBegin(); + } + } } void AsyncPanZoomController::TimeoutTouchListeners() { diff --git a/gfx/layers/ipc/GeckoContentController.h b/gfx/layers/ipc/GeckoContentController.h index 7f59d47db1b9..eeaa97919ad0 100644 --- a/gfx/layers/ipc/GeckoContentController.h +++ b/gfx/layers/ipc/GeckoContentController.h @@ -60,6 +60,17 @@ public: */ virtual void PostDelayedTask(Task* aTask, int aDelayMs) = 0; + + /** + * Request any special actions be performed when panning starts + */ + virtual void HandlePanBegin() {} + + /** + * Request any special actions be performed when panning ends + */ + virtual void HandlePanEnd() {} + GeckoContentController() {} virtual ~GeckoContentController() {} };