Bug 928800 - Doorhanger, while showing, should respect dynamic toolbar's dynamicness. r=mfinkle, a=lsblakk
authorSriram Ramasubramanian <sriram@mozilla.com>
Thu, 14 Nov 2013 16:06:01 -0800
changeset 166550 0896f9e5c3f76eb0d66b5815f346bef04f2f7cbc
parent 166549 a1db4e79b1e2348e64014f8ad4b57f42fbe67f18
child 166551 b1a341fb814fd160ab7b82aba8871a797ef519fa
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, lsblakk
bugs928800
milestone27.0a2
Bug 928800 - Doorhanger, while showing, should respect dynamic toolbar's dynamicness. r=mfinkle, a=lsblakk
mobile/android/base/BrowserApp.java
mobile/android/base/DoorHangerPopup.java
mobile/android/base/widget/ArrowPopup.java
--- a/mobile/android/base/BrowserApp.java
+++ b/mobile/android/base/BrowserApp.java
@@ -892,16 +892,19 @@ abstract public class BrowserApp extends
             mDynamicToolbarCanScroll = true;
         }
 
         final View toolbarLayout = mBrowserToolbar;
         final int marginTop = Math.round(aMetrics.marginTop);
         ThreadUtils.postToUiThread(new Runnable() {
             public void run() {
                 toolbarLayout.scrollTo(0, toolbarLayout.getHeight() - marginTop);
+                if (mDoorHangerPopup.isShowing()) {
+                    mDoorHangerPopup.updatePopup();
+                }
             }
         });
 
         if (mFormAssistPopup != null)
             mFormAssistPopup.onMetricsChanged(aMetrics);
     }
 
     @Override
--- a/mobile/android/base/DoorHangerPopup.java
+++ b/mobile/android/base/DoorHangerPopup.java
@@ -263,17 +263,17 @@ public class DoorHangerPopup extends Arr
         }
     }
 
     /**
      * Updates the popup state.
      *
      * This method must be called on the UI thread.
      */
-    private void updatePopup() {
+    void updatePopup() {
         // Bail if the selected tab is null, if there are no active doorhangers,
         // if we haven't inflated the layout yet (this can happen if updatePopup()
         // is called before the runnable from addDoorHanger() runs), or if the
         // doorhanger popup is temporarily disabled.
         Tab tab = Tabs.getInstance().getSelectedTab();
         if (tab == null || mDoorHangers.size() == 0 || !mInflated || mDisabled) {
             dismiss();
             return;
@@ -294,17 +294,17 @@ public class DoorHangerPopup extends Arr
         // Dismiss the popup if there are no doorhangers to show for this tab
         if (!shouldShowPopup) {
             dismiss();
             return;
         }
 
         showDividers();
         if (isShowing()) {
-            update();
+            show();
             return;
         }
 
         // Make the popup focusable for accessibility. This gets done here
         // so the node can be accessibility focused, but on pre-ICS devices this
         // causes crashes, so it is done after the popup is shown.
         if (Build.VERSION.SDK_INT >= 14) {
             setFocusable(true);
--- a/mobile/android/base/widget/ArrowPopup.java
+++ b/mobile/android/base/widget/ArrowPopup.java
@@ -109,11 +109,15 @@ public class ArrowPopup extends PopupWin
             offset = arrowOffset - arrowLayoutParams.leftMargin;
         } else {
             // On phones, the popup takes up the width of the screen, so we set the arrow's left
             // margin to make it line up with the anchor.
             int leftMargin = anchorLocation[0] + arrowOffset;
             arrowLayoutParams.setMargins(leftMargin, 0, 0, 0);
         }
 
-        showAsDropDown(mAnchor, offset, -mYOffset);
+        if (isShowing()) {
+            update(mAnchor, offset, -mYOffset, -1, -1);
+        } else {
+            showAsDropDown(mAnchor, offset, -mYOffset);
+        }
     }
 }