Bug 1449689 - Merge updateTitlebarDisplay function into TabsInTitlebar.update. r?johannh
MozReview-Commit-ID: IV5wrqoJmjB
--- a/browser/base/content/browser-tabsintitlebar.js
+++ b/browser/base/content/browser-tabsintitlebar.js
@@ -132,22 +132,30 @@ var TabsInTitlebar = {
update() {
if (!this._initialized || window.fullScreen) {
return;
}
let allowed = (Object.keys(this._disallowed)).length == 0;
if (allowed) {
document.documentElement.setAttribute("tabsintitlebar", "true");
+ if (AppConstants.platform == "macosx") {
+ document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1");
+ document.documentElement.removeAttribute("drawtitle");
+ } else {
+ document.documentElement.setAttribute("chromemargin", "0,2,2,2");
+ }
} else {
document.documentElement.removeAttribute("tabsintitlebar");
+ document.documentElement.removeAttribute("chromemargin");
+ if (AppConstants.platform == "macosx") {
+ document.documentElement.setAttribute("drawtitle", "true");
+ }
}
- updateTitlebarDisplay();
-
this._layOutTitlebar(allowed);
ToolbarIconColor.inferFromText("tabsintitlebar", allowed);
},
_layOutTitlebar(drawInTitlebar) {
if (!this._windowLayoutReady) {
return;
@@ -285,33 +293,16 @@ var TabsInTitlebar = {
removeEventListener("resolutionchange", this);
Services.prefs.removeObserver(this._prefName, this);
this._menuObserver.disconnect();
CustomizableUI.removeListener(this);
gDragSpaceObserver.uninit();
}
};
-function updateTitlebarDisplay() {
- if (AppConstants.platform == "macosx") {
- if (TabsInTitlebar.enabled) {
- document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1");
- document.documentElement.removeAttribute("drawtitle");
- } else {
- document.documentElement.removeAttribute("chromemargin");
- document.documentElement.setAttribute("drawtitle", "true");
- }
- } else if (TabsInTitlebar.enabled) {
- // not OS X
- document.documentElement.setAttribute("chromemargin", "0,2,2,2");
- } else {
- document.documentElement.removeAttribute("chromemargin");
- }
-}
-
function onTitlebarMaxClick() {
if (window.windowState == window.STATE_MAXIMIZED)
window.restore();
else
window.maximize();
}
// Adds additional drag space to the window by listening to