Bug 1253446 - patch 1 - Convert from device to CSS pixels when positioning the webrtc indicator. r=emk
authorJonathan Kew <jkew@mozilla.com>
Fri, 04 Mar 2016 16:12:40 +0000
changeset 323209 2a06c1a146e16a369ab3648e184d9e3311362395
parent 323208 bca82ee20a78bcb93c0ae72885e461ded33fbcb0
child 323210 431e74ed28d9ebbbe01ed7278efa79b6dd8db5aa
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk
bugs1253446
milestone47.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 1253446 - patch 1 - Convert from device to CSS pixels when positioning the webrtc indicator. r=emk
browser/base/content/webrtcIndicator.js
--- a/browser/base/content/webrtcIndicator.js
+++ b/browser/base/content/webrtcIndicator.js
@@ -135,22 +135,24 @@ var PositionHandler = {
   adjustPosition: function() {
     if (!this.positionCustomized) {
       // Center the window horizontally on the screen (not the available area).
       // Until we have moved the window to y=0, 'screen.width' may give a value
       // for a secondary screen, so use values from the screen manager instead.
       let primaryScreen = Cc["@mozilla.org/gfx/screenmanager;1"]
                             .getService(Ci.nsIScreenManager)
                             .primaryScreen;
-      let width = {};
-      primaryScreen.GetRectDisplayPix({}, {}, width, {});
-      let availTop = {};
-      primaryScreen.GetAvailRectDisplayPix({}, availTop, {}, {});
-      window.moveTo((width.value - document.documentElement.clientWidth) / 2,
-                    availTop.value);
+      let widthDevPix = {};
+      primaryScreen.GetRect({}, {}, widthDevPix, {});
+      let availTopDevPix = {};
+      primaryScreen.GetAvailRect({}, availTopDevPix, {}, {});
+      let scaleFactor = primaryScreen.defaultCSSScaleFactor;
+      let widthCss = widthDevPix.value / scaleFactor;
+      window.moveTo((widthCss - document.documentElement.clientWidth) / 2,
+                    availTopDevPix.value / scaleFactor);
     } else {
       // This will ensure we're at y=0.
       this.setXPosition(window.screenX);
     }
   },
   setXPosition: function(desiredX) {
     // Ensure the indicator isn't moved outside the available area of the screen.
     desiredX = Math.max(desiredX, screen.availLeft);