Bug 928800: Doorhanger, while showing, should respect dynamic toolbar's dynamicness. [r=mfinkle]
authorSriram Ramasubramanian <sriram@mozilla.com>
Thu, 14 Nov 2013 16:06:01 -0800
changeset 156073 46c21551ce2270154c06c105c34fbd991ea42719
parent 156072 3cc8009a5f89af655de40ca06f015b2fd07dfc1e
child 156074 7f5e40e54c11826596371c2b480d7ca8f499a578
push id25668
push userkwierso@gmail.com
push dateTue, 19 Nov 2013 02:26:21 +0000
treeherdermozilla-central@4c2e31c6d4ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs928800
milestone28.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 928800: Doorhanger, while showing, should respect dynamic toolbar's dynamicness. [r=mfinkle]
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
@@ -921,16 +921,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);
+        }
     }
 }