diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index ad563fd834d4..f45a3746312f 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2916,6 +2916,10 @@ void AsyncPanZoomController::ScrollBy(const CSSPoint& aOffset) { mFrameMetrics.ScrollBy(aOffset); } +void AsyncPanZoomController::ScrollByAndClamp(const CSSPoint& aOffset) { + mFrameMetrics.ClampAndSetScrollOffset(mFrameMetrics.GetScrollOffset() + aOffset); +} + void AsyncPanZoomController::ScaleWithFocus(float aScale, const CSSPoint& aFocus) { mFrameMetrics.ZoomBy(aScale); diff --git a/gfx/layers/apz/src/AsyncPanZoomController.h b/gfx/layers/apz/src/AsyncPanZoomController.h index 3272c200caf9..c984bba089e8 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -532,10 +532,18 @@ protected: nsEventStatus OnCancelTap(const TapGestureInput& aEvent); /** - * Scrolls the viewport by an X,Y offset. + * Scroll the scroll frame by an X,Y offset. + * The resulting scroll offset is not clamped to the scrollable rect; + * the caller must ensure it stays within range. */ void ScrollBy(const CSSPoint& aOffset); + /** + * Scroll the scroll frame by an X,Y offset, clamping the resulting + * scroll offset to the scrollable rect. + */ + void ScrollByAndClamp(const CSSPoint& aOffset); + /** * Scales the viewport by an amount (note that it multiplies this scale in to * the current scale, it doesn't set it to |aScale|). Also considers a focus