Bug 1457743 - Fix check for entering momentum-scrolling codepath after both fingers are released in a two-finger pan. r=kats, a=jcristau
authorBotond Ballo <botond@mozilla.com>
Sat, 28 Apr 2018 19:29:51 -0400
changeset 463624 cccf97e1369b
parent 463623 61c5b7004802
child 463625 b7e489ec7f45
push id1714
push userryanvm@gmail.com
push date2018-05-14 17:43 +0000
treeherdermozilla-release@b7e489ec7f45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats, jcristau
bugs1457743
milestone60.0.1
Bug 1457743 - Fix check for entering momentum-scrolling codepath after both fingers are released in a two-finger pan. r=kats, a=jcristau MozReview-Commit-ID: 587mYzBf2aB
gfx/layers/apz/src/AsyncPanZoomController.cpp
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -1568,16 +1568,17 @@ nsEventStatus AsyncPanZoomController::On
     }
   } else {
     // Otherwise, handle the fingers being lifted.
 
     // Some of the code paths below, like ScrollSnap() or HandleEndOfPan(),
     // may start an animation, but otherwise we want to end up in the NOTHING
     // state. To avoid state change notification churn, we use a
     // notification blocker.
+    bool stateWasPinching = (mState == PINCHING);
     StateChangeNotificationBlocker blocker(this);
     SetState(NOTHING);
 
     if (mZoomConstraints.mAllowZoom) {
       RecursiveMutexAutoLock lock(mRecursiveMutex);
 
       // We can get into a situation where we are overscrolled at the end of a
       // pinch if we go into overscroll with a two-finger pan, and then turn
@@ -1594,17 +1595,17 @@ nsEventStatus AsyncPanZoomController::On
       }
       // Along with clearing the overscroll, we also want to snap to the nearest
       // snap point as appropriate.
       ScrollSnap();
     } else {
       // when zoom is not allowed
       mX.EndTouch(aEvent.mTime);
       mY.EndTouch(aEvent.mTime);
-      if (mState == PINCHING) {
+      if (stateWasPinching) {
         // still pinching
         if (HasReadyTouchBlock()) {
           return HandleEndOfPan();
         }
       }
     }
   }
   return nsEventStatus_eConsumeNoDefault;