Bug 1344307 - Clean up lightweight theme footer handling. r=jaws

MozReview-Commit-ID: BIUszE69HhH

--HG--
extra : rebase_source : 92da21798e8e27d7f69a5d3245c97c9ac99f7af8
This commit is contained in:
Dão Gottwald 2017-03-03 19:41:28 +01:00
parent 88d3231652
commit 493fea90a4
6 changed files with 13 additions and 21 deletions

View File

@ -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 {

View File

@ -52,7 +52,6 @@
#endif
titlemenuseparator="&mainWindow.titlemodifiermenuseparator;"
lightweightthemes="true"
lightweightthemesfooter="browser-bottombox"
windowtype="navigator:browser"
macanimationtype="document"
screenX="4" screenY="4"

View File

@ -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);
}
}

View File

@ -155,7 +155,6 @@ toolbar[mode="text"] .toolbarbutton-text {
/* ::::: miscellaneous formatting ::::: */
:root:-moz-lwtheme,
[lwthemefooter="true"],
statusbarpanel:-moz-lwtheme {
-moz-appearance: none;
}

View File

@ -115,8 +115,7 @@ statusbarpanel {
/* ::::: miscellaneous formatting ::::: */
:root:-moz-lwtheme,
[lwthemefooter="true"] {
:root:-moz-lwtheme {
-moz-appearance: none;
}

View File

@ -156,8 +156,7 @@ toolbar[mode="text"] .toolbarbutton-text {
/* ::::: miscellaneous formatting ::::: */
:root:-moz-lwtheme,
[lwthemefooter="true"] {
:root:-moz-lwtheme {
-moz-appearance: none;
}