Bug 844471 - Menu obscured in landscape mode. r=mfinkle, a=lsblakk
authorSriram Ramasubramanian <sriram@mozilla.com>
Mon, 11 Mar 2013 13:10:00 -0700
changeset 132367 c5f2ea8ec9498ca180d88e3b0de99f9c74be325e
parent 132366 75bc2bcaee983ce755045351ccc0c149889372f3
child 132368 94f1fa2b14739e942b1270f87a05f76422a2bc46
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, lsblakk
bugs844471
milestone21.0a2
Bug 844471 - Menu obscured in landscape mode. r=mfinkle, a=lsblakk
mobile/android/base/MenuPopup.java
--- a/mobile/android/base/MenuPopup.java
+++ b/mobile/android/base/MenuPopup.java
@@ -88,36 +88,27 @@ public class MenuPopup extends PopupWind
             showAsDropDown(anchor, 0, -mYOffset);
             return;
         }
 
         int[] anchorLocation = new int[2];
         anchor.getLocationOnScreen(anchorLocation);
 
         int screenWidth = mResources.getDisplayMetrics().widthPixels;
-        int screenHeight = mResources.getDisplayMetrics().heightPixels;
         int arrowWidth = mResources.getDimensionPixelSize(R.dimen.menu_popup_arrow_width);
         int arrowOffset = (anchor.getWidth() - arrowWidth)/2;
        
         if (anchorLocation[0] + mPopupWidth <= screenWidth) {
             // left align
             ((LayoutParams) mArrowTop.getLayoutParams()).rightMargin = mPopupWidth - anchor.getWidth() + arrowOffset;
             ((LayoutParams) mArrowBottom.getLayoutParams()).rightMargin = mPopupWidth - anchor.getWidth() + arrowOffset;
         } else {
             // right align
             ((LayoutParams) mArrowTop.getLayoutParams()).rightMargin = mArrowMargin;
             ((LayoutParams) mArrowBottom.getLayoutParams()).rightMargin = mArrowMargin;
         }
 
-        if ((anchorLocation[1] + anchor.getHeight() + mPanel.getMeasuredHeight() >= screenHeight) &&
-            (anchorLocation[1] > mPanel.getMeasuredHeight())) {
-            // shown above anchor, only if there is enough space above
-            mArrowTop.setVisibility(View.GONE);
-            mArrowBottom.setVisibility(View.VISIBLE);
-            showAsDropDown(anchor, 0, -(mYOffset + mPanel.getMeasuredHeight() + anchor.getHeight()));
-        } else {
-            // shown below anchor
-            mArrowTop.setVisibility(View.VISIBLE);
-            mArrowBottom.setVisibility(View.GONE);
-            showAsDropDown(anchor, 0, -mYOffset);
-        }
+        // shown below anchor
+        mArrowTop.setVisibility(View.VISIBLE);
+        mArrowBottom.setVisibility(View.GONE);
+        showAsDropDown(anchor, 0, -mYOffset);
     }
 }