Bug 1441102 - Move --titlebar-text-color from :root to elements closer to its references. r?florian draft
authorXidorn Quan <me@upsuper.org>
Tue, 06 Mar 2018 12:06:46 +1100
changeset 763474 ada69feecaa3b043c5a6537bdb87cbf54a9b7ed1
parent 763007 232be45cc7936c50810d4888abb50f7906e8aa6f
push id101464
push userxquan@mozilla.com
push dateTue, 06 Mar 2018 01:29:30 +0000
reviewersflorian
bugs1441102
milestone60.0a1
Bug 1441102 - Move --titlebar-text-color from :root to elements closer to its references. r?florian MozReview-Commit-ID: 9FfuRMkudC
browser/base/content/browser.xul
browser/themes/windows/browser-aero.css
browser/themes/windows/browser.css
browser/themes/windows/compacttheme.css
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -580,17 +580,17 @@
   </popupset>
   <box id="appMenu-viewCache" hidden="true"/>
 
 #ifdef CAN_DRAW_IN_TITLEBAR
 <vbox id="titlebar">
   <hbox id="titlebar-content">
     <spacer id="titlebar-spacer" flex="1"/>
     <hbox id="titlebar-buttonbox-container">
-      <hbox id="titlebar-buttonbox">
+      <hbox id="titlebar-buttonbox" class="titlebar-color">
         <toolbarbutton class="titlebar-button" id="titlebar-min" oncommand="window.minimize();"/>
         <toolbarbutton class="titlebar-button" id="titlebar-max" oncommand="onTitlebarMaxClick();"/>
         <toolbarbutton class="titlebar-button" id="titlebar-close" command="cmd_closeWindow"/>
       </hbox>
     </hbox>
 #ifdef XP_MACOSX
     <!-- OS X does not natively support RTL for its titlebar items, so we prevent this secondary
          buttonbox from reversing order in RTL by forcing an LTR direction. -->
@@ -601,17 +601,23 @@
     </hbox>
 #endif
   </hbox>
 </vbox>
 #endif
 
   <toolbox id="navigator-toolbox">
     <!-- Menu -->
-    <toolbar type="menubar" id="toolbar-menubar" class="chromeclass-menubar" customizable="true"
+    <toolbar type="menubar" id="toolbar-menubar"
+#ifdef CAN_DRAW_IN_TITLEBAR
+             class="chromeclass-menubar titlebar-color"
+#else
+             class="chromeclass-menubar"
+#endif
+             customizable="true"
              mode="icons"
 #ifdef MENUBAR_CAN_AUTOHIDE
              toolbarname="&menubarCmd.label;"
              accesskey="&menubarCmd.accesskey;"
              autohide="true"
 #endif
              context="toolbar-context-menu">
       <toolbaritem id="menubar-items" align="center">
@@ -624,16 +630,19 @@
 #ifndef XP_MACOSX
       <hbox class="titlebar-placeholder" type="caption-buttons" ordinal="1000"
             skipintoolbarset="true"/>
 #endif
 #endif
     </toolbar>
 
     <toolbar id="TabsToolbar"
+#ifdef CAN_DRAW_IN_TITLEBAR
+             class="titlebar-color"
+#endif
              fullscreentoolbar="true"
              customizable="true"
              mode="icons"
              aria-label="&tabsToolbar.label;"
              context="toolbar-context-menu"
              collapsed="true">
 
 #ifdef CAN_DRAW_IN_TITLEBAR
--- a/browser/themes/windows/browser-aero.css
+++ b/browser/themes/windows/browser-aero.css
@@ -35,23 +35,27 @@
 
         :root:not(:-moz-lwtheme) {
           background-color: hsl(0, 0%, 78%);
         }
 
         @media (-moz-windows-accent-color-in-titlebar: 0) {
           :root[tabsintitlebar]:not(:-moz-lwtheme) {
             background-color: hsl(235,33%,19%);
+          }
+          :root[tabsintitlebar]:not(:-moz-lwtheme) .titlebar-color {
             --titlebar-text-color: hsl(240,9%,98%);
           }
         }
 
         @media (-moz-windows-accent-color-in-titlebar) {
           :root[tabsintitlebar]:not(:-moz-window-inactive):not(:-moz-lwtheme) {
             background-color: -moz-win-accentcolor;
+          }
+          :root[tabsintitlebar]:not(:-moz-lwtheme) .titlebar-color:not(:-moz-window-inactive) {
             --titlebar-text-color: -moz-win-accentcolortext;
           }
         }
 
         :root[tabsintitlebar] .tab-label:-moz-window-inactive {
           /* Calculated to match the opacity change of Windows Explorer
              titlebar text change for inactive windows. */
           opacity: .6;
@@ -274,17 +278,17 @@
      */
     @media not all and (-moz-os-version: windows-win7) {
       #toolbar-menubar:not(:-moz-lwtheme):-moz-window-inactive {
         color: ThreeDShadow;
       }
     }
   }
 
-  :root[darkwindowframe="true"]:not(:-moz-lwtheme):not(:-moz-window-inactive) {
+  :root[darkwindowframe="true"]:not(:-moz-lwtheme) .titlebar-color:not(:-moz-window-inactive) {
     --titlebar-text-color: white;
   }
 
   /* Show borders on Win 7 & 8, but not on 10 and later: */
   @media (-moz-os-version: windows-win7),
          (-moz-os-version: windows-win8) {
     /* Vertical toolbar border */
     #main-window[sizemode=normal] #navigator-toolbox > toolbar:not(#toolbar-menubar):not(#TabsToolbar):not(:-moz-lwtheme),
--- a/browser/themes/windows/browser.css
+++ b/browser/themes/windows/browser.css
@@ -7,18 +7,16 @@
 @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
 @namespace html url("http://www.w3.org/1999/xhtml");
 
 %include ../shared/browser.inc.css
 %filter substitution
 %define glassShadowColor hsla(240,5%,5%,0.3)
 
 :root {
-  --titlebar-text-color: currentColor;
-
   --toolbar-non-lwt-bgcolor: -moz-dialog;
   --toolbar-non-lwt-textcolor: -moz-dialogtext;
   --toolbar-non-lwt-bgimage: linear-gradient(rgba(255,255,255,.15), rgba(255,255,255,.15));
   --toolbar-bgcolor: var(--toolbar-non-lwt-bgcolor);
   --toolbar-bgimage: var(--toolbar-non-lwt-bgimage);
 
   --toolbarbutton-vertical-text-padding: calc(var(--toolbarbutton-inner-padding) - 1px);
   --toolbarbutton-border-radius: 2px;
@@ -29,16 +27,20 @@
   --arrowpanel-dimmed-further: hsla(0,0%,80%,.45);
   --arrowpanel-dimmed-even-further: hsla(0,0%,80%,.8);
 
   --urlbar-separator-color: ThreeDLightShadow;
 
   --toolbox-border-bottom-color: ThreeDShadow;
 }
 
+.titlebar-color {
+  --titlebar-text-color: currentColor;
+}
+
 #navigator-toolbox {
   --tabs-border-color: threedshadow;
 }
 
 #tabbrowser-tabs {
   --tab-line-color: highlight;
 }
 
@@ -165,21 +167,21 @@
   }
 }
 
 @media (-moz-windows-compositor: 0),
        (-moz-windows-default-theme: 0) {
   /* Please keep the menu text colors in this media block in sync with
    * compacttheme.css, minus the :not(:-moz-lwtheme) condition - see Bug 1165718.
    */
-  :root[tabsintitlebar]:not([inFullscreen]):not(:-moz-lwtheme) {
+  :root[tabsintitlebar]:not([inFullscreen]):not(:-moz-lwtheme) .titlebar-color {
     --titlebar-text-color: CaptionText;
   }
 
-  :root[tabsintitlebar]:not([inFullscreen]):not(:-moz-lwtheme):-moz-window-inactive {
+  :root[tabsintitlebar]:not([inFullscreen]):not(:-moz-lwtheme) .titlebar-color:-moz-window-inactive {
     --titlebar-text-color: InactiveCaptionText;
   }
 }
 
 @media (-moz-windows-compositor: 0) {
   #main-window[tabsintitlebar] #titlebar:-moz-lwtheme {
     visibility: hidden;
   }
--- a/browser/themes/windows/compacttheme.css
+++ b/browser/themes/windows/compacttheme.css
@@ -122,21 +122,21 @@
   #TabsToolbar,
   #navigator-toolbox {
     background-color: transparent;
   }
 
   /* Use proper menu text styling in Win7 classic mode (copied from browser.css) */
   @media (-moz-windows-compositor: 0),
          (-moz-windows-default-theme: 0) {
-    :root[tabsintitlebar]:not([inFullscreen]) {
+    :root[tabsintitlebar]:not([inFullscreen]) .titlebar-color {
       --titlebar-text-color: CaptionText;
     }
 
-    :root[tabsintitlebar]:not([inFullscreen]):-moz-window-inactive {
+    :root[tabsintitlebar]:not([inFullscreen]) .titlebar-color:-moz-window-inactive {
       --titlebar-text-color: InactiveCaptionText;
     }
 
     #main-window[tabsintitlebar] #main-menubar > menu {
       color: inherit;
     }
   }
 }