Bug 1344307 - Clean up lightweight theme footer handling. r=jaws
authorDão Gottwald <dao@mozilla.com>
Fri, 03 Mar 2017 19:41:28 +0100
changeset 345891 e5b4f79727c81b0fc784f3c781d70af4fb376a35
parent 345890 2eef7989fbb6c2b9237be607c86a6c2e7660fdc0
child 345892 c2aac9615aa424c3478c83d959564a6e4ffe7c24
push id31451
push usercbook@mozilla.com
push dateMon, 06 Mar 2017 09:52:09 +0000
treeherdermozilla-central@7099e03837e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws
bugs1344307
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1344307 - Clean up lightweight theme footer handling. r=jaws MozReview-Commit-ID: BIUszE69HhH
browser/base/content/browser.css
browser/base/content/browser.xul
toolkit/modules/LightweightThemeConsumer.jsm
toolkit/themes/linux/global/global.css
toolkit/themes/osx/global/global.css
toolkit/themes/windows/global/global.css
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -446,21 +446,21 @@ toolbar:not(#TabsToolbar) > #personal-bo
 }
 
 %ifdef XP_MACOSX
 #main-window[inFullscreen="true"] {
   padding-top: 0; /* override drawintitlebar="true" */
 }
 %endif
 
-#browser-bottombox[lwthemefooter="true"] {
+:root[lwthemefooter=true] #browser-bottombox:-moz-lwtheme {
   background-repeat: no-repeat;
   background-position: bottom left;
   background-color: var(--lwt-accent-color);
-  background-image: var(--lwt-header-image);
+  background-image: var(--lwt-footer-image);
 }
 
 .menuitem-iconic-tooltip {
   -moz-binding: url("chrome://browser/content/urlbarBindings.xml#menuitem-iconic-tooltip");
 }
 
 /* Hide menu elements intended for keyboard access support */
 #main-menubar[openedwithkey=false] .show-only-for-keyboard {
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -47,17 +47,16 @@
         chromemargin="0,2,2,2"
 #else
         chromemargin="0,-1,-1,-1"
 #endif
         tabsintitlebar="true"
 #endif
         titlemenuseparator="&mainWindow.titlemodifiermenuseparator;"
         lightweightthemes="true"
-        lightweightthemesfooter="browser-bottombox"
         windowtype="navigator:browser"
         macanimationtype="document"
         screenX="4" screenY="4"
         fullscreenbutton="true"
         sizemode="normal"
         retargetdocumentfocus="urlbar"
         persist="screenX screenY width height sizemode">
 
--- a/toolkit/modules/LightweightThemeConsumer.jsm
+++ b/toolkit/modules/LightweightThemeConsumer.jsm
@@ -12,17 +12,16 @@ Cu.import("resource://gre/modules/AppCon
 
 XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeImageOptimizer",
   "resource://gre/modules/addons/LightweightThemeImageOptimizer.jsm");
 
 this.LightweightThemeConsumer =
  function LightweightThemeConsumer(aDocument) {
   this._doc = aDocument;
   this._win = aDocument.defaultView;
-  this._footerId = aDocument.documentElement.getAttribute("lightweightthemesfooter");
 
   let screen = this._win.screen;
   this._lastScreenWidth = screen.width;
   this._lastScreenHeight = screen.height;
 
   Services.obs.addObserver(this, "lightweight-theme-styling-update", false);
 
   var temp = {};
@@ -118,25 +117,22 @@ LightweightThemeConsumer.prototype = {
       root.setAttribute("lwtheme", "true");
     } else {
       root.removeAttribute("lwthemetextcolor");
       root.removeAttribute("lwtheme");
     }
 
     this._active = active;
 
-    _setImage(root, active, aData.headerURL, "--lwt-header-image");
-    if (this._footerId) {
-      let footer = this._doc.getElementById(this._footerId);
-      _setImage(footer, active, aData.footerURL, "--lwt-footer-image");
-      if (active && aData.footerURL)
-        footer.setAttribute("lwthemefooter", "true");
-      else
-        footer.removeAttribute("lwthemefooter");
-    }
+    _setImage(root, active, "--lwt-header-image", aData.headerURL);
+    _setImage(root, active, "--lwt-footer-image", aData.footerURL);
+    if (active && aData.footerURL)
+      root.setAttribute("lwthemefooter", "true");
+    else
+      root.removeAttribute("lwthemefooter");
 
     // On OS X, we extend the lightweight theme into the titlebar, which means setting
     // the chromemargin attribute. Some XUL applications already draw in the titlebar,
     // so we need to save the chromemargin value before we overwrite it with the value
     // that lets us draw in the titlebar. We stash this value on the root attribute so
     // that XUL applications have the ability to invalidate the saved value.
     if (AppConstants.platform == "macosx" && stateChanging) {
       if (!root.hasAttribute("chromemargin-nonlwtheme")) {
@@ -154,21 +150,21 @@ LightweightThemeConsumer.prototype = {
         }
       }
     }
     Services.obs.notifyObservers(this._win, "lightweight-theme-window-updated",
                                  JSON.stringify(aData));
   }
 }
 
-function _setImage(aElement, aActive, aURL, aVariableName) {
+function _setImage(aRoot, aActive, aVariableName, aURL) {
   if (aActive && aURL) {
-    aElement.style.setProperty(aVariableName, `url("${aURL.replace(/"/g, '\\"')}")`);
+    aRoot.style.setProperty(aVariableName, `url("${aURL.replace(/"/g, '\\"')}")`);
   } else {
-    aElement.style.removeProperty(aVariableName);
+    aRoot.style.removeProperty(aVariableName);
   }
 }
 
 function _parseRGB(aColorString) {
   var rgb = aColorString.match(/^rgba?\((\d+), (\d+), (\d+)/);
   rgb.shift();
   return rgb.map(x => parseInt(x));
 }
--- a/toolkit/themes/linux/global/global.css
+++ b/toolkit/themes/linux/global/global.css
@@ -150,17 +150,16 @@ sidebarheader > label {
 toolbar[mode="text"] .toolbarbutton-text {
   padding: 0 !important;
   margin: 3px 5px !important;
 }
 
 /* ::::: miscellaneous formatting ::::: */
 
 :root:-moz-lwtheme,
-[lwthemefooter="true"],
 statusbarpanel:-moz-lwtheme {
   -moz-appearance: none;
 }
 
 sidebarheader:-moz-lwtheme {
   background: none;
 }
 
--- a/toolkit/themes/osx/global/global.css
+++ b/toolkit/themes/osx/global/global.css
@@ -110,18 +110,17 @@ statusbarpanel {
 }
 
 .statusbarpanel-iconic {
   padding: 0px;
 }    
 
 /* ::::: miscellaneous formatting ::::: */
 
-:root:-moz-lwtheme,
-[lwthemefooter="true"] {
+:root:-moz-lwtheme {
   -moz-appearance: none;
 }
 
 :root:-moz-lwtheme-darktext {
   text-shadow: 0 -0.5px 1.5px white;
 }
 
 :root:-moz-lwtheme-brighttext {
--- a/toolkit/themes/windows/global/global.css
+++ b/toolkit/themes/windows/global/global.css
@@ -151,18 +151,17 @@ sidebarheader > label {
 
 toolbar[mode="text"] .toolbarbutton-text {
   padding: 0 !important;
   margin: 3px 5px !important;
 }
 
 /* ::::: miscellaneous formatting ::::: */
 
-:root:-moz-lwtheme,
-[lwthemefooter="true"] {
+:root:-moz-lwtheme {
   -moz-appearance: none;
 }
 
 :root:-moz-lwtheme-darktext {
   text-shadow: 0 -0.5px 1.5px white;
 }
 
 :root:-moz-lwtheme-brighttext {