From 976c525965cb269c67dc9f8e0746bc04be2ac262 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A3o=20Gottwald?= Date: Sat, 13 Jun 2009 08:08:20 +0200 Subject: [PATCH] Bug 456535 - On Windows, users should be able to hide the menubar and show it with the alt key. r=mano, ui-r=faaborg --- browser/base/content/browser.js | 16 ++++++++++------ browser/base/content/browser.xul | 4 ++++ browser/locales/en-US/chrome/browser/browser.dtd | 2 ++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 0b621c865342..8ce5a139b04e 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4530,14 +4530,15 @@ function onViewToolbarsPopupShowing(aEvent) for (i = 0; i < gNavToolbox.childNodes.length; ++i) { var toolbar = gNavToolbox.childNodes[i]; var toolbarName = toolbar.getAttribute("toolbarname"); - var type = toolbar.getAttribute("type"); - if (toolbarName && type != "menubar") { - var menuItem = document.createElement("menuitem"); + if (toolbarName) { + let menuItem = document.createElement("menuitem"); + let hidingAttribute = toolbar.getAttribute("type") == "menubar" ? + "autohide" : "collapsed"; menuItem.setAttribute("toolbarindex", i); menuItem.setAttribute("type", "checkbox"); menuItem.setAttribute("label", toolbarName); menuItem.setAttribute("accesskey", toolbar.getAttribute("accesskey")); - menuItem.setAttribute("checked", toolbar.getAttribute("collapsed") != "true"); + menuItem.setAttribute("checked", toolbar.getAttribute(hidingAttribute) != "true"); popup.insertBefore(menuItem, firstMenuItem); menuItem.addEventListener("command", onViewToolbarCommand, false); @@ -4550,9 +4551,12 @@ function onViewToolbarCommand(aEvent) { var index = aEvent.originalTarget.getAttribute("toolbarindex"); var toolbar = gNavToolbox.childNodes[index]; + var hidingAttribute = toolbar.getAttribute("type") == "menubar" ? + "autohide" : "collapsed"; - toolbar.collapsed = aEvent.originalTarget.getAttribute("checked") != "true"; - document.persist(toolbar.id, "collapsed"); + toolbar.setAttribute(hidingAttribute, + aEvent.originalTarget.getAttribute("checked") != "true"); + document.persist(toolbar.id, hidingAttribute); } function displaySecurityInfo() diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index cd40d61f2ec0..41e71f5933e0 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -284,6 +284,10 @@ # The entire main menubar is placed into browser-menubar.inc, so that it can be shared by diff --git a/browser/locales/en-US/chrome/browser/browser.dtd b/browser/locales/en-US/chrome/browser/browser.dtd index 4165bb679544..1995cf28368e 100644 --- a/browser/locales/en-US/chrome/browser/browser.dtd +++ b/browser/locales/en-US/chrome/browser/browser.dtd @@ -32,6 +32,8 @@ + +