Bug 1251624 - patch 1 - The desktop to device scaling in WinUtils::MonitorFromRect should not depend on custom CSS pixel scaling (devPixelsPerPx setting). r=emk
authorJonathan Kew <jkew@mozilla.com>
Sat, 27 Feb 2016 15:37:31 +0000
changeset 324196 319960f0619827640e3eee44562bad9f19450444
parent 324195 9f95384e8d21bef0507528f0eea6a445548fc577
child 324197 0b8286662a04cb6b71054a4926b6d0642da75c0d
push id1128
push userjlund@mozilla.com
push dateWed, 01 Jun 2016 01:31:59 +0000
treeherdermozilla-release@fe0d30de989d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk
bugs1251624
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 1251624 - patch 1 - The desktop to device scaling in WinUtils::MonitorFromRect should not depend on custom CSS pixel scaling (devPixelsPerPx setting). r=emk
widget/windows/WinUtils.cpp
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -644,25 +644,19 @@ WinUtils::GetPrimaryMonitor()
   const POINT pt = { 0, 0 };
   return ::MonitorFromPoint(pt, MONITOR_DEFAULTTOPRIMARY);
 }
 
 /* static */
 HMONITOR
 WinUtils::MonitorFromRect(const gfx::Rect& rect)
 {
-  // convert coordinates from logical to device pixels for MonitorFromRect
-  double dpiScale = nsIWidget::DefaultScaleOverride();
-  if (dpiScale <= 0.0) {
-    if (IsPerMonitorDPIAware()) {
-      dpiScale = 1.0;
-    } else {
-      dpiScale = LogToPhysFactor(GetPrimaryMonitor());
-    }
-  }
+  // convert coordinates from desktop to device pixels for MonitorFromRect
+  double dpiScale =
+    IsPerMonitorDPIAware() ? 1.0 : LogToPhysFactor(GetPrimaryMonitor());
 
   RECT globalWindowBounds = {
     NSToIntRound(dpiScale * rect.x),
     NSToIntRound(dpiScale * rect.y),
     NSToIntRound(dpiScale * (rect.x + rect.width)),
     NSToIntRound(dpiScale * (rect.y + rect.height))
   };