Bug 1502638 - If the velocity tracker can't compute a velocity, zero out the axis velocity. r=kats
authorBotond Ballo <botond@mozilla.com>
Fri, 02 Nov 2018 17:55:09 +0000
changeset 500612 e05552012e19
parent 500611 e8ab07c1c98f
child 500613 75e4c3050cac
child 500614 8cd7b1c3737a
child 500737 016dbf633161
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs1502638
milestone65.0a1
first release with
nightly linux32
e05552012e19 / 65.0a1 / 20181102220121 / files
nightly linux64
e05552012e19 / 65.0a1 / 20181102220121 / files
nightly mac
e05552012e19 / 65.0a1 / 20181102220121 / files
nightly win32
e05552012e19 / 65.0a1 / 20181102220121 / files
nightly win64
e05552012e19 / 65.0a1 / 20181102220121 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1502638 - If the velocity tracker can't compute a velocity, zero out the axis velocity. r=kats The previous value of the axis velocity could be stale, e.g. in the opposite direction. Depends on D10449 Differential Revision: https://phabricator.services.mozilla.com/D10450
gfx/layers/apz/src/Axis.cpp
--- a/gfx/layers/apz/src/Axis.cpp
+++ b/gfx/layers/apz/src/Axis.cpp
@@ -236,21 +236,23 @@ ParentLayerCoord Axis::PanDistance(Paren
   return fabs(aPos - mStartPos);
 }
 
 void Axis::EndTouch(uint32_t aTimestampMs) {
   // mVelocityQueue is controller-thread only
   APZThreadUtils::AssertOnControllerThread();
 
   mAxisLocked = false;
-  // If the velocity tracker wasn't able to compute a velocity, use the
-  // previous value of |mVelocity| (expected to be set during the last call
-  // to AddPosition()) as a fallback.
+  // If the velocity tracker wasn't able to compute a velocity, zero out
+  // the velocity to make sure we don't get a fling based on some old and
+  // no-longer-relevant value of mVelocity.
   if (Maybe<float> velocity = mVelocityTracker->ComputeVelocity(aTimestampMs)) {
     mVelocity = *velocity;
+  } else {
+    mVelocity = 0;
   }
   AXIS_LOG("%p|%s ending touch, computed velocity %f\n",
     mAsyncPanZoomController, Name(), mVelocity);
 }
 
 void Axis::CancelGesture() {
   // mVelocityQueue is controller-thread only
   APZThreadUtils::AssertOnControllerThread();