Bug 1320531 - Check whether DPI appears to have changed before calling ChangedDPI + ResetLayout while dragging windows. r=emk
authorJonathan Kew <jkew@mozilla.com>
Tue, 31 Jan 2017 20:54:23 +0000
changeset 332252 0159e55566c4c4b341ca6fc368b27a49f5c5a5a8
parent 332251 256d02d844e094580d201d06b06ddfe50837f762
child 332253 8a44f5ca07bb359d6b38ef0f355b2dd148298f2e
push id31300
push userkwierso@gmail.com
push dateFri, 03 Feb 2017 00:39:30 +0000
treeherdermozilla-central@c8102da699db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk
bugs1320531
milestone54.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 1320531 - Check whether DPI appears to have changed before calling ChangedDPI + ResetLayout while dragging windows. r=emk
widget/windows/nsWindow.cpp
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -5648,23 +5648,26 @@ nsWindow::ProcessMessage(UINT msg, WPARA
       }
       break;
     }
 
     case WM_MOVING:
       FinishLiveResizing(MOVING);
       if (WinUtils::IsPerMonitorDPIAware()) {
         // Sometimes, we appear to miss a WM_DPICHANGED message while moving
-        // a window around. Therefore, call ChangedDPI and ResetLayout here,
-        // which causes the prescontext and appshell window management code to
+        // a window around. Therefore, call ChangedDPI and ResetLayout here
+        // if it appears that the window's scaling is not what we expect.
+        // This causes the prescontext and appshell window management code to
         // check the appUnitsPerDevPixel value and current widget size, and
         // refresh them if necessary. If nothing has changed, these calls will
         // return without actually triggering any extra reflow or painting.
-        ChangedDPI();
-        ResetLayout();
+        if (WinUtils::LogToPhysFactor(mWnd) != mDefaultScale) {
+          ChangedDPI();
+          ResetLayout();
+        }
       }
       break;
 
     case WM_ENTERSIZEMOVE:
     {
       if (mResizeState == NOT_RESIZING) {
         mResizeState = IN_SIZEMOVE;
       }