From 493fea90a44b1ae304582b1bf2c7a0948b8d82e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Fri, 3 Mar 2017 19:41:28 +0100 Subject: [PATCH] Bug 1344307 - Clean up lightweight theme footer handling. r=jaws MozReview-Commit-ID: BIUszE69HhH --HG-- extra : rebase_source : 92da21798e8e27d7f69a5d3245c97c9ac99f7af8 --- browser/base/content/browser.css | 4 ++-- browser/base/content/browser.xul | 1 - toolkit/modules/LightweightThemeConsumer.jsm | 22 ++++++++------------ toolkit/themes/linux/global/global.css | 1 - toolkit/themes/osx/global/global.css | 3 +-- toolkit/themes/windows/global/global.css | 3 +-- 6 files changed, 13 insertions(+), 21 deletions(-) diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 9e7ddaf8cb77..d67a1a8cd748 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -451,11 +451,11 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks { } %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 { diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 4186ed19432a..081e566075e0 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -52,7 +52,6 @@ #endif titlemenuseparator="&mainWindow.titlemodifiermenuseparator;" lightweightthemes="true" - lightweightthemesfooter="browser-bottombox" windowtype="navigator:browser" macanimationtype="document" screenX="4" screenY="4" diff --git a/toolkit/modules/LightweightThemeConsumer.jsm b/toolkit/modules/LightweightThemeConsumer.jsm index b95d5401c6cb..1d91dbdf93a3 100644 --- a/toolkit/modules/LightweightThemeConsumer.jsm +++ b/toolkit/modules/LightweightThemeConsumer.jsm @@ -17,7 +17,6 @@ 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; @@ -123,15 +122,12 @@ LightweightThemeConsumer.prototype = { 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, @@ -159,11 +155,11 @@ LightweightThemeConsumer.prototype = { } } -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); } } diff --git a/toolkit/themes/linux/global/global.css b/toolkit/themes/linux/global/global.css index f2dcd4e9cb4f..654cc64b93ae 100644 --- a/toolkit/themes/linux/global/global.css +++ b/toolkit/themes/linux/global/global.css @@ -155,7 +155,6 @@ toolbar[mode="text"] .toolbarbutton-text { /* ::::: miscellaneous formatting ::::: */ :root:-moz-lwtheme, -[lwthemefooter="true"], statusbarpanel:-moz-lwtheme { -moz-appearance: none; } diff --git a/toolkit/themes/osx/global/global.css b/toolkit/themes/osx/global/global.css index 89f8bad29690..d7111f14e465 100644 --- a/toolkit/themes/osx/global/global.css +++ b/toolkit/themes/osx/global/global.css @@ -115,8 +115,7 @@ statusbarpanel { /* ::::: miscellaneous formatting ::::: */ -:root:-moz-lwtheme, -[lwthemefooter="true"] { +:root:-moz-lwtheme { -moz-appearance: none; } diff --git a/toolkit/themes/windows/global/global.css b/toolkit/themes/windows/global/global.css index 19b4df271608..4df78a297192 100644 --- a/toolkit/themes/windows/global/global.css +++ b/toolkit/themes/windows/global/global.css @@ -156,8 +156,7 @@ toolbar[mode="text"] .toolbarbutton-text { /* ::::: miscellaneous formatting ::::: */ -:root:-moz-lwtheme, -[lwthemefooter="true"] { +:root:-moz-lwtheme { -moz-appearance: none; }