Bug 1425370 - Fix DPI scaling for mozscreenshots. r?mattn
MozReview-Commit-ID: LjmcLImLx0d
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/TestRunner.jsm
@@ -200,19 +200,20 @@ this.TestRunner = {
if (!selectors.length) {
throw "No selectors specified.";
}
// Set window type, default "navigator:browser"
windowType = windowType || "navigator:browser";
let browserWindow = Services.wm.getMostRecentWindow(windowType);
// Scale for high-density displays
- const scale = browserWindow.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDocShell).QueryInterface(Ci.nsIBaseWindow)
- .devicePixelsPerDesktopPixel;
+ const scale = Cc["@mozilla.org/gfx/screenmanager;1"]
+ .getService(Ci.nsIScreenManager)
+ .screenForRect(browserWindow.screenX, browserWindow.screenY, 1, 1)
+ .defaultCSSScaleFactor;
const windowLeft = browserWindow.screenX * scale;
const windowTop = browserWindow.screenY * scale;
const windowWidth = browserWindow.outerWidth * scale;
const windowHeight = browserWindow.outerHeight * scale;
let bounds;
const rects = [];