Bug 1296887 - Prevent a second call to shiftLayerView with the same destination as the first from clearing the resize state prematurely. r=rbarker
authorKartikaya Gupta <kgupta@mozilla.com>
Thu, 01 Sep 2016 17:27:15 -0400
changeset 312447 1e4f5a991728ebf5ba435300406958792d2982d1
parent 312446 617559427df014717596246d8b0bc65ca81d6265
child 312448 dbf9f64add05eb4a0d75f2d6a62a37b91ebc5407
push id20447
push userkwierso@gmail.com
push dateFri, 02 Sep 2016 20:36:44 +0000
treeherderfx-team@969397f22187 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrbarker
bugs1296887
milestone51.0a1
Bug 1296887 - Prevent a second call to shiftLayerView with the same destination as the first from clearing the resize state prematurely. r=rbarker MozReview-Commit-ID: 4iMfJ8tsweR
mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DynamicToolbarAnimator.java
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DynamicToolbarAnimator.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/gfx/DynamicToolbarAnimator.java
@@ -233,16 +233,21 @@ public class DynamicToolbarAnimator {
         mAnimationTask = new DynamicToolbarAnimationTask(desiredTranslation, immediately, showToolbar);
         mTarget.getView().postRenderTask(mAnimationTask);
     }
 
     private synchronized void shiftLayerView(float desiredTranslation) {
         float layerViewTranslationNeeded = desiredTranslation - mLayerViewTranslation;
         mLayerViewTranslation = desiredTranslation;
         synchronized (mTarget.getLock()) {
+            if (layerViewTranslationNeeded == 0 && isResizing()) {
+                // We're already in the middle of a snap, so this new call is
+                // redundant as it's snapping to the same place. Ignore it.
+                return;
+            }
             mHeightDuringResize = new Integer(mTarget.getViewportMetrics().viewportRectHeight);
             mSnapRequired = mTarget.setViewportSize(
                 mTarget.getView().getWidth(),
                 mTarget.getView().getHeight() - Math.round(mMaxTranslation - mLayerViewTranslation),
                 new PointF(0, -layerViewTranslationNeeded));
             if (!mSnapRequired) {
                 mHeightDuringResize = null;
                 ThreadUtils.postToUiThread(new Runnable() {