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 322293 319960f0619827640e3eee44562bad9f19450444
parent 322292 9f95384e8d21bef0507528f0eea6a445548fc577
child 322294 0b8286662a04cb6b71054a4926b6d0642da75c0d
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
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))
   };