Bug 1265977 - Use the suggested window coordinates from WM_DPICHANGED, without trying to improve them to maintain window client size. r=emk a=ritu
authorJonathan Kew <jkew@mozilla.com>
Wed, 20 Apr 2016 11:45:31 +0100
changeset 324103 fe2a38edd4ab61bd711e096ef58d8ac17aef5961
parent 324102 17cf0270b19091b1a56b01ab940f66c830fe0b09
child 324104 3c3cb171a6ccc6dbda66bf513b0d33e131d6cfea
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, ritu
bugs1265977
milestone47.0a2
Bug 1265977 - Use the suggested window coordinates from WM_DPICHANGED, without trying to improve them to maintain window client size. r=emk a=ritu
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6894,33 +6894,16 @@ nsWindow::OnDPIChanged(int32_t x, int32_
   if (DefaultScaleOverride() > 0.0) {
     return;
   }
   double oldScale = mDefaultScale;
   mDefaultScale = -1.0; // force recomputation of scale factor
   double newScale = GetDefaultScaleInternal();
 
   if (mResizeState != RESIZING && mSizeMode == nsSizeMode_Normal) {
-    // We want to try and maintain the size of the client area, rather than
-    // the overall size of the window including non-client area, so we prefer
-    // to calculate the new size instead of using Windows' suggested values.
-    if (oldScale > 0.0) {
-      double ratio = newScale / oldScale;
-      LayoutDeviceIntRect cr, sr;
-      GetClientBounds(cr);
-      GetScreenBounds(sr);
-      int32_t w = sr.width - cr.width + NSToIntRound(cr.width * ratio);
-      int32_t h = sr.height - cr.height + NSToIntRound(cr.height * ratio);
-      // Adjust x and y to preserve the center point of the suggested rect.
-      x -= (w - width) / 2;
-      y -= (h - height) / 2;
-      width = w;
-      height = h;
-    }
-
     // Limit the position (if not in the middle of a drag-move) & size,
     // if it would overflow the destination screen
     nsCOMPtr<nsIScreenManager> sm = do_GetService(sScreenManagerContractID);
     if (sm) {
       nsCOMPtr<nsIScreen> screen;
       sm->ScreenForRect(x, y, width, height, getter_AddRefs(screen));
       if (screen) {
         int32_t availLeft, availTop, availWidth, availHeight;