Bug 1107386 - Set internal container height as height of MenuPopup. r=mhaigh, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 23 Jan 2015 12:30:56 -0800
changeset 243022 e4e2855e992c
parent 243021 2745f66dac6f
child 243023 34330baf2af6
push id4364
push userryanvm@gmail.com
push date2015-01-24 16:33 +0000
treeherdermozilla-beta@34330baf2af6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmhaigh, sledru
bugs1107386, 7698709
milestone36.0
Bug 1107386 - Set internal container height as height of MenuPopup. r=mhaigh, a=sledru Solution via http://stackoverflow.com/a/7698709
mobile/android/base/menu/MenuPopup.java
--- a/mobile/android/base/menu/MenuPopup.java
+++ b/mobile/android/base/menu/MenuPopup.java
@@ -61,16 +61,18 @@ public class MenuPopup extends PopupWind
     }
 
     /**
      * A small little offset.
      */
     @Override
     public void showAsDropDown(View anchor) {
         // Set a height, so that the popup will not be displayed below the bottom of the screen.
-        setHeight(mPopupMinHeight);
+        // We use the exact height of the internal content, which is the technique described in
+        // http://stackoverflow.com/a/7698709
+        setHeight(mPanel.getHeight());
 
         // Attempt to align the center of the popup with the center of the anchor. If the anchor is
         // near the edge of the screen, the popup will just align with the edge of the screen.
         final int xOffset = anchor.getWidth()/2 - mPopupWidth/2;
         showAsDropDown(anchor, xOffset, -mYOffset);
     }
 }