Bug 1622860 - macOS: Use always drawInTitlebar for the Address Book and the composer windows. r=aleca
authorRichard Marti <richard.marti@gmail.com>
Wed, 18 Mar 2020 20:18:25 +0200
changeset 38517 86329202745b8bdcae6aab6f72eacecea96b72bb
parent 38516 eb262dce227553b6afb6fd567e77e273d0c6e40d
child 38518 586f1686ac4ba992fb059603fef073850926e39b
push id400
push userclokep@gmail.com
push dateMon, 04 May 2020 18:56:09 +0000
reviewersaleca
bugs1622860
Bug 1622860 - macOS: Use always drawInTitlebar for the Address Book and the composer windows. r=aleca
mail/components/addrbook/content/addressbook.xhtml
mail/components/compose/content/MsgComposeCommands.js
mail/components/compose/content/messengercompose.xhtml
mail/themes/osx/mail/addrbook/addressbook.css
mail/themes/osx/mail/compose/messengercompose.css
mail/themes/osx/mail/messenger.css
--- a/mail/components/addrbook/content/addressbook.xhtml
+++ b/mail/components/addrbook/content/addressbook.xhtml
@@ -19,22 +19,25 @@
 ]>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     xmlns:html="http://www.w3.org/1999/xhtml"
     id="addressbookWindow"
     icon="addressbookWindow"
     title="&addressbookWindow.title;"
     windowtype="mail:addressbook"
-    macanimationtype="document"
     persist="width height screenX screenY sizemode"
     toggletoolbar="true"
     onload="OnLoadAddressBook()"
     onunload="OnUnloadAddressBook()"
     lightweightthemes="true"
+#ifdef XP_MACOSX
+    macanimationtype="document"
+    chromemargin="0,-1,-1,-1"
+#endif
     fullscreenbutton="true">
 
   <stringbundle id="bundle_addressBook" src="chrome://messenger/locale/addressbook/addressBook.properties"/>
   <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
   <stringbundle id="bundle_brand" src="chrome://branding/locale/brand.properties"/>
 
   <linkset>
     <html:link rel="localization" href="toolkit/global/textActions.ftl"/>
@@ -245,42 +248,44 @@
            onpopupshowing="onViewToolbarsPopupShowing(event, 'ab-toolbox');">
   <menuseparator id="customizeABToolbarMenuSeparator"/>
   <menuitem id="CustomizeABToolbar"
             command="cmd_CustomizeABToolbar"
             label="&customizeToolbar.label;"
             accesskey="&customizeToolbar.accesskey;"/>
 </menupopup>
 
-#ifdef XP_MACOSX
-<vbox id="titlebar">
-  <hbox id="titlebar-content">
-    <spacer id="titlebar-spacer" flex="1"/>
-    <hbox id="titlebar-buttonbox-container" align="start">
-      <hbox id="titlebar-buttonbox">
-        <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" oncommand="window.close()"/>
-      </hbox>
-    </hbox>
-    <hbox id="titlebar-fullscreen-button"/>
-  </hbox>
-</vbox>
-#endif
 
 <toolbox id="ab-toolbox"
          class="toolbox-top"
          mode="full"
          defaultmode="full"
 #ifdef XP_MACOSX
          iconsize="small"
          defaulticonsize="small"
 #endif
          labelalign="end"
          defaultlabelalign="end">
+#ifdef XP_MACOSX
+  <vbox id="titlebar">
+    <hbox id="titlebar-content">
+      <hbox id="titlebar-buttonbox-container" align="start">
+        <hbox id="titlebar-buttonbox">
+          <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" oncommand="window.close()"/>
+        </hbox>
+      </hbox>
+      <hbox id="titlebar-title" align="center" flex="1">
+        <label id="titlebar-title-label" value="&addressbookWindow.title;" flex="1"/>
+      </hbox>
+      <hbox id="titlebar-fullscreen-button"/>
+    </hbox>
+  </vbox>
+#endif
   <toolbar is="customizable-toolbar" id="addrbook-toolbar-menubar2"
            class="chromeclass-menubar"
            type="menubar"
            customizable="true"
 #ifdef XP_MACOSX
            defaultset="menubar-items"
 #else
           defaultset="menubar-items,spring"
--- a/mail/components/compose/content/MsgComposeCommands.js
+++ b/mail/components/compose/content/MsgComposeCommands.js
@@ -5180,16 +5180,19 @@ function SetComposeWindowTitle(isPrintPr
     getComposeBundle().getString("defaultSubject");
   let brandBundle = document.getElementById("brandBundle");
   let brandShortName = brandBundle.getString("brandShortName");
   let newTitle = getComposeBundle().getFormattedString(aStringName, [
     subject,
     brandShortName,
   ]);
   document.title = newTitle;
+  if (AppConstants.platform == "macosx") {
+    document.getElementById("titlebar-title-label").value = newTitle;
+  }
 }
 
 // Check for changes to document and allow saving before closing
 // This is hooked up to the OS's window close widget (e.g., "X" for Windows)
 function ComposeCanClose() {
   // No open compose window?
   if (!gMsgCompose) {
     return true;
--- a/mail/components/compose/content/messengercompose.xhtml
+++ b/mail/components/compose/content/messengercompose.xhtml
@@ -39,20 +39,23 @@
         xmlns:html="http://www.w3.org/1999/xhtml"
         icon="msgcomposeWindow"
         onunload="ComposeUnload()"
         onload="ComposeLoad()"
         onclose="return DoCommandClose()"
         onfocus="EditorOnFocus()"
         title="&msgComposeWindow.title;"
         windowtype="msgcompose"
-        macanimationtype="document"
         toggletoolbar="true"
         persist="screenX screenY width height sizemode"
         lightweightthemes="true"
+#ifdef XP_MACOSX
+        macanimationtype="document"
+        chromemargin="0,-1,-1,-1"
+#endif
         fullscreenbutton="true">
 
   <stringbundle id="bundle_composeMsgs" src="chrome://messenger/locale/messengercompose/composeMsgs.properties"/>
   <stringbundle id="bundle_messenger" src="chrome://messenger/locale/messenger.properties"/>
   <stringbundle id="brandBundle" src="chrome://branding/locale/brand.properties"/>
   <stringbundle id="bundle_comp_smime" src="chrome://messenger-smime/locale/msgCompSMIMEOverlay.properties"/>
   <stringbundle id="charsetBundle" src="chrome://communicator/content/labelsencodings.properties"/>
 
@@ -795,42 +798,43 @@
             data-l10n-id="pill-action-move-cc"
             oncommand="moveSelectedPills(document.popupNode, 'addr_cc')"/>
   <menuitem id="moveAddressPillBcc"
             class="pill-action-move"
             data-l10n-id="pill-action-move-bcc"
             oncommand="moveSelectedPills(document.popupNode, 'addr_bcc')"/>
 </menupopup>
 
-#ifdef XP_MACOSX
-  <vbox id="titlebar">
-    <hbox id="titlebar-content">
-      <spacer id="titlebar-spacer" flex="1"/>
-      <hbox id="titlebar-buttonbox-container" align="start">
-        <hbox id="titlebar-buttonbox">
-          <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" oncommand="window.close()"/>
-        </hbox>
-      </hbox>
-      <hbox id="titlebar-fullscreen-button"/>
-    </hbox>
-  </vbox>
-#endif
-
   <toolbox id="compose-toolbox"
            class="toolbox-top"
            mode="full"
            defaultmode="full"
 #ifdef XP_MACOSX
            iconsize="small"
            defaulticonsize="small"
 #endif
            labelalign="end"
            defaultlabelalign="end">
+#ifdef XP_MACOSX
+  <vbox id="titlebar">
+    <hbox id="titlebar-content">
+      <hbox id="titlebar-buttonbox-container" align="start">
+        <hbox id="titlebar-buttonbox">
+          <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" oncommand="window.close()"/>
+        </hbox>
+      </hbox>
+      <hbox id="titlebar-title" align="center" flex="1">
+        <label id="titlebar-title-label" value="&msgComposeWindow.title;" flex="1"/>
+      </hbox>
+      <hbox id="titlebar-fullscreen-button"/>
+    </hbox>
+  </vbox>
+#endif
 
   <!-- Menu -->
   <!-- if you change the id of the menubar, be sure to update mailCore.js::CustomizeMailToolbar and MailToolboxCustomizeDone -->
   <toolbar is="customizable-toolbar" id="compose-toolbar-menubar2"
            class="chromeclass-menubar"
            type="menubar"
            customizable="true"
 #ifdef XP_MACOSX
--- a/mail/themes/osx/mail/addrbook/addressbook.css
+++ b/mail/themes/osx/mail/addrbook/addressbook.css
@@ -5,17 +5,19 @@
 /* ===== addressbook.css ================================================
   == Styles for the main Address Book window.
   ======================================================================= */
 
 @import url("chrome://messenger/skin/");
 @import url("chrome://messenger/skin/shared/addressbook.css");
 
 #ab-bar2 {
-  padding: 0 4px;
+  /* Cover the titlebar with the toolbox background */
+  margin-top: -22px;
+  padding: 22px 4px 0;
 }
 
 #ab-toolbox:-moz-lwtheme {
   -moz-appearance: none;
 }
 
 #ab-toolbox:-moz-lwtheme::before {
   content: "";
@@ -194,19 +196,25 @@
 
 #cvHomeMapIt,
 #cvWorkMapIt {
   margin-bottom: 0px;
   min-height: 19px; /* aqua size for small buttons */
 }
 
 #titlebar {
-  display: none;
+  height: 22px;
 }
 
 #titlebar-buttonbox-container {
   margin-top: 3px;
   margin-inline-start: 7px;
 }
 
-#titlebar-spacer {
-  display: -moz-box;
+#titlebar-buttonbox {
+  margin-inline: 0;
 }
+
+#titlebar-title {
+  text-align: center;
+  /* Equalize  the titlebar-buttonbox width */
+  padding-inline-end: 60px;
+}
--- a/mail/themes/osx/mail/compose/messengercompose.css
+++ b/mail/themes/osx/mail/compose/messengercompose.css
@@ -48,17 +48,19 @@
   border-bottom-color: rgba(0,0,0,0.35);
 }
 
 #compose-toolbox > toolbar:not(:-moz-lwtheme) {
   background-color: #cfcfcf;
 }
 
 #composeToolbar2 {
-  padding: 0 4px;
+  /* Cover the titlebar with the toolbox background */
+  margin-top: -22px;
+  padding: 22px 4px 0;
 }
 
 toolbar[nowindowdrag="true"] {
   -moz-appearance: none;
 }
 
 /* Findbar */
 .findbar-container {
@@ -924,24 +926,34 @@ toolbarbutton.toolbarbutton-1 > .toolbar
 }
 
 #sidebar-title {
   font: icon;
   color: #000;
 }
 
 #titlebar {
-  display: none;
+  height: 22px;
 }
 
 #titlebar-buttonbox-container {
   margin-top: 3px;
   margin-inline-start: 7px;
 }
 
+#titlebar-buttonbox {
+  margin-inline: 0;
+}
+
+#titlebar-title {
+  text-align: center;
+  /* Equalize  the titlebar-buttonbox width */
+  padding-inline-end: 60px;
+}
+
 /* Styles for the default system dark theme */
 
 :root[lwt-default-theme-in-dark-mode] #headers-box {
   -moz-appearance: none;
 }
 
 :root[lwt-default-theme-in-dark-mode] #FormatToolbar {
   background-image: none;
--- a/mail/themes/osx/mail/messenger.css
+++ b/mail/themes/osx/mail/messenger.css
@@ -571,24 +571,22 @@ treecol.treecol-image:hover:active {
 #messengerWindow:not([tabsintitlebar]) .titlebar-placeholder {
   visibility: collapse;
 }
 
 /* NB: these would be margin-inline-start/end if it wasn't for the fact that OS X
  * doesn't reverse the order of the items in the titlebar in RTL mode. */
 .titlebar-placeholder[type="caption-buttons"],
 #titlebar-buttonbox {
-  margin-right: 12px;
-  margin-left: 12px;
+  margin-inline: 12px;
 }
 
 .titlebar-placeholder[type="fullscreen-button"],
 #titlebar-fullscreen-button {
-  margin-right: 7px;
-  margin-left: 7px;
+  margin-inline: 7px;
 }
 
 #titlebar-fullscreen-button {
   -moz-appearance: -moz-mac-fullscreen-button;
 }
 
 #titlebar-buttonbox {
   -moz-appearance: -moz-window-button-box;