зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1480866 - Avoid creating a fling animation with zero velocity. r=kats
Differential Revision: https://phabricator.services.mozilla.com/D2743 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
c0ef44e6f9
Коммит
168027fec9
|
@ -151,6 +151,8 @@ void AndroidFlingPhysics::Init(const ParentLayerPoint& aStartingVelocity,
|
|||
float aPLPPI)
|
||||
{
|
||||
mVelocity = aStartingVelocity.Length();
|
||||
// We should not have created a fling animation if there is no velocity.
|
||||
MOZ_ASSERT(mVelocity != 0.0f);
|
||||
const double tuningCoeff = ComputeDeceleration(aPLPPI);
|
||||
mTargetDuration = ComputeFlingDuration(mVelocity, tuningCoeff);
|
||||
MOZ_ASSERT(!mTargetDuration.IsZero());
|
||||
|
|
|
@ -3064,6 +3064,15 @@ ParentLayerPoint AsyncPanZoomController::AttemptFling(const FlingHandoffState& a
|
|||
residualVelocity.y = 0;
|
||||
}
|
||||
|
||||
// If we're not scrollable in at least one of the directions in which we
|
||||
// were handed velocity, don't start a fling animation.
|
||||
if (GetVelocityVector().Length() < gfxPrefs::APZFlingMinVelocityThreshold()) {
|
||||
// Relieve overscroll now if needed, since we will not transition to a fling
|
||||
// animation and then an overscroll animation, and relieve it then.
|
||||
aHandoffState.mChain->SnapBackOverscrolledApzc(this);
|
||||
return residualVelocity;
|
||||
}
|
||||
|
||||
// If there's a scroll snap point near the predicted fling destination,
|
||||
// scroll there using a smooth scroll animation. Otherwise, start a
|
||||
// fling animation.
|
||||
|
|
Загрузка…
Ссылка в новой задаче