From 79ff40d2ff9d91c41ddeffcd13951032a293af5b Mon Sep 17 00:00:00 2001 From: Sarah Clements Date: Tue, 15 Mar 2022 09:57:45 +0000 Subject: [PATCH] Bug 1752833 - remove menubar_can_autohide from browser.css r=sfoster Differential Revision: https://phabricator.services.mozilla.com/D140374 --- browser/base/content/browser.css | 30 ++++++++----------- browser/base/content/browser.js | 12 ++++++++ .../base/content/navigator-toolbox.inc.xhtml | 5 ---- browser/base/jar.mn | 2 +- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index 9eab405647d0..fa421a3d0a3b 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -94,7 +94,6 @@ body { } } -%ifdef MENUBAR_CAN_AUTOHIDE #toolbar-menubar[autohide="true"] { overflow: hidden; } @@ -104,13 +103,10 @@ body { height: 0 !important; appearance: none !important; } -%endif -%ifdef XP_MACOSX -#toolbar-menubar { +#toolbar-menubar:not([autohide]) { visibility: collapse; } -%endif panelmultiview { -moz-box-align: start; @@ -291,13 +287,13 @@ toolbar[customizing] #whats-new-menu-button { display: none; } - -%ifdef MENUBAR_CAN_AUTOHIDE /* Hide the TabsToolbar titlebar controls if the menubar is permanently shown. * (That is, if the menu bar doesn't autohide, and we're not in a fullscreen or * popup window.) */ -:root:not([chromehidden~="menubar"], [inFullscreen]) #toolbar-menubar:not([autohide=true]) + #TabsToolbar > :is(.titlebar-buttonbox-container, .titlebar-spacer), -%endif +:root:not([chromehidden~="menubar"], [inFullscreen]) #toolbar-menubar[autohide="false"] + #TabsToolbar > :is(.titlebar-buttonbox-container, .titlebar-spacer) { + display: none; +} + :root:not([chromemargin], [inFullscreen]) .titlebar-buttonbox-container, :root[inFullscreen] .titlebar-spacer, :root:not([tabsintitlebar]) .titlebar-spacer { @@ -330,11 +326,9 @@ toolbar[customizing] #whats-new-menu-button { display: none; } -%ifdef MENUBAR_CAN_AUTOHIDE -#toolbar-menubar[autohide=true]:not([inactive]) + #TabsToolbar > .titlebar-buttonbox-container { +#toolbar-menubar[autohide="true"]:not([inactive]) + #TabsToolbar > .titlebar-buttonbox-container { visibility: hidden; } -%endif :root[tabsintitlebar] .titlebar-buttonbox { position: relative; @@ -470,13 +464,13 @@ toolbarpaletteitem[removable="false"] { opacity: 0.5; } -%ifndef XP_MACOSX -toolbarpaletteitem[place="palette"], -toolbarpaletteitem[place="menu-panel"], -toolbarpaletteitem[place="toolbar"] { - -moz-user-focus: normal; +@media not (-moz-platform: macos) { + toolbarpaletteitem[place="palette"], + toolbarpaletteitem[place="menu-panel"], + toolbarpaletteitem[place="toolbar"] { + -moz-user-focus: normal; + } } -%endif #bookmarks-toolbar-placeholder, #bookmarks-toolbar-button, diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 9240bf1a470f..94e3ef6c8b02 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1628,6 +1628,18 @@ var gBrowserInit = { document.documentElement.setAttribute("sizemode", "maximized"); } } + if (AppConstants.MENUBAR_CAN_AUTOHIDE) { + const toolbarMenubar = document.getElementById("toolbar-menubar"); + // set a default value + if (!toolbarMenubar.hasAttribute("autohide")) { + toolbarMenubar.setAttribute("autohide", true); + } + toolbarMenubar.setAttribute( + "data-l10n-id", + "toolbar-context-menu-menu-bar-cmd" + ); + toolbarMenubar.setAttribute("data-l10n-attrs", "toolbarname"); + } // Run menubar initialization first, to avoid TabsInTitlebar code picking // up mutations from it and causing a reflow. diff --git a/browser/base/content/navigator-toolbox.inc.xhtml b/browser/base/content/navigator-toolbox.inc.xhtml index 256ee8ee74ec..0867e2ac6ee7 100644 --- a/browser/base/content/navigator-toolbox.inc.xhtml +++ b/browser/base/content/navigator-toolbox.inc.xhtml @@ -16,11 +16,6 @@ class="browser-toolbar chromeclass-menubar titlebar-color" customizable="true" mode="icons" -#ifdef MENUBAR_CAN_AUTOHIDE - data-l10n-id="toolbar-context-menu-menu-bar-cmd" - data-l10n-attrs="toolbarname" - autohide="true" -#endif context="toolbar-context-menu"> # The entire main menubar is placed into browser-menubar.inc, so that it can be diff --git a/browser/base/jar.mn b/browser/base/jar.mn index 739cbc2a5663..37a68307a8b6 100644 --- a/browser/base/jar.mn +++ b/browser/base/jar.mn @@ -34,7 +34,7 @@ browser.jar: content/browser/aboutTabCrashed.css (content/aboutTabCrashed.css) content/browser/aboutTabCrashed.js (content/aboutTabCrashed.js) content/browser/aboutTabCrashed.xhtml (content/aboutTabCrashed.xhtml) -* content/browser/browser.css (content/browser.css) + content/browser/browser.css (content/browser.css) content/browser/browser.js (content/browser.js) * content/browser/browser.xhtml (content/browser.xhtml) content/browser/browser-a11yUtils.js (content/browser-a11yUtils.js)