Bug 1267636 - Adjust window titlebar metrics scaling on Win10 to improve the appearance of DevEdition and similar themes on a secondary lo-dpi display. r=emk a=sledru
authorJonathan Kew <jkew@mozilla.com>
Tue, 17 May 2016 15:35:58 +0100
changeset 332941 ca41d290daa081865b50f2434aabe15c9fd7ae66
parent 332940 c41ee7132426780f38bbffc58435548d92d2b327
child 332942 9c96e9ec8e42fd75c62030c6840c6dc23478a07f
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemk, sledru
bugs1267636
milestone48.0a2
Bug 1267636 - Adjust window titlebar metrics scaling on Win10 to improve the appearance of DevEdition and similar themes on a secondary lo-dpi display. r=emk a=sledru
widget/windows/nsNativeThemeWin.cpp
--- a/widget/windows/nsNativeThemeWin.cpp
+++ b/widget/windows/nsNativeThemeWin.cpp
@@ -2496,16 +2496,25 @@ nsNativeThemeWin::GetMinimumWidgetSize(n
       *aIsOverridable = false;
       return rv;
 
     case NS_THEME_WINDOW_TITLEBAR:
     case NS_THEME_WINDOW_TITLEBAR_MAXIMIZED:
       aResult->height = GetSystemMetrics(SM_CYCAPTION);
       aResult->height += GetSystemMetrics(SM_CYFRAME);
       aResult->height += GetSystemMetrics(SM_CXPADDEDBORDER);
+      // On Win8.1, we don't want this scaling, because Windows doesn't scale
+      // the non-client area of the window, and we can end up with ugly overlap
+      // of the window frame controls into the tab bar or content area. But on
+      // Win10, we render the window controls ourselves, and the result looks
+      // better if we do apply this scaling (particularly with themes such as
+      // DevEdition; see bug 1267636).
+      if (IsWin10OrLater()) {
+        ScaleForFrameDPI(aResult, aFrame);
+      }
       *aIsOverridable = false;
       return rv;
 
     case NS_THEME_WINDOW_BUTTON_BOX:
     case NS_THEME_WINDOW_BUTTON_BOX_MAXIMIZED:
       if (nsUXThemeData::CheckForCompositor()) {
         aResult->width = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_BUTTONBOX].cx;
         aResult->height = nsUXThemeData::sCommandButtons[CMDBUTTONIDX_BUTTONBOX].cy