Bug 1219391 - Request snapping for the entire handoff chain when ending the fling animation. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 28 Oct 2015 15:39:13 -0400
changeset 305255 33df0bbcc1ae809bb6461f7b929a271fe542d6b3
parent 305254 086aa469aa8470dd14b2348db14be715b367718b
child 305256 b31234efbde4b8fa04d88b6cb83ec1123d4f31e1
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1219391
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1219391 - Request snapping for the entire handoff chain when ending the fling animation. r=botond
gfx/layers/apz/src/AsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1313,17 +1313,16 @@ nsEventStatus AsyncPanZoomController::On
     // We may have some velocity stored on the axis from move events
     // that were not big enough to trigger scrolling. Clear that out.
     mX.SetVelocity(0);
     mY.SetVelocity(0);
     // It's possible we may be overscrolled if the user tapped during a
     // previous overscroll pan. Make sure to snap back in this situation.
     if (!SnapBackIfOverscrolled()) {
       SetState(NOTHING);
-      RequestSnap();
     }
     return nsEventStatus_eIgnore;
 
   case PANNING:
   case PANNING_LOCKED_X:
   case PANNING_LOCKED_Y:
   case PAN_MOMENTUM:
   {
@@ -2682,16 +2681,19 @@ bool AsyncPanZoomController::SnapBackIfO
   ReentrantMonitorAutoEnter lock(mMonitor);
   // It's possible that we're already in the middle of an overscroll
   // animation - if so, don't start a new one.
   if (IsOverscrolled() && mState != OVERSCROLL_ANIMATION) {
     APZC_LOG("%p is overscrolled, starting snap-back\n", this);
     StartOverscrollAnimation(ParentLayerPoint(0, 0));
     return true;
   }
+  // If we don't kick off an overscroll animation, we still need to ask the
+  // main thread to snap to any nearby snap points.
+  RequestSnap();
   return false;
 }
 
 bool AsyncPanZoomController::IsFlingingFast() const {
   ReentrantMonitorAutoEnter lock(mMonitor);
   if (mState == FLING &&
       GetVelocityVector().Length() > gfxPrefs::APZFlingStopOnTapThreshold()) {
     APZC_LOG("%p is moving fast\n", this);