Bug 1486202 - Follow-up for ESR: move LW-backgroundBox calculation. r=Paenglab a=jorgk BETA_60_CONTINUATION
authorJorg K <jorgk@jorgk.com>
Fri, 31 Aug 2018 23:37:52 +0200
branchBETA_60_CONTINUATION
changeset 32457 b8fb9bf3792f
parent 32456 65b4b82776c4
child 32458 9c11a5d238e1
push id385
push userclokep@gmail.com
push dateTue, 04 Sep 2018 23:26:14 +0000
reviewersPaenglab, jorgk
bugs1486202
Bug 1486202 - Follow-up for ESR: move LW-backgroundBox calculation. r=Paenglab a=jorgk
mail/base/content/msgMail3PaneWindow.js
--- a/mail/base/content/msgMail3PaneWindow.js
+++ b/mail/base/content/msgMail3PaneWindow.js
@@ -1907,26 +1907,16 @@ var TabsInTitlebar = {
         titlebarContent.style.removeProperty("margin-bottom");
       }
 
       // Then add a negative margin to the titlebar, so that the following elements
       // will overlap it by the greater of the titlebar height or the tabstrip+menu.
       let maxTitlebarOrTabsHeight = Math.max(titlebarContentHeight, tabAndMenuHeight);
       titlebar.style.marginBottom = "-" + maxTitlebarOrTabsHeight + "px";
 
-      // Calculate the LW-backgroundBox height to place the images correctly.
-      let root = $("messengerWindow");
-      let bgBox = $("LW-background-box");
-      if (root.getAttribute("lwtheme-image")) {
-        let bgBoxHeight = rect($("navigation-toolbox")).height + rect($("mail-toolbox")).height;
-        bgBox.style.height = bgBoxHeight + "px";
-      } else {
-        bgBox.style.removeProperty("height");
-      }
-
       // Finally, size the placeholders:
       if (AppConstants.platform == "macosx") {
         this._sizePlaceholder("fullscreen-button", secondaryButtonsWidth);
       }
 
       this._sizePlaceholder("caption-buttons", captionButtonsBoxWidth);
 
     } else {
@@ -1967,16 +1957,28 @@ if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
         document.documentElement.setAttribute("drawtitle", "true");
       }
     } else if (TabsInTitlebar.enabled) {
       // not OS X
       document.documentElement.setAttribute("chromemargin", "0,2,2,2");
     } else {
       document.documentElement.removeAttribute("chromemargin");
     }
+
+    // Calculate the LW-backgroundBox height to place the images correctly.
+    let $ = id => document.getElementById(id);
+    let rect = ele => ele.getBoundingClientRect();
+    let root = $("messengerWindow");
+    let bgBox = $("LW-background-box");
+    if (root.getAttribute("lwtheme-image")) {
+      let bgBoxHeight = rect($("navigation-toolbox")).height + rect($("mail-toolbox")).height;
+      bgBox.style.height = bgBoxHeight + "px";
+    } else {
+      bgBox.style.removeProperty("height");
+    }
   }
 }
 
 /* Draw */
 function onTitlebarMaxClick() {
   if (window.windowState == window.STATE_MAXIMIZED)
     window.restore();
   else