Bug 1361880 - Prevent toolbar from animating when drag threshold has not been reached r=botond draft
authorRandall Barker <rbarker@mozilla.com>
Wed, 03 May 2017 10:48:41 -0700
changeset 572847 3e3f2928daccd1f36eca9f81719a24d1e6bf2397
parent 572846 c2898a7cc72105800408bc0ec873552da0c7a432
child 572848 868db895fe0cce19b305034101e9afdf8fdb4fe1
push id57195
push userbmo:rbarker@mozilla.com
push dateThu, 04 May 2017 20:08:56 +0000
reviewersbotond
bugs1361880
milestone55.0a1
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
@@ -582,16 +582,22 @@ AndroidDynamicToolbarAnimator::HandleTou
   }
 
   // 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