Bug 1375335 - Always set custom titlebar buttonbox height. r=dao draft
authorJohann Hofmann <jhofmann@mozilla.com>
Mon, 24 Jul 2017 15:34:57 +0200
changeset 616698 0afab83fde6f563cce77d1a82510c4076290ece1
parent 616647 e5693cea1ec944ca077c7a46c5f127c828a90f1b
child 639571 a46172742ed36a139f76183d1e7789bc2fdd29f4
push id70788
push userbmo:jhofmann@mozilla.com
push dateThu, 27 Jul 2017 12:08:24 +0000
reviewersdao
bugs1375335
milestone56.0a1
Bug 1375335 - Always set custom titlebar buttonbox height. r=dao Resetting this height after calculating dimensions causes the menu items to end up too high and makes the window controls resize awkwardly when showing the menu bar in maximized mode. To make things consistent we could always set the window controls to the correct height and adjust the padding to avoid squeezing the icons. MozReview-Commit-ID: CSiuwoP8d4S
browser/base/content/browser-tabsintitlebar.js
browser/themes/windows/browser-aero.css
--- a/browser/base/content/browser-tabsintitlebar.js
+++ b/browser/base/content/browser-tabsintitlebar.js
@@ -171,23 +171,23 @@ var TabsInTitlebar = {
         fullMenuHeight = verticalMargins(menuStyles) + menuHeight;
       }
 
       // And get the height of what's in the titlebar:
       let titlebarContentHeight = rect(titlebarContent).height;
 
       // Begin setting CSS properties which will cause a reflow
 
+      // On Windows 10, adjust the window controls to span the entire
+      // tab strip height if we're not showing a menu bar.
       if (AppConstants.MOZ_PHOTON_THEME &&
           AppConstants.isPlatformAndVersionAtLeast("win", "10.0")) {
-        if (!menuHeight && window.windowState == window.STATE_MAXIMIZED) {
+        if (!menuHeight) {
           titlebarContentHeight = Math.max(titlebarContentHeight, fullTabsHeight);
           $("titlebar-buttonbox").style.height = titlebarContentHeight + "px";
-        } else {
-          $("titlebar-buttonbox").style.removeProperty("height");
         }
       }
 
       // If the menubar is around (menuHeight is non-zero), try to adjust
       // its full height (i.e. including margins) to match the titlebar,
       // by changing the menubar's bottom padding
       if (menuHeight) {
         // Calculate the difference between the titlebar's height and that of the menubar
--- a/browser/themes/windows/browser-aero.css
+++ b/browser/themes/windows/browser-aero.css
@@ -86,17 +86,17 @@
       #titlebar-buttonbox,
       .titlebar-button {
         -moz-appearance: none !important;
       }
 
       .titlebar-button {
         border: none;
         margin: 0 !important;
-        padding: 10px 17px;
+        padding: 8px 17px;
         -moz-context-properties: stroke;
 %ifdef MOZ_PHOTON_THEME
         stroke: var(--titlebar-text-color);
 %else
         stroke: black;
 %endif
       }