Bug 465843. Remove ctrl-tab preview switching and revert all tabs button to menu, for now. r=dao, a=beltzner

This commit is contained in:
Mike Connor 2008-11-20 11:53:01 -05:00
parent 07fb51f928
commit 74f5b47a28
7 changed files with 330 additions and 5 deletions

View File

@ -1275,7 +1275,9 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
gBrowser.addEventListener("command", BrowserOnCommand, false);
tabPreviews.init();
#ifdef USE_TAB_PREVIEWS
ctrlTab.init();
#endif
// Initialize the microsummary service by retrieving it, prompting its factory
// to create its singleton, whose constructor initializes the service.
@ -1322,8 +1324,9 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
function BrowserShutdown()
{
tabPreviews.uninit();
#ifdef USE_TAB_PREVIEWS
ctrlTab.uninit();
#endif
gGestureSupport.init(false);
try {

View File

@ -233,7 +233,7 @@
<tooltip id="urlTooltip">
<label crop="center" flex="1" class="tooltip-label"/>
</tooltip>
#ifdef USE_TAB_PREVIEWS
<panel id="ctrlTab-panel" class="KUI-panel" hidden="true" norestorefocus="true" ignorekeys="true">
<hbox pack="center">
<textbox id="ctrlTab-search"
@ -259,6 +259,7 @@
</hbox>
<hbox id="ctrlTab-pages"/>
</panel>
#endif
</popupset>
<!-- bookmarks toolbar tooltip -->

View File

@ -12,6 +12,12 @@
}
%endif
%ifndef USE_TAB_PREVIEWS
.tabs-alltabs-popup {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-alltabs-popup");
}
%endif
.tab-close-button, .tabs-closebutton {
-moz-binding: url("chrome://browser/content/tabbrowser.xml#tabbrowser-close-tab-button");
}

View File

@ -2885,10 +2885,20 @@
command="cmd_newNavigatorTab" chromedir="&locale.dir;"
tooltiptext="&newTabButton.tooltip;"/>
<xul:stack align="center" pack="end" chromedir="&locale.dir;">
#ifdef USE_TAB_PREVIEWS
<xul:hbox flex="1" class="tabs-alltabs-box-animate" anonid="alltabs-box-animate"/>
<xul:toolbarbutton class="tabs-alltabs-button" anonid="alltabs-button"
tooltiptext="&listAllTabs.label;"
oncommand="ctrlTab.open(true);"/>
#else
<xul:hbox flex="1" class="tabs-alltabs-box" anonid="alltabs-box"/>
<xul:hbox flex="1" class="tabs-alltabs-box-animate" anonid="alltabs-box-animate"/>
<xul:toolbarbutton class="tabs-alltabs-button" type="menu" anonid="alltabs-button"
tooltiptext="&listAllTabs.label;">
<xul:menupopup class="tabs-alltabs-popup" anonid="alltabs-popup"
position="after_end"/>
</xul:toolbarbutton>
#endif
</xul:stack>
#ifdef XP_MACOSX
<xul:hbox anonid="tabstrip-closebutton" class="tabs-closebutton-box" align="center" pack="end" chromedir="&locale.dir;">
@ -3081,6 +3091,13 @@
]]></body>
</method>
#ifndef USE_TAB_PREVIEWS
<field name="mAllTabsPopup">
document.getAnonymousElementByAttribute(this,
"anonid", "alltabs-popup");
</field>
#endif
<field name="mAllTabsBoxAnimate">
document.getAnonymousElementByAttribute(this,
"anonid",
@ -3188,6 +3205,225 @@
</handlers>
</binding>
#ifndef USE_TAB_PREVIEWS
<!-- alltabs-popup binding
This binding relies on the structure of the tabbrowser binding.
Therefore it should only be used as a child of the tabs element.
This binding is exposed as a pseudo-public-API so themes can customize
the tabbar appearance without having to be scriptable
(see globalBindings.xml in Pinstripe for example).
-->
<binding id="tabbrowser-alltabs-popup"
extends="chrome://global/content/bindings/popup.xml#popup">
<implementation implements="nsIDOMEventListener">
<field name="_xulWindow">
null
</field>
<constructor><![CDATA[
// We cannot cache the XULBrowserWindow object itself since it might
// be set after this binding is constructed.
try {
this._xulWindow =
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIWebNavigation)
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
.treeOwner
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIXULWindow);
}
catch(ex) { }
]]></constructor>
<method name="_menuItemOnCommand">
<parameter name="aEvent"/>
<body><![CDATA[
var tabcontainer = document.getBindingParent(this);
tabcontainer.selectedItem = aEvent.target.tab;
]]></body>
</method>
<method name="_tabOnAttrModified">
<parameter name="aEvent"/>
<body><![CDATA[
var menuItem = aEvent.target.mCorrespondingMenuitem;
if (menuItem) {
var attrName = aEvent.attrName;
switch (attrName) {
case "label":
case "crop":
case "busy":
case "image":
case "selected":
if (aEvent.attrChange == aEvent.REMOVAL)
menuItem.removeAttribute(attrName);
else
menuItem.setAttribute(attrName, aEvent.newValue);
}
}
]]></body>
</method>
<method name="_tabOnTabClose">
<parameter name="aEvent"/>
<body><![CDATA[
var menuItem = aEvent.target.mCorrespondingMenuitem;
if (menuItem)
this.removeChild(menuItem);
]]></body>
</method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body><![CDATA[
if (!aEvent.isTrusted)
return;
switch (aEvent.type) {
case "command":
this._menuItemOnCommand(aEvent);
break;
case "DOMAttrModified":
this._tabOnAttrModified(aEvent);
break;
case "TabClose":
this._tabOnTabClose(aEvent);
break;
case "TabOpen":
this._createTabMenuItem(aEvent.originalTarget);
break;
case "scroll":
this._updateTabsVisibilityStatus();
break;
}
]]></body>
</method>
<method name="_updateTabsVisibilityStatus">
<body><![CDATA[
var tabContainer = document.getBindingParent(this);
// We don't want menu item decoration unless there is overflow.
if (tabContainer.getAttribute("overflow") != "true")
return;
var tabstripBO = tabContainer.mTabstrip.scrollBoxObject;
for (var i = 0; i < this.childNodes.length; i++) {
var curTabBO = this.childNodes[i].tab.boxObject;
if (curTabBO.screenX >= tabstripBO.screenX &&
curTabBO.screenX + curTabBO.width <= tabstripBO.screenX + tabstripBO.width)
this.childNodes[i].setAttribute("tabIsVisible", "true");
else
this.childNodes[i].removeAttribute("tabIsVisible");
}
]]></body>
</method>
<method name="_createTabMenuItem">
<parameter name="aTab"/>
<body><![CDATA[
var menuItem = document.createElementNS(
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"menuitem");
menuItem.setAttribute("class", "menuitem-iconic alltabs-item");
menuItem.setAttribute("label", aTab.label);
menuItem.setAttribute("crop", aTab.getAttribute("crop"));
menuItem.setAttribute("image", aTab.getAttribute("image"));
if (aTab.hasAttribute("busy"))
menuItem.setAttribute("busy", aTab.getAttribute("busy"));
if (aTab.selected)
menuItem.setAttribute("selected", "true");
// Keep some attributes of the menuitem in sync with its
// corresponding tab (e.g. the tab label)
aTab.mCorrespondingMenuitem = menuItem;
aTab.addEventListener("DOMAttrModified", this, false);
aTab.addEventListener("TabClose", this, false);
menuItem.tab = aTab;
menuItem.addEventListener("command", this, false);
this.appendChild(menuItem);
return menuItem;
]]></body>
</method>
</implementation>
<handlers>
<handler event="popupshowing">
<![CDATA[
// set up the menu popup
var tabcontainer = document.getBindingParent(this);
var tabs = tabcontainer.childNodes;
// Listen for changes in the tab bar.
var tabbrowser = document.getBindingParent(tabcontainer);
tabbrowser.addEventListener("TabOpen", this, false);
tabcontainer.mTabstrip.addEventListener("scroll", this, false);
// if an animation is in progress and the user
// clicks on the "all tabs" button, stop the animation
tabcontainer._stopAnimation();
for (var i = 0; i < tabs.length; i++) {
this._createTabMenuItem(tabs[i]);
}
this._updateTabsVisibilityStatus();
]]></handler>
<handler event="popuphiding">
<![CDATA[
// clear out the menu popup and remove the listeners
while (this.hasChildNodes()) {
var menuItem = this.lastChild;
menuItem.removeEventListener("command", this, false);
menuItem.tab.removeEventListener("DOMAttrModified", this, false);
menuItem.tab.removeEventListener("TabClose", this, false);
menuItem.tab.mCorrespondingMenuitem = null;
this.removeChild(menuItem);
}
var tabcontainer = document.getBindingParent(this);
tabcontainer.mTabstrip.removeEventListener("scroll", this, false);
document.getBindingParent(tabcontainer).removeEventListener("TabOpen", this, false);
]]></handler>
<handler event="DOMMenuItemActive">
<![CDATA[
if (!this._xulWindow || !this._xulWindow.XULBrowserWindow)
return;
var tab = event.target.tab;
if (tab) {
var statusText = tab.linkedBrowser.currentURI.spec;
if (statusText == "about:blank") {
// XXXhack: Passing a space here (and not "")
// to make sure the the browser implementation would
// still consider it a hovered link.
statusText = " ";
}
this._xulWindow.XULBrowserWindow.setOverLink(statusText, null);
}
]]></handler>
<handler event="DOMMenuItemInactive">
<![CDATA[
if (!this._xulWindow || !this._xulWindow.XULBrowserWindow)
return;
this._xulWindow.XULBrowserWindow.setOverLink("", null);
]]></handler>
</handlers>
</binding>
#endif
<!-- close-tab-button binding
This binding relies on the structure of the tabbrowser binding.
Therefore it should only be used as a child of the tab or the tabs
@ -3273,6 +3509,9 @@
<implementation>
<field name="mOverCloseButton">false</field>
#ifndef USE_TAB_PREVIEWS
<field name="mCorrespondingMenuitem">null</field>
#endif
</implementation>
<handlers>

View File

@ -1300,10 +1300,32 @@ tabpanels {
opacity: 0.0;
}
%ifndef USE_TAB_PREVIEWS
/* All tabs menupopup */
.alltabs-item > .menu-iconic-left > .menu-iconic-icon {
list-style-image: url("chrome://global/skin/icons/folder-item.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);
}
.alltabs-item[selected="true"] {
font-weight: bold;
}
.alltabs-item[busy] > .menu-iconic-left > .menu-iconic-icon {
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
.tabs-alltabs-button > .toolbarbutton-icon {
margin: 0px;
}
%else
.tabs-alltabs-button > .toolbarbutton-icon {
list-style-image: url("chrome://browser/skin/tabbrowser/alltabs.png");
margin: 2px 0 2px;
}
%endif
/* Sidebar */
#sidebar-box .tabs-closebutton {

View File

@ -1747,6 +1747,11 @@ tabbrowser > tabbox > tabpanels {
/**
* New Tab & All Tabs Buttons
*/
%ifndef USE_TAB_PREVIEWS
.tabs-alltabs-box {
margin: 0;
}
%endif
.tabs-newtab-button ,
.tabs-alltabs-button {
@ -1769,11 +1774,17 @@ tabbrowser > tabbox > tabpanels {
background-color: rgba(0,0,0,0.10);
}
.tabs-newtab-button:hover:active,
.tabs-alltabs-button:hover:active {
%ifndef USE_TAB_PREVIEWS
.tabs-alltabs-button[open="true"],
%endif
.tabs-alltabs-button:hover:active{
background-color: rgba(0,0,0,0.20);
}
.tabs-newtab-button > .toolbarbutton-text ,
.tabs-newtab-button > .toolbarbutton-text,
%ifndef USE_TAB_PREVIEWS
.tabs-alltabs-button > .toolbarbutton-menu-dropmarker,
%endif
.tabs-alltabs-button > .toolbarbutton-text {
display: none;
}
@ -1790,6 +1801,24 @@ tabbrowser > tabbox > tabpanels {
opacity: 0.0;
}
%ifndef USE_TAB_PREVIEWS
/**
* All Tabs Menupopup
*/
.alltabs-item > .menu-iconic-left > .menu-iconic-icon {
list-style-image: url("chrome://global/skin/tree/item.png");
}
.alltabs-item[selected="true"] {
font-weight: bold;
}
.alltabs-item[busy] > .menu-iconic-left > .menu-iconic-icon {
list-style-image: url("chrome://global/skin/icons/loading_16.png") !important;
}
%endif
.tabs-closebutton {
padding-right: 4px;
list-style-image: url("chrome://global/skin/icons/closetab.png") !important;

View File

@ -1523,15 +1523,24 @@ tabpanels {
}
.tabs-newtab-button > .toolbarbutton-text,
.tabs-alltabs-button > .toolbarbutton-text {
%ifndef USE_TAB_PREVIEWS
.tabs-alltabs-button > .toolbarbutton-icon,
%endif
.tabs-alltabs-button > .toolbarbutton-text {
display: none;
}
%ifdef USE_TAB_PREVIEWS
.tabs-alltabs-button > .toolbarbutton-icon {
list-style-image: url("chrome://browser/skin/tabbrowser/alltabs.png");
margin: 6px 0 4px;
-moz-image-region: auto;
}
%else
.tabs-alltabs-button > .toolbarbutton-menu-dropmarker {
margin: 2px 1px 2px 0px;
}
%endif
.tabs-alltabs-box-animate {
margin-top: 2px;
@ -1546,6 +1555,22 @@ stack[chromedir="rtl"] > hbox > .tabs-alltabs-box-animate {
background-image: url("chrome://browser/skin/tabbrowser/alltabs-box-overflow-start-bkgnd-animate.png");
}
%ifndef USE_TAB_PREVIEWS
/* All tabs menupopup */
.alltabs-item > .menu-iconic-left > .menu-iconic-icon {
list-style-image: url("chrome://global/skin/icons/folder-item.png");
-moz-image-region: rect(0px, 16px, 16px, 0px);
}
.alltabs-item[selected="true"] {
font-weight: bold;
}
.alltabs-item[busy] > .menu-iconic-left > .menu-iconic-icon {
list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
%endif
/* Tabstrip close button */
.tabs-closebutton {
-moz-appearance: none;