зеркало из https://github.com/mozilla/pjs.git
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
This commit is contained in:
Родитель
b86100f403
Коммит
ff5d37508c
|
@ -63,9 +63,6 @@
|
|||
var tabsAccTree = {
|
||||
role: ROLE_PAGETABLIST,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_MENUPOPUP
|
||||
},
|
||||
{
|
||||
role: ROLE_PAGETAB,
|
||||
children: [
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,6 +110,44 @@
|
|||
#include browser-sets.inc
|
||||
|
||||
<popupset id="mainPopupSet">
|
||||
<menupopup id="tabContextMenu"
|
||||
onpopupshowing="if (event.target == this) TabContextMenu.updateContextMenu(this);"
|
||||
onpopuphidden="if (event.target == this) TabContextMenu.contextTab = null;">
|
||||
<menuitem id="context_newTab" label="&newTab.label;" accesskey="&newTab.accesskey;"
|
||||
command="cmd_newNavigatorTab"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="context_reloadTab" label="&reloadTab.label;" accesskey="&reloadTab.accesskey;"
|
||||
oncommand="gBrowser.reloadTab(TabContextMenu.contextTab);"/>
|
||||
<menuitem id="context_reloadAllTabs" label="&reloadAllTabs.label;" accesskey="&reloadAllTabs.accesskey;"
|
||||
tbattr="tabbrowser-multiple"
|
||||
oncommand="gBrowser.reloadAllTabs();"/>
|
||||
<menuitem id="context_closeOtherTabs" label="&closeOtherTabs.label;" accesskey="&closeOtherTabs.accesskey;"
|
||||
tbattr="tabbrowser-multiple"
|
||||
oncommand="gBrowser.removeAllTabsBut(TabContextMenu.contextTab);"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="context_openTabInWindow" label="&openTabInNewWindow.label;"
|
||||
accesskey="&openTabInNewWindow.accesskey;"
|
||||
tbattr="tabbrowser-multiple"
|
||||
oncommand="gBrowser.replaceTabWithWindow(TabContextMenu.contextTab);"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="context_bookmarkTab"
|
||||
label="&bookmarkThisTab.label;"
|
||||
accesskey="&bookmarkThisTab.accesskey;"
|
||||
oncommand="BookmarkThisTab(TabContextMenu.contextTab);"/>
|
||||
<menuitem id="context_bookmarkAllTabs"
|
||||
label="&bookmarkAllTabs.label;"
|
||||
accesskey="&bookmarkAllTabs.accesskey;"
|
||||
command="Browser:BookmarkAllTabs"/>
|
||||
<menuitem id="context_undoCloseTab"
|
||||
label="&undoCloseTab.label;"
|
||||
accesskey="&undoCloseTab.accesskey;"
|
||||
command="History:UndoCloseTab"/>
|
||||
<menuseparator/>
|
||||
<menuitem id="context_closeTab" label="&closeTab.label;" accesskey="&closeTab.accesskey;"
|
||||
tbattr="tabbrowser-multiple"
|
||||
oncommand="gBrowser.removeTab(TabContextMenu.contextTab);"/>
|
||||
</menupopup>
|
||||
|
||||
<menupopup id="backForwardMenu"
|
||||
onpopupshowing="return FillHistoryMenu(event.target);"
|
||||
oncommand="gotoHistoryIndex(event);"
|
||||
|
@ -521,7 +559,9 @@
|
|||
fullscreentoolbar="true"
|
||||
ordinal="100"
|
||||
collapsed="true">
|
||||
<tabs id="tabbrowser-tabs" class="tabbrowser-tabs"
|
||||
<tabs id="tabbrowser-tabs"
|
||||
class="tabbrowser-tabs"
|
||||
context="tabContextMenu"
|
||||
tabbrowser="content"
|
||||
flex="1"
|
||||
setfocus="false"
|
||||
|
|
|
@ -2300,7 +2300,7 @@
|
|||
</body>
|
||||
</method>
|
||||
<property name="mContextTab" readonly="true"
|
||||
onget="return this.tabContainer._contextTab;"/>
|
||||
onget="return TabContextMenu.contextTab;"/>
|
||||
<property name="mPrefs" readonly="true"
|
||||
onget="return Services.prefs;"/>
|
||||
<property name="mTabContainer" readonly="true"
|
||||
|
@ -2422,47 +2422,10 @@
|
|||
<stylesheet src="chrome://browser/content/tabbrowser.css"/>
|
||||
</resources>
|
||||
|
||||
<content context="_child">
|
||||
<content>
|
||||
<xul:hbox align="start">
|
||||
<xul:image class="tab-drop-indicator" anonid="tab-drop-indicator" collapsed="true"/>
|
||||
</xul:hbox>
|
||||
<xul:menupopup anonid="tabContextMenu"
|
||||
onpopupshowing="if (event.target == this) this.parentNode._updateContextMenu(this);"
|
||||
onpopuphidden="if (event.target == this) this.parentNode._contextTab = null;">
|
||||
<xul:menuitem id="context_newTab" label="&newTab.label;" accesskey="&newTab.accesskey;"
|
||||
command="cmd_newNavigatorTab"/>
|
||||
<xul:menuseparator/>
|
||||
<xul:menuitem id="context_reloadTab" label="&reloadTab.label;" accesskey="&reloadTab.accesskey;"
|
||||
oncommand="this.parentNode.parentNode._contextMenuAction('reloadTab');"/>
|
||||
<xul:menuitem id="context_reloadAllTabs" label="&reloadAllTabs.label;" accesskey="&reloadAllTabs.accesskey;"
|
||||
tbattr="tabbrowser-multiple"
|
||||
oncommand="this.parentNode.parentNode._contextMenuAction('reloadAllTabs');"/>
|
||||
<xul:menuitem id="context_closeOtherTabs" label="&closeOtherTabs.label;" accesskey="&closeOtherTabs.accesskey;"
|
||||
tbattr="tabbrowser-multiple"
|
||||
oncommand="this.parentNode.parentNode._contextMenuAction('removeAllTabsBut');"/>
|
||||
<xul:menuseparator/>
|
||||
<xul:menuitem id="context_openTabInWindow" label="&openTabInNewWindow.label;"
|
||||
accesskey="&openTabInNewWindow.accesskey;"
|
||||
tbattr="tabbrowser-multiple"
|
||||
oncommand="this.parentNode.parentNode._contextMenuAction('replaceTabWithWindow');"/>
|
||||
<xul:menuseparator/>
|
||||
<xul:menuitem id="context_bookmarkTab"
|
||||
label="&bookmarkThisTab.label;"
|
||||
accesskey="&bookmarkThisTab.accesskey;"
|
||||
oncommand="this.parentNode.parentNode._contextMenuAction('BookmarkThisTab', window);"/>
|
||||
<xul:menuitem id="context_bookmarkAllTabs"
|
||||
label="&bookmarkAllTabs.label;"
|
||||
accesskey="&bookmarkAllTabs.accesskey;"
|
||||
command="Browser:BookmarkAllTabs"/>
|
||||
<xul:menuitem id="context_undoCloseTab"
|
||||
label="&undoCloseTab.label;"
|
||||
accesskey="&undoCloseTab.accesskey;"
|
||||
command="History:UndoCloseTab"/>
|
||||
<xul:menuseparator/>
|
||||
<xul:menuitem id="context_closeTab" label="&closeTab.label;" accesskey="&closeTab.accesskey;"
|
||||
tbattr="tabbrowser-multiple"
|
||||
oncommand="this.parentNode.parentNode._contextMenuAction('removeTab');"/>
|
||||
</xul:menupopup>
|
||||
<xul:arrowscrollbox anonid="arrowscrollbox" orient="horizontal" flex="1"
|
||||
style="min-width: 1px;"
|
||||
#ifndef XP_MACOSX
|
||||
|
@ -2538,7 +2501,7 @@
|
|||
</field>
|
||||
|
||||
<field name="contextMenu" readonly="true">
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "tabContextMenu");
|
||||
document.getElementById(this.getAttribute("context"));
|
||||
</field>
|
||||
|
||||
<field name="mTabstripWidth">0</field>
|
||||
|
@ -2725,35 +2688,6 @@
|
|||
]]></body>
|
||||
</method>
|
||||
|
||||
<field name="_contextTab">null</field>
|
||||
<method name="_updateContextMenu">
|
||||
<parameter name="aPopupMenu"/>
|
||||
<body><![CDATA[
|
||||
this._contextTab = document.popupNode.localName == "tab" ?
|
||||
document.popupNode : this.selectedItem;
|
||||
var disabled = this.childNodes.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;
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_contextMenuAction">
|
||||
<parameter name="aMethod"/>
|
||||
<parameter name="aContext"/>
|
||||
<body><![CDATA[
|
||||
(aContext || this.tabbrowser)[aMethod](this._contextTab);
|
||||
]]></body>
|
||||
</method>
|
||||
|
||||
<method name="_getDragTargetTab">
|
||||
<parameter name="event"/>
|
||||
<body><![CDATA[
|
||||
|
|
|
@ -11,6 +11,26 @@
|
|||
inside the private browsing mode -->
|
||||
<!ENTITY mainWindow.titlePrivateBrowsingSuffix "(Private Browsing)">
|
||||
|
||||
<!-- Tab context menu -->
|
||||
<!ENTITY newTab.label "New Tab">
|
||||
<!ENTITY newTab.accesskey "N">
|
||||
<!ENTITY reloadTab.label "Reload Tab">
|
||||
<!ENTITY reloadTab.accesskey "R">
|
||||
<!ENTITY reloadAllTabs.label "Reload All Tabs">
|
||||
<!ENTITY reloadAllTabs.accesskey "A">
|
||||
<!ENTITY closeOtherTabs.label "Close Other Tabs">
|
||||
<!ENTITY closeOtherTabs.accesskey "o">
|
||||
<!ENTITY openTabInNewWindow.label "Open in a New Window">
|
||||
<!ENTITY openTabInNewWindow.accesskey "W">
|
||||
<!ENTITY bookmarkThisTab.label "Bookmark This Tab">
|
||||
<!ENTITY bookmarkThisTab.accesskey "B">
|
||||
<!ENTITY bookmarkAllTabs.label "Bookmark All Tabs…">
|
||||
<!ENTITY bookmarkAllTabs.accesskey "T">
|
||||
<!ENTITY undoCloseTab.label "Undo Close Tab">
|
||||
<!ENTITY undoCloseTab.accesskey "U">
|
||||
<!ENTITY closeTab.label "Close Tab">
|
||||
<!ENTITY closeTab.accesskey "c">
|
||||
|
||||
<!ENTITY tabCmd.label "New Tab">
|
||||
<!ENTITY tabCmd.accesskey "T">
|
||||
<!ENTITY tabCmd.commandkey "t">
|
||||
|
|
|
@ -1,20 +1,3 @@
|
|||
<!ENTITY newTab.label "New Tab">
|
||||
<!ENTITY newTab.accesskey "N">
|
||||
<!ENTITY closeTab.label "Close Tab">
|
||||
<!ENTITY closeTab.accesskey "c">
|
||||
<!ENTITY closeOtherTabs.accesskey "o">
|
||||
<!ENTITY closeOtherTabs.label "Close Other Tabs">
|
||||
<!ENTITY reloadAllTabs.label "Reload All Tabs">
|
||||
<!ENTITY reloadAllTabs.accesskey "A">
|
||||
<!ENTITY reloadTab.label "Reload Tab">
|
||||
<!ENTITY reloadTab.accesskey "r">
|
||||
<!ENTITY openTabInNewWindow.label "Open in a New Window">
|
||||
<!ENTITY openTabInNewWindow.accesskey "W">
|
||||
<!ENTITY listAllTabs.label "List all tabs">
|
||||
<!ENTITY bookmarkAllTabs.label "Bookmark All Tabs…">
|
||||
<!ENTITY bookmarkAllTabs.accesskey "T">
|
||||
<!ENTITY bookmarkThisTab.label "Bookmark This Tab">
|
||||
<!ENTITY bookmarkThisTab.accesskey "B">
|
||||
<!ENTITY undoCloseTab.label "Undo Close Tab">
|
||||
<!ENTITY undoCloseTab.accesskey "U">
|
||||
<!ENTITY newTabButton.tooltip "Open a new tab">
|
||||
|
|
Загрузка…
Ссылка в новой задаче