зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1105109 - Introduce a FrameMetrics::ClampAndSetScrollOffset() helper. r=kats
MozReview-Commit-ID: 6LCPKrdGM6M --HG-- extra : rebase_source : 65f51ce5c40d9f1ac64c1f94055aa87d44a72cae
This commit is contained in:
Родитель
e3ca66d639
Коммит
9da4eab494
|
@ -335,6 +335,12 @@ public:
|
|||
mScrollOffset = aScrollOffset;
|
||||
}
|
||||
|
||||
// Set scroll offset, first clamping to the scroll range.
|
||||
void ClampAndSetScrollOffset(const CSSPoint& aScrollOffset)
|
||||
{
|
||||
SetScrollOffset(CalculateScrollRange().ClampPoint(aScrollOffset));
|
||||
}
|
||||
|
||||
const CSSPoint& GetScrollOffset() const
|
||||
{
|
||||
return mScrollOffset;
|
||||
|
|
|
@ -582,10 +582,9 @@ public:
|
|||
// offset to end up being a bit off from the destination, we can get
|
||||
// artefacts like "scroll to the next snap point in this direction"
|
||||
// scrolling to the snap point we're already supposed to be at.
|
||||
aFrameMetrics.SetScrollOffset(
|
||||
aFrameMetrics.CalculateScrollRange().ClampPoint(
|
||||
CSSPoint::FromAppUnits(nsPoint(mXAxisModel.GetDestination(),
|
||||
mYAxisModel.GetDestination()))));
|
||||
aFrameMetrics.ClampAndSetScrollOffset(
|
||||
CSSPoint::FromAppUnits(nsPoint(mXAxisModel.GetDestination(),
|
||||
mYAxisModel.GetDestination())));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3789,9 +3788,7 @@ void AsyncPanZoomController::NotifyLayersUpdated(const ScrollMetadata& aScrollMe
|
|||
// Even if we didn't accept a new scroll offset from content, the
|
||||
// scrollable rect may have changed in a way that makes our local
|
||||
// scroll offset out of bounds, so re-clamp it.
|
||||
mFrameMetrics.SetScrollOffset(
|
||||
mFrameMetrics.CalculateScrollRange().ClampPoint(
|
||||
mFrameMetrics.GetScrollOffset()));
|
||||
mFrameMetrics.ClampAndSetScrollOffset(mFrameMetrics.GetScrollOffset());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче