Bug 1269068 - Zero out the axis velocity once the wheel scroll animation is terminating. r?botond draft
authorKartikaya Gupta <kgupta@mozilla.com>
Mon, 02 May 2016 15:26:35 -0400
changeset 358387 f55167d12138a4051e64fba583b13337da0cbc5e
parent 357771 8c3fd523d75bd30f691ca2d6cfdad18d576392a1
child 519843 fd7f97827eff8cf1723f1eb723fbccbbf12a9067
push id16996
push userkgupta@mozilla.com
push dateMon, 02 May 2016 19:30:14 +0000
reviewersbotond
bugs1269068
milestone49.0a1
Bug 1269068 - Zero out the axis velocity once the wheel scroll animation is terminating. r?botond MozReview-Commit-ID: 50WX2ATswhv
gfx/layers/apz/src/WheelScrollAnimation.cpp
--- a/gfx/layers/apz/src/WheelScrollAnimation.cpp
+++ b/gfx/layers/apz/src/WheelScrollAnimation.cpp
@@ -50,17 +50,20 @@ WheelScrollAnimation::DoSample(FrameMetr
   // function as normal.
   bool finished = IsFinished(now);
   nsPoint sampledDest = finished
                         ? mDestination
                         : PositionAt(now);
   ParentLayerPoint displacement =
     (CSSPoint::FromAppUnits(sampledDest) - aFrameMetrics.GetScrollOffset()) * zoom;
 
-  if (!IsZero(displacement)) {
+  if (finished) {
+    mApzc.mX.SetVelocity(0);
+    mApzc.mY.SetVelocity(0);
+  } else if (!IsZero(displacement)) {
     // Velocity is measured in ParentLayerCoords / Milliseconds
     float xVelocity = displacement.x / aDelta.ToMilliseconds();
     float yVelocity = displacement.y / aDelta.ToMilliseconds();
     mApzc.mX.SetVelocity(xVelocity);
     mApzc.mY.SetVelocity(yVelocity);
   }
 
   // Note: we ignore overscroll for wheel animations.