Bug 1430747 - Stop setting unused customization-lwtheme attribute and --toolbox-rect-height, --toolbox-rect-height-with-unit CSS variables. r?mikedeboer
MozReview-Commit-ID: HpdE3I7ZeDY
--- a/browser/base/content/browser-tabsintitlebar.js
+++ b/browser/base/content/browser-tabsintitlebar.js
@@ -263,20 +263,16 @@ var TabsInTitlebar = {
// Reset the margins and padding that might have been modified:
titlebarContent.style.marginTop = "";
titlebarContent.style.marginBottom = "";
titlebar.style.marginBottom = "";
menubar.style.paddingBottom = "";
}
ToolbarIconColor.inferFromText("tabsintitlebar", TabsInTitlebar.enabled);
-
- if (document.documentElement.hasAttribute("customizing")) {
- gCustomizeMode.updateLWTStyling();
- }
},
_sizePlaceholder(type, width) {
Array.forEach(document.querySelectorAll(".titlebar-placeholder[type='" + type + "']"),
function(node) { node.width = width; });
},
uninit() {
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -273,18 +273,16 @@ CustomizeMode.prototype = {
resolve();
}
};
Services.obs.addObserver(delayedStartupObserver, "browser-delayed-startup-finished");
});
}
- this.updateLWTStyling();
-
CustomizableUI.dispatchToolboxEvent("beforecustomization", {}, window);
CustomizableUI.notifyStartCustomizing(this.window);
// Add a keypress listener to the document so that we can quickly exit
// customization mode when pressing ESC.
document.addEventListener("keypress", this);
// Same goes for the menu button - if we're customizing, a click on the
@@ -310,18 +308,16 @@ CustomizeMode.prototype = {
this._wrapToolbarItemSync(CustomizableUI.AREA_TABSTRIP);
let customizableToolbars = document.querySelectorAll("toolbar[customizable=true]:not([autohide=true]):not([collapsed=true])");
for (let toolbar of customizableToolbars)
toolbar.setAttribute("customizing", true);
await this._doTransition(true);
- Services.obs.addObserver(this, "lightweight-theme-window-updated");
-
// Let everybody in this window know that we're about to customize.
CustomizableUI.dispatchToolboxEvent("customizationstarting", {}, window);
await this._wrapToolbarItems();
this.populatePalette();
this._setupPaletteDragging();
@@ -405,19 +401,16 @@ CustomizeMode.prototype = {
undoResetButton.hidden = resetButton.disabled = true;
this._transitioning = true;
(async () => {
await this.depopulatePalette();
await this._doTransition(false);
- this.updateLWTStyling({});
-
- Services.obs.removeObserver(this, "lightweight-theme-window-updated");
if (this.browser.selectedTab == gTab) {
if (gTab.linkedBrowser.currentURI.spec == "about:blank") {
closeGlobalTab();
} else {
unregisterGlobalTab();
}
}
@@ -510,36 +503,16 @@ CustomizeMode.prototype = {
docEl.setAttribute("customize-entered", true);
} else {
docEl.removeAttribute("customizing");
docEl.removeAttribute("customize-entered");
}
return Promise.resolve();
},
- updateLWTStyling(aData) {
- let docElement = this.document.documentElement;
- if (!aData) {
- let lwt = docElement._lightweightTheme;
- aData = lwt.getData();
- }
- let headerURL = aData && aData.headerURL;
- if (!headerURL) {
- docElement.removeAttribute("customization-lwtheme");
- return;
- }
- docElement.setAttribute("customization-lwtheme", "true");
-
- let deck = this.document.getElementById("tab-view-deck");
- let toolboxRect = this.window.gNavToolbox.getBoundingClientRect();
- let height = toolboxRect.bottom;
- deck.style.setProperty("--toolbox-rect-height", `${height}`);
- deck.style.setProperty("--toolbox-rect-height-with-unit", `${height}px`);
- },
-
_getCustomizableChildForNode(aNode) {
// NB: adjusted from _getCustomizableParent to keep that method fast
// (it's used during drags), and avoid multiple DOM loops
let areas = CustomizableUI.areas;
// Caching this length is important because otherwise we'll also iterate
// over items we add to the end from within the loop.
let numberOfAreas = areas.length;
for (let i = 0; i < numberOfAreas; i++) {
@@ -1168,17 +1141,16 @@ CustomizeMode.prototype = {
_onToolbarVisibilityChange(aEvent) {
let toolbar = aEvent.target;
if (aEvent.detail.visible && toolbar.getAttribute("customizable") == "true") {
toolbar.setAttribute("customizing", "true");
} else {
toolbar.removeAttribute("customizing");
}
this._onUIChange();
- this.updateLWTStyling();
},
onWidgetMoved(aWidgetId, aArea, aOldPosition, aNewPosition) {
this._onUIChange();
},
onWidgetAdded(aWidgetId, aArea, aPosition) {
this._onUIChange();
@@ -1616,22 +1588,16 @@ CustomizeMode.prototype = {
case "nsPref:changed":
this._updateResetButton();
this._updateUndoResetButton();
if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
this._updateTitlebarCheckbox();
this._updateDragSpaceCheckbox();
}
break;
- case "lightweight-theme-window-updated":
- if (aSubject == this.window) {
- aData = JSON.parse(aData);
- this.updateLWTStyling(aData);
- }
- break;
}
},
_updateTitlebarCheckbox() {
if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
return;
}
let drawInTitlebar = Services.prefs.getBoolPref(kDrawInTitlebarPref, true);