Bug 1235994 - Extract a helper function to request a snap to the predicted destination. r=botond

This commit is contained in:
Kartikaya Gupta 2016-01-07 10:39:13 -05:00
parent 9286d4705f
commit bbeb5a72e5
2 changed files with 11 additions and 2 deletions

View File

@ -2429,6 +2429,14 @@ void AsyncPanZoomController::AcceptFling(FlingHandoffState& aHandoffState) {
aHandoffState.mChain,
!aHandoffState.mIsHandoff, // only apply acceleration if this is an initial fling
aHandoffState.mScrolledApzc);
RequestSnapToDestination();
StartAnimation(fling);
}
void
AsyncPanZoomController::RequestSnapToDestination()
{
ReentrantMonitorAutoEnter lock(mMonitor);
float friction = gfxPrefs::APZFlingFriction();
ParentLayerPoint velocity(mX.GetVelocity(), mY.GetVelocity());
@ -2462,8 +2470,6 @@ void AsyncPanZoomController::AcceptFling(FlingHandoffState& aHandoffState) {
predictedDestination);
}
}
StartAnimation(fling);
}
bool AsyncPanZoomController::AttemptFling(FlingHandoffState& aHandoffState) {

View File

@ -640,6 +640,9 @@ protected:
// to a nearby snap position if appropriate. The current scroll position is
// used as the final destination.
void RequestSnap();
// Same as above, but takes into account the current velocity to find a
// predicted destination.
void RequestSnapToDestination();
uint64_t mLayersId;
RefPtr<CompositorParent> mCompositorParent;