Bug 1155819 - Clean up phone code more. r=ally
authorChenxia Liu <liuche@mozilla.com>
Fri, 17 Apr 2015 17:08:26 -0700
changeset 240156 ab85ee309a19e7c57c5633c5083d43c386372a52
parent 240155 bf544e556f37d71bbf943812156236f01f2b3f32
child 240157 4bda09d4350c7a44f80f4538fbe31f1ba286eb31
push id58752
push usercbook@mozilla.com
push dateTue, 21 Apr 2015 10:39:00 +0000
treeherdermozilla-inbound@b8d59286a581 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersally
bugs1155819
milestone40.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 1155819 - Clean up phone code more. r=ally
mobile/android/base/widget/AnchoredPopup.java
--- a/mobile/android/base/widget/AnchoredPopup.java
+++ b/mobile/android/base/widget/AnchoredPopup.java
@@ -97,16 +97,14 @@ public abstract class AnchoredPopup exte
               mAnchor = decorView;
             }
             showAsDropDown(mAnchor, 0, -offsetY);
             return;
         }
 
         // If the anchor is null or out of the window bounds, just show the popup at the top of the
         // root view.
-        if (mAnchor == null || anchorLocation[1] < 0) {
-            showAtLocation(decorView, Gravity.NO_GRAVITY, 0, offsetY);
-            return;
-        }
+        final boolean validAnchor = (mAnchor != null) && (anchorLocation[1] > 0);
+        final View anchor = validAnchor ? mAnchor : decorView;
 
-        showAtLocation(mAnchor, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, offsetY);
+        showAtLocation(anchor, Gravity.TOP | Gravity.CENTER_HORIZONTAL, 0, offsetY);
     }
 }