Bug 902175 - [New Tab Page] Fix drag/drop tests on Retina displays r=jaws
authorTim Taubert <ttaubert@mozilla.com>
Thu, 08 Aug 2013 01:47:29 +0200
changeset 154587 760c16523e4da865f5611b5c67eeb842b13db232
parent 154586 b4dd81559271785c8972e60314a71a34b8df3f56
child 154588 7edbd10a7d034b4d8e34ba2324893f046a60bd0c
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs902175
milestone26.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 902175 - [New Tab Page] Fix drag/drop tests on Retina displays r=jaws
browser/base/content/test/newtab/head.js
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -460,19 +460,21 @@ function synthesizeNativeMouseMove(aElem
  * @param aOffsetY The top offset that is added to the position (optional).
  */
 function synthesizeNativeMouseEvent(aElement, aMsg, aOffsetX = 0, aOffsetY = 0) {
   let rect = aElement.getBoundingClientRect();
   let win = aElement.ownerDocument.defaultView;
   let x = aOffsetX + win.mozInnerScreenX + rect.left + rect.width / 2;
   let y = aOffsetY + win.mozInnerScreenY + rect.top + rect.height / 2;
 
-  win.QueryInterface(Ci.nsIInterfaceRequestor)
-     .getInterface(Ci.nsIDOMWindowUtils)
-     .sendNativeMouseEvent(x, y, aMsg, 0, null);
+  let utils = win.QueryInterface(Ci.nsIInterfaceRequestor)
+                 .getInterface(Ci.nsIDOMWindowUtils);
+
+  let scale = utils.screenPixelsPerCSSPixel;
+  utils.sendNativeMouseEvent(x * scale, y * scale, aMsg, 0, null);
 }
 
 /**
  * Sends a custom drag event to a given DOM element.
  * @param aEventType The drag event's type.
  * @param aTarget The DOM element that the event is dispatched to.
  * @param aData The event's drag data (optional).
  */