Bug 1278818 - Convert window coordinates to desktop pixels before passing to ScreenForRect. r=emk, a=sylvestre
authorJonathan Kew <jkew@mozilla.com>
Fri, 10 Jun 2016 17:37:15 +0100
changeset 341676 357a488bdca4688037120f8db30b859bf6c87efe
parent 341675 4ce5bd90da474685cf582e46109cbde62b69bb2d
child 341677 cc0a07b00e380d7cee9ef378c2c38f93c691a991
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk, sylvestre
bugs1278818
milestone49.0a2
Bug 1278818 - Convert window coordinates to desktop pixels before passing to ScreenForRect. r=emk, a=sylvestre
widget/nsBaseWidget.cpp
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -1931,19 +1931,20 @@ nsBaseWidget::GetWidgetScreen()
   nsCOMPtr<nsIScreenManager> screenManager;
   screenManager = do_GetService("@mozilla.org/gfx/screenmanager;1");
   if (!screenManager) {
     return nullptr;
   }
 
   LayoutDeviceIntRect bounds;
   GetScreenBounds(bounds);
+  DesktopIntRect deskBounds = RoundedToInt(bounds / GetDesktopToDeviceScale());
   nsCOMPtr<nsIScreen> screen;
-  screenManager->ScreenForRect(bounds.x, bounds.y,
-                               bounds.width, bounds.height,
+  screenManager->ScreenForRect(deskBounds.x, deskBounds.y,
+                               deskBounds.width, deskBounds.height,
                                getter_AddRefs(screen));
   return screen.forget();
 }
 
 nsresult
 nsIWidget::SynthesizeNativeTouchTap(LayoutDeviceIntPoint aPoint, bool aLongTap,
                                     nsIObserver* aObserver)
 {