Bug 1899598 - Hide the horizontal tab strip when vertical tabs are enabled. r=mconley,desktop-theme-reviewers,tabbrowser-reviewers,sidebar-reviewers,emilio,willdurand,sclements

* Remove the #titlebar element, and ensure toolbars that comprise the titlebar get a .browser-titlebar class
* Ensure we call TabBarVisibility.update when initializing with verticalTab=true
* Adjust TabBarVisibility logic so we allow for the vertical tabs case
* Give #navigator-toolbar z-index: var(--browser-area-z-index-toolbox) to ensure the urlbar view doesnt get clipped behind the lower elements

Differential Revision: https://phabricator.services.mozilla.com/D222059
This commit is contained in:
Sam Foster
2024-10-02 22:14:13 +00:00
parent f9559e8a4d
commit 58c1f20705
17 changed files with 605 additions and 132 deletions

View File

@@ -144,16 +144,25 @@ var gBrowserInit = {
"BrowserToolbarPalette"
).content;
let isVerticalTabs = Services.prefs.getBoolPref(
"sidebar.verticalTabs",
false
);
let nonRemovables;
let isPopup = !window.toolbar.visible;
// We don't want these normally non-removable elements to get put back into the
// tabstrip if we're initializing with vertical tabs
let nonRemovables = [
gBrowser.tabContainer,
document.getElementById("alltabs-button"),
];
for (let elem of nonRemovables) {
elem.setAttribute("removable", "true");
// tell CUI to ignore this element when it builds the toolbar areas
elem.setAttribute("skipintoolbarset", "true");
if (isVerticalTabs && !isPopup) {
nonRemovables = [
gBrowser.tabContainer,
document.getElementById("alltabs-button"),
];
for (let elem of nonRemovables) {
elem.setAttribute("removable", "true");
// tell CUI to ignore this element when it builds the toolbar areas
elem.setAttribute("skipintoolbarset", "true");
}
}
for (let area of CustomizableUI.areas) {
let type = CustomizableUI.getAreaType(area);
@@ -162,11 +171,35 @@ var gBrowserInit = {
CustomizableUI.registerToolbarNode(node);
}
}
for (let elem of nonRemovables) {
elem.setAttribute("removable", "false");
elem.removeAttribute("skipintoolbarset");
}
if (isVerticalTabs && !isPopup) {
// Show the vertical tabs toolbar
setToolbarVisibility(
document.getElementById(CustomizableUI.AREA_VERTICAL_TABSTRIP),
true,
false,
false
);
let tabstripToolbar = document.getElementById(
CustomizableUI.AREA_TABSTRIP
);
let wasCollapsed = tabstripToolbar.collapsed;
TabBarVisibility.update();
if (tabstripToolbar.collapsed !== wasCollapsed) {
let eventParams = {
detail: {
visible: !tabstripToolbar.collapsed,
},
bubbles: true,
};
let event = new CustomEvent("toolbarvisibilitychange", eventParams);
tabstripToolbar.dispatchEvent(event);
}
for (let elem of nonRemovables) {
elem.setAttribute("removable", "false");
elem.removeAttribute("skipintoolbarset");
}
}
BrowserSearch.initPlaceHolder();
// Hack to ensure that the various initial pages favicon is loaded