зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1272165 - Move the logic for determining whether to accelerate a fling into FlingAnimation. r=kats
MozReview-Commit-ID: 41GGRtdlcAU --HG-- extra : rebase_source : 131d84f7eab9b424ff30023db8db62a62c310abd
This commit is contained in:
Родитель
694a023498
Коммит
923e3daad0
|
@ -2410,7 +2410,7 @@ void AsyncPanZoomController::AcceptFling(FlingHandoffState& aHandoffState) {
|
|||
#else
|
||||
GenericFlingAnimation *fling = new GenericFlingAnimation(*this,
|
||||
aHandoffState.mChain,
|
||||
!aHandoffState.mIsHandoff, // only apply acceleration if this is an initial fling
|
||||
aHandoffState.mIsHandoff,
|
||||
aHandoffState.mScrolledApzc);
|
||||
#endif
|
||||
StartAnimation(fling);
|
||||
|
|
|
@ -31,7 +31,7 @@ class GenericFlingAnimation: public AsyncPanZoomAnimation {
|
|||
public:
|
||||
GenericFlingAnimation(AsyncPanZoomController& aApzc,
|
||||
const RefPtr<const OverscrollHandoffChain>& aOverscrollHandoffChain,
|
||||
bool aApplyAcceleration,
|
||||
bool aFlingIsHandedOff,
|
||||
const RefPtr<const AsyncPanZoomController>& aScrolledApzc)
|
||||
: mApzc(aApzc)
|
||||
, mOverscrollHandoffChain(aOverscrollHandoffChain)
|
||||
|
@ -62,7 +62,10 @@ public:
|
|||
// Note that the acceleration code is only applied on the APZC that initiates
|
||||
// the fling; the accelerated velocities are then handed off using the
|
||||
// normal DispatchFling codepath.
|
||||
if (aApplyAcceleration && !mApzc.mLastFlingTime.IsNull()
|
||||
// Acceleration is only applied in the APZC that originated the fling,
|
||||
// not in APZCs further down the handoff chain during handoff.
|
||||
bool applyAcceleration = !aFlingIsHandedOff;
|
||||
if (applyAcceleration && !mApzc.mLastFlingTime.IsNull()
|
||||
&& (now - mApzc.mLastFlingTime).ToMilliseconds() < gfxPrefs::APZFlingAccelInterval()) {
|
||||
if (SameDirection(velocity.x, mApzc.mLastFlingVelocity.x)) {
|
||||
velocity.x = Accelerate(velocity.x, mApzc.mLastFlingVelocity.x);
|
||||
|
|
Загрузка…
Ссылка в новой задаче