Bug 867193 - Take margin offset into account when positioning form pop-ups. r=margaret a=akeybl
authorChris Lord <chrislord.net@gmail.com>
Tue, 18 Jun 2013 14:57:54 +0100
changeset 142910 2158896cb923f690e2cb512e4c73cba7d5470cf7
parent 142909 e6171d538fc657eb84499f18b63d169819b9f336
child 142911 27bcde94e2eeeac709ce50a86df550cf38afa9db
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret, akeybl
bugs867193
milestone23.0a2
Bug 867193 - Take margin offset into account when positioning form pop-ups. r=margaret a=akeybl
mobile/android/base/FormAssistPopup.java
--- a/mobile/android/base/FormAssistPopup.java
+++ b/mobile/android/base/FormAssistPopup.java
@@ -11,16 +11,17 @@ import org.mozilla.gecko.util.GeckoEvent
 import org.mozilla.gecko.util.ThreadUtils;
 
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
 
 import android.content.Context;
 import android.content.res.Resources;
+import android.graphics.PointF;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.util.Pair;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.animation.Animation;
 import android.view.animation.AnimationUtils;
@@ -211,18 +212,19 @@ public class FormAssistPopup extends Rel
         // These values correspond to the input box for which we want to
         // display the FormAssistPopup.
         int left = 0;
         int top = 0; 
         int width = 0;
         int height = 0;
 
         try {
-            left = (int) (rect.getDouble("x") * zoom - viewportMetrics.viewportRectLeft);
-            top = (int) (rect.getDouble("y") * zoom - viewportMetrics.viewportRectTop);
+            PointF offset = viewportMetrics.getMarginOffset();
+            left = (int) (rect.getDouble("x") * zoom - viewportMetrics.viewportRectLeft + offset.x);
+            top = (int) (rect.getDouble("y") * zoom - viewportMetrics.viewportRectTop + offset.y);
             width = (int) (rect.getDouble("w") * zoom);
             height = (int) (rect.getDouble("h") * zoom);
         } catch (JSONException e) {
             // Bail if we can't get the correct dimensions for the popup.
             Log.e(LOGTAG, "Error getting FormAssistPopup dimensions", e);
             return;
         }