Bug 886576 - Fix scrolling cancelling locked dynamic toolbar animations. r=kats
authorChris Lord <chrislord.net@gmail.com>
Fri, 19 Jul 2013 17:39:44 +0100
changeset 151551 c30555419404d0aec3369cf416c877aef9eb81ad
parent 151550 0f046ccc7b5388dc94182d3a86e4d7ebbc8934ab
child 151552 84e6087150456a086f1133db74f70cc341a07f9d
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs886576
milestone25.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 886576 - Fix scrolling cancelling locked dynamic toolbar animations. r=kats Move the margin animation-cancelling call into the margins-pinned check block in LayerMarginsAnimator to make sure margin animations aren't cancelled by scrolling when margins are locked.
mobile/android/base/BrowserApp.java
mobile/android/base/gfx/LayerMarginsAnimator.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -1204,18 +1204,18 @@ abstract public class BrowserApp extends
 
         mTabsPanel.prepareTabsAnimation(mMainLayoutAnimator);
         mBrowserToolbar.prepareTabsAnimation(mMainLayoutAnimator, areTabsShown());
 
         // If the tabs layout is animating onto the screen, pin the dynamic
         // toolbar.
         if (mLayerView != null && isDynamicToolbarEnabled()) {
             if (width > 0 && height > 0) {
+                mLayerView.getLayerMarginsAnimator().setMarginsPinned(true);
                 mLayerView.getLayerMarginsAnimator().showMargins(false);
-                mLayerView.getLayerMarginsAnimator().setMarginsPinned(true);
             } else {
                 mLayerView.getLayerMarginsAnimator().setMarginsPinned(false);
             }
         }
 
         mMainLayoutAnimator.start();
     }
 
--- a/mobile/android/base/gfx/LayerMarginsAnimator.java
+++ b/mobile/android/base/gfx/LayerMarginsAnimator.java
@@ -221,27 +221,27 @@ public class LayerMarginsAnimator implem
         return aDelta - (marginStart - aMargins[0]);
     }
 
     /*
      * Taking maximum margins into account, offsets the margins and then the
      * viewport origin and returns the modified metrics.
      */
     ImmutableViewportMetrics scrollBy(ImmutableViewportMetrics aMetrics, float aDx, float aDy) {
-        // Make sure to cancel any margin animations when scrolling begins
-        if (mAnimationTimer != null) {
-            mAnimationTimer.cancel();
-            mAnimationTimer = null;
-        }
-
         float[] newMarginsX = { aMetrics.marginLeft, aMetrics.marginRight };
         float[] newMarginsY = { aMetrics.marginTop, aMetrics.marginBottom };
 
         // Only alter margins if the toolbar isn't pinned
         if (!mMarginsPinned) {
+            // Make sure to cancel any margin animations when margin-scrolling begins
+            if (mAnimationTimer != null) {
+                mAnimationTimer.cancel();
+                mAnimationTimer = null;
+            }
+
             // Reset the touch travel when changing direction
             if ((aDx >= 0) != (mTouchTravelDistance.x >= 0)) {
                 mTouchTravelDistance.x = 0;
             }
             if ((aDy >= 0) != (mTouchTravelDistance.y >= 0)) {
                 mTouchTravelDistance.y = 0;
             }