From ff5d37508cc9aa3ef255d8311a48fb46ff79bd40 Mon Sep 17 00:00:00 2001 From: Gavin Sharp Date: Thu, 25 Mar 2010 18:02:19 -0400 Subject: [PATCH] Bug 554991: move tab context menu outside of the tab containers anonymous content to make it easier to overlay directly, r=dao, r=davidb on a11y test --HG-- extra : rebase_source : 9d4330461d2047775cc66022ba77bc09cc69a020 --- .../tests/mochitest/tree/test_tabbrowser.xul | 3 - browser/base/content/browser.js | 20 ++++++ browser/base/content/browser.xul | 42 ++++++++++- browser/base/content/tabbrowser.xml | 72 +------------------ .../locales/en-US/chrome/browser/browser.dtd | 20 ++++++ .../en-US/chrome/browser/tabbrowser.dtd | 17 ----- 6 files changed, 84 insertions(+), 90 deletions(-) diff --git a/accessible/tests/mochitest/tree/test_tabbrowser.xul b/accessible/tests/mochitest/tree/test_tabbrowser.xul index d5befdce0ed..2837c76c697 100644 --- a/accessible/tests/mochitest/tree/test_tabbrowser.xul +++ b/accessible/tests/mochitest/tree/test_tabbrowser.xul @@ -63,9 +63,6 @@ var tabsAccTree = { role: ROLE_PAGETABLIST, children: [ - { - role: ROLE_MENUPOPUP - }, { role: ROLE_PAGETAB, children: [ diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 6e23d122540..5502e4e582a 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -7625,3 +7625,23 @@ function switchToTabHavingURI(aURI) { // No opened tab has that url. return false; } + +var TabContextMenu = { + contextTab: null, + updateContextMenu: function updateContextMenu(aPopupMenu) { + this.contextTab = document.popupNode.localName == "tab" ? + document.popupNode : gBrowser.selectedTab; + var disabled = gBrowser.tabs.length == 1; + var menuItems = aPopupMenu.getElementsByAttribute("tbattr", "tabbrowser-multiple"); + for (var i = 0; i < menuItems.length; i++) + menuItems[i].disabled = disabled; + + // Session store + // XXXzeniko should't we just disable this item as we disable + // the tabbrowser-multiple items above - for consistency? + document.getElementById("context_undoCloseTab").hidden = + Cc["@mozilla.org/browser/sessionstore;1"]. + getService(Ci.nsISessionStore). + getClosedTabCount(window) == 0; + } +} diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul index 270a28c824a..2104533ae93 100644 --- a/browser/base/content/browser.xul +++ b/browser/base/content/browser.xul @@ -110,6 +110,44 @@ #include browser-sets.inc + + + + + + + + + + + + + + + + - + onget="return TabContextMenu.contextTab;"/> - + - - - - - - - - - - - - - - - - document.getAnonymousElementByAttribute(this, "anonid", "tabContextMenu"); + document.getElementById(this.getAttribute("context")); 0 @@ -2725,35 +2688,6 @@ ]]> - null - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/browser/locales/en-US/chrome/browser/tabbrowser.dtd b/browser/locales/en-US/chrome/browser/tabbrowser.dtd index e482411ff98..e0c9d66fb4e 100644 --- a/browser/locales/en-US/chrome/browser/tabbrowser.dtd +++ b/browser/locales/en-US/chrome/browser/tabbrowser.dtd @@ -1,20 +1,3 @@ - - - - - - - - - - - - - - - - -