Bug 628695 - Make invalid form popup offset aware of the zoom level. r=enndeakin a=jst
authorMounir Lamouri <mounir.lamouri@gmail.com>
Fri, 04 Feb 2011 00:06:16 +0100
changeset 61911 2efc7cc537d753ef8c8478276cd1ca9e1a766d32
parent 61910 c618b7b138fbec66dc18a0e6a7fe61ab9945c266
child 61912 2c29556f324b8fea661b079378822bfe30668aec
push idunknown
push userunknown
push dateunknown
reviewersenndeakin, jst
bugs628695
milestone2.0b12pre
Bug 628695 - Make invalid form popup offset aware of the zoom level. r=enndeakin a=jst
browser/base/content/browser.js
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -878,23 +878,29 @@ const gFormSubmitObserver = {
     // and where the content begin for the other elements.
     let offset = 0;
     let position = "";
 
     if (element.tagName == 'INPUT' &&
         (element.type == 'radio' || element.type == 'checkbox')) {
       position = "bottomcenter topleft";
     } else {
-      let style = element.ownerDocument.defaultView.getComputedStyle(element, null);
+      let win = element.ownerDocument.defaultView;
+      let style = win.getComputedStyle(element, null);
+      let utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+                     .getInterface(Components.interfaces.nsIDOMWindowUtils);
+
       if (style.direction == 'rtl') {
         offset = parseInt(style.paddingRight) + parseInt(style.borderRightWidth);
       } else {
         offset = parseInt(style.paddingLeft) + parseInt(style.borderLeftWidth);
       }
 
+      offset = Math.round(offset * utils.screenPixelsPerCSSPixel);
+
       position = "after_start";
     }
 
     this.panel.openPopup(element, position, offset, 0);
   }
 };
 
 // Simple gestures support