Bug 1344307 - Clean up lightweight theme footer handling. r?jaws
MozReview-Commit-ID: BIUszE69HhH
--- 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 {