Backed out changesets ba4b4066c0fe and 1372b8919331 (bug 1071738) for Android crashes.
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 29 Sep 2014 16:57:09 -0400
changeset 207905 ae7c7d39ec2ee31c7eb6ad7cf19a8cbdb6b89c30
parent 207904 f269e2295c37cdb36e9271c159a36de954c04549
child 207906 2b72cf7356e2dfe1daf3e2f353527d53b8512811
push id27569
push usercbook@mozilla.com
push dateTue, 30 Sep 2014 13:14:19 +0000
treeherderautoland@2ae57957e4bb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1071738
milestone35.0a1
backs outba4b4066c0fe15545e4111da2bf6be7930a7ede0
1372b8919331513413949602b5160990cac9fd65
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
Backed out changesets ba4b4066c0fe and 1372b8919331 (bug 1071738) for Android crashes. CLOSED TREE
mobile/android/base/FormAssistPopup.java
--- a/mobile/android/base/FormAssistPopup.java
+++ b/mobile/android/base/FormAssistPopup.java
@@ -29,17 +29,16 @@ import android.view.animation.Animation;
 import android.view.animation.AnimationUtils;
 import android.view.inputmethod.InputMethodManager;
 import android.widget.AdapterView;
 import android.widget.AdapterView.OnItemClickListener;
 import android.widget.ArrayAdapter;
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.RelativeLayout;
-import android.widget.RelativeLayout.LayoutParams;
 import android.widget.TextView;
 
 import java.util.Arrays;
 import java.util.Collection;
 
 public class FormAssistPopup extends RelativeLayout implements GeckoEventListener {
     private final Context mContext;
     private final Animation mAnimation;
@@ -56,24 +55,22 @@ public class FormAssistPopup extends Rel
     private double mH;
 
     private enum PopupType {
         AUTOCOMPLETE,
         VALIDATIONMESSAGE;
     }
     private PopupType mPopupType;
 
-    private static final int MAX_VISIBLE_ROWS = 5;
-
     private static int sAutoCompleteMinWidth;
     private static int sAutoCompleteRowHeight;
     private static int sValidationMessageHeight;
     private static int sValidationTextMarginTop;
-    private static LayoutParams sValidationTextLayoutNormal;
-    private static LayoutParams sValidationTextLayoutInverted;
+    private static RelativeLayout.LayoutParams sValidationTextLayoutNormal;
+    private static RelativeLayout.LayoutParams sValidationTextLayoutInverted;
 
     private static final String LOGTAG = "GeckoFormAssistPopup";
 
     // The blocklist is so short that ArrayList is probably cheaper than HashSet.
     private static final Collection<String> sInputMethodBlocklist = Arrays.asList(new String[] {
                                             InputMethods.METHOD_GOOGLE_JAPANESE_INPUT, // bug 775850
                                             InputMethods.METHOD_OPENWNN_PLUS,          // bug 768108
                                             InputMethods.METHOD_SIMEJI,                // bug 768108
@@ -212,20 +209,20 @@ public class FormAssistPopup extends Rel
             LayoutInflater inflater = LayoutInflater.from(mContext);
             mValidationMessage = (RelativeLayout) inflater.inflate(R.layout.validation_message, null);
 
             addView(mValidationMessage);
             mValidationMessageText = (TextView) mValidationMessage.findViewById(R.id.validation_message_text);
 
             sValidationTextMarginTop = (int) (mContext.getResources().getDimension(R.dimen.validation_message_margin_top));
 
-            sValidationTextLayoutNormal = new LayoutParams(mValidationMessageText.getLayoutParams());
+            sValidationTextLayoutNormal = new RelativeLayout.LayoutParams(mValidationMessageText.getLayoutParams());
             sValidationTextLayoutNormal.setMargins(0, sValidationTextMarginTop, 0, 0);
 
-            sValidationTextLayoutInverted = new LayoutParams((ViewGroup.MarginLayoutParams) sValidationTextLayoutNormal);
+            sValidationTextLayoutInverted = new RelativeLayout.LayoutParams((ViewGroup.MarginLayoutParams) sValidationTextLayoutNormal);
             sValidationTextLayoutInverted.setMargins(0, 0, 0, 0);
 
             mValidationMessageArrow = (ImageView) mValidationMessage.findViewById(R.id.validation_message_arrow);
             mValidationMessageArrowInverted = (ImageView) mValidationMessage.findViewById(R.id.validation_message_arrow_inverted);
         }
 
         mValidationMessageText.setText(validationMessage);
 
@@ -258,20 +255,19 @@ public class FormAssistPopup extends Rel
         positionAndShowPopup(GeckoAppShell.getLayerView().getViewportMetrics());
     }
 
     private void positionAndShowPopup(ImmutableViewportMetrics aMetrics) {
         ThreadUtils.assertOnUiThread();
 
         // Don't show the form assist popup when using fullscreen VKB
         InputMethodManager imm =
-                (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
-        if (imm.isFullscreenMode()) {
+                (InputMethodManager) GeckoAppShell.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
+        if (imm.isFullscreenMode())
             return;
-        }
 
         // Hide/show the appropriate popup contents
         if (mAutoCompleteList != null)
             mAutoCompleteList.setVisibility((mPopupType == PopupType.AUTOCOMPLETE) ? VISIBLE : GONE);
         if (mValidationMessage != null)
             mValidationMessage.setVisibility((mPopupType == PopupType.AUTOCOMPLETE) ? GONE : VISIBLE);
 
         if (sAutoCompleteMinWidth == 0) {
@@ -286,48 +282,41 @@ public class FormAssistPopup extends Rel
 
         // These values correspond to the input box for which we want to
         // display the FormAssistPopup.
         int left = (int) (mX * zoom - aMetrics.viewportRectLeft + offset.x);
         int top = (int) (mY * zoom - aMetrics.viewportRectTop + offset.y);
         int width = (int) (mW * zoom);
         int height = (int) (mH * zoom);
 
-        int popupWidth = LayoutParams.MATCH_PARENT;
+        int popupWidth = RelativeLayout.LayoutParams.MATCH_PARENT;
         int popupLeft = left < 0 ? 0 : left;
 
         FloatSize viewport = aMetrics.getSize();
 
         // For autocomplete suggestions, if the input is smaller than the screen-width,
         // shrink the popup's width. Otherwise, keep it as MATCH_PARENT.
         if ((mPopupType == PopupType.AUTOCOMPLETE) && (left + width) < viewport.width) {
             popupWidth = left < 0 ? left + width : width;
 
             // Ensure the popup has a minimum width.
             if (popupWidth < sAutoCompleteMinWidth) {
                 popupWidth = sAutoCompleteMinWidth;
 
                 // Move the popup to the left if there isn't enough room for it.
-                if ((popupLeft + popupWidth) > viewport.width) {
+                if ((popupLeft + popupWidth) > viewport.width)
                     popupLeft = (int) (viewport.width - popupWidth);
-                }
             }
         }
 
-        int rows = mAutoCompleteList.getAdapter().getCount();
-        if (rows > MAX_VISIBLE_ROWS) {
-            rows = MAX_VISIBLE_ROWS;
-        }
-
         int popupHeight;
-        if (mPopupType == PopupType.AUTOCOMPLETE) {
-            popupHeight = sAutoCompleteRowHeight * rows;
-        } else {
+        if (mPopupType == PopupType.AUTOCOMPLETE)
+            popupHeight = sAutoCompleteRowHeight * mAutoCompleteList.getAdapter().getCount();
+        else
             popupHeight = sValidationMessageHeight;
-        }
 
         int popupTop = top + height;
 
         if (mPopupType == PopupType.VALIDATIONMESSAGE) {
             mValidationMessageText.setLayoutParams(sValidationTextLayoutNormal);
             mValidationMessageArrow.setVisibility(VISIBLE);
             mValidationMessageArrowInverted.setVisibility(GONE);
         }
@@ -352,17 +341,18 @@ public class FormAssistPopup extends Rel
                 if (mPopupType == PopupType.VALIDATIONMESSAGE) {
                     mValidationMessageText.setLayoutParams(sValidationTextLayoutInverted);
                     mValidationMessageArrow.setVisibility(GONE);
                     mValidationMessageArrowInverted.setVisibility(VISIBLE);
                 }
            }
         }
 
-        LayoutParams layoutParams = new LayoutParams(popupWidth, popupHeight);
+        RelativeLayout.LayoutParams layoutParams =
+                new RelativeLayout.LayoutParams(popupWidth, popupHeight);
         layoutParams.setMargins(popupLeft, popupTop, 0, 0);
         setLayoutParams(layoutParams);
         requestLayout();
 
         if (!isShown()) {
             setVisibility(VISIBLE);
             startAnimation(mAnimation);
         }