Bug 1105109 - Add a ScrollByAndClamp() utility function to AsyncPanZoomController. r=kats

MozReview-Commit-ID: GPnuL0kmWsN

--HG--
extra : rebase_source : c5773713b1ca8b1b7b95fc476372f0286690e211
This commit is contained in:
Botond Ballo 2017-06-19 18:06:03 -04:00
parent 9da4eab494
commit 1e610da876
2 changed files with 13 additions and 1 deletions

View File

@ -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);

View File

@ -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