Bug 1361880 - Prevent toolbar from animating when drag threshold has not been reached r=botond
authorRandall Barker <rbarker@mozilla.com>
Wed, 03 May 2017 10:48:41 -0700
changeset 357161 13fc94c53f3f7f108dee685a96c0b3996b771842
parent 357160 31e5f57bebfb83d8ce0c733698fa33386331630d
child 357162 177335aa1d5818daa8860ae9c469dcda35b98705
push id90052
push userrbarker@mozilla.com
push dateTue, 09 May 2017 00:01:59 +0000
treeherdermozilla-inbound@177335aa1d58 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1361880
milestone55.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 1361880 - Prevent toolbar from animating when drag threshold has not been reached r=botond MozReview-Commit-ID: 14WKMWdjjsf
gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
--- a/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
+++ b/gfx/layers/apz/src/AndroidDynamicToolbarAnimator.cpp
@@ -574,32 +574,39 @@ AndroidDynamicToolbarAnimator::HandleTou
     // If there still isn't a direction, default to show just to be safe
     if (!direction) {
       direction = MOVE_TOOLBAR_DOWN;
     }
   }
   mControllerStartTouch = 0;
   mControllerPreviousTouch = 0;
   mControllerTotalDistance = 0;
+  bool dragThresholdReached = mControllerDragThresholdReached;
   mControllerDragThresholdReached = false;
   mControllerLastEventTimeStamp = 0;
   bool cancelTouchTracking = mControllerCancelTouchTracking;
   mControllerCancelTouchTracking = false;
 
   // Animation is in progress, bail out.
   if (aCurrentToolbarState == eToolbarAnimating) {
     return;
   }
 
   // Received a UI thread request to show or hide the snapshot during a touch.
   // This overrides the touch event so just return.
   if (cancelTouchTracking) {
     return;
   }
 
+  // The drag threshold has not been reach and the toolbar is either completely visible or completely hidden.
+  if (!dragThresholdReached && ((mControllerToolbarHeight == mControllerMaxToolbarHeight) || (mControllerToolbarHeight == 0))) {
+    ShowToolbarIfNotVisible(aCurrentToolbarState);
+    return;
+  }
+
   // The toolbar is already where it needs to be so just return.
   if (((direction == MOVE_TOOLBAR_DOWN) && (mControllerToolbarHeight == mControllerMaxToolbarHeight)) ||
       ((direction == MOVE_TOOLBAR_UP) && (mControllerToolbarHeight == 0))) {
     ShowToolbarIfNotVisible(aCurrentToolbarState);
     return;
   }
 
   // Don't animate up if not scrolling root content. Even though ShowToolbarIfNotVisible checks if