すべてのタブを一度に閉じようとしていた時などの特別な場合の処理について、Tab Panoramaによってタブがグループ分けされている場合の「他のグループも含めたすべてのタブ」と「現在のグループのすべてのタブ」とで処理を分けるようにした
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@7200 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
8427b2f595
commit
b4d59e9614
@ -558,7 +558,7 @@ var TreeStyleTabService = {
|
||||
if ('_onDragEnd' in aObserver) { // Firefox 3.5 - 3.6
|
||||
eval('aObserver._onDragEnd = '+aObserver._onDragEnd.toSource().replace(
|
||||
/([^\{\}\(\);]*this\.replaceTabWithWindow\()/,
|
||||
'if (this.treeStyleTab.isDraggingAllTabs(draggedTab) || this.treeStyleTab.tabbarDNDObserver.canDragTabbar(arguments[0])) return; $1'
|
||||
'if (this.treeStyleTab.isDraggingAllCurrentTabs(draggedTab) || this.treeStyleTab.tabbarDNDObserver.canDragTabbar(arguments[0])) return; $1'
|
||||
).replace(
|
||||
'{',
|
||||
'{ var treeStyleTab = this.treeStyleTab;'
|
||||
@ -941,7 +941,7 @@ catch(e) {
|
||||
return;
|
||||
|
||||
var draggedTab = dt.mozGetDataAt(TAB_DROP_TYPE, 0);
|
||||
if (sv.isDraggingAllTabs(draggedTab) ||
|
||||
if (sv.isDraggingAllCurrentTabs(draggedTab) ||
|
||||
sv.tabbarDNDObserver.canDragTabbar(aEvent))
|
||||
return;
|
||||
|
||||
@ -2237,7 +2237,7 @@ catch(e) {
|
||||
restoringTree : false,
|
||||
getRestoringTabsCount : function TSTService_getRestoringTabsCount()
|
||||
{
|
||||
return this.getTabsArray(this.browser)
|
||||
return this.getAllTabsArray(this.browser)
|
||||
.filter(function(aTab) {
|
||||
var owner = aTab.linkedBrowser;
|
||||
var data = owner.__SS_data || // Firefox 3.6-
|
||||
|
@ -661,7 +661,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
'{ if (!this.treeStyleTab.warnAboutClosingTabSubtreeOf(this.selectedTab)) return;'
|
||||
));
|
||||
|
||||
let (tabs = this.getTabsArray(b)) {
|
||||
let (tabs = this.getAllTabsArray(b)) {
|
||||
for each (let tab in tabs)
|
||||
{
|
||||
this.initTab(tab);
|
||||
@ -908,7 +908,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (!this.getTreePref('tabbar.invertTabContents')) return;
|
||||
window.setTimeout(function(aSelf) {
|
||||
var b = aSelf.mTabBrowser;
|
||||
var tabs = aAll ? aSelf.getTabsArray(b) : [b.selectedTab] ;
|
||||
var tabs = aAll ? aSelf.getAllTabsArray(b) : [b.selectedTab] ;
|
||||
tabs.forEach(function(aTab) {
|
||||
aSelf.initTabContentsOrder(aTab);
|
||||
});
|
||||
@ -1105,7 +1105,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
}
|
||||
}
|
||||
|
||||
var tabs = this.getTabsArray(b);
|
||||
var tabs = this.getAllTabsArray(b);
|
||||
tabs.forEach(function(aTab) {
|
||||
aTab.style.removeProperty(this.indentCSSProp);
|
||||
aTab.style.removeProperty(this.collapseCSSProp);
|
||||
@ -1553,7 +1553,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
var b = this.mTabBrowser;
|
||||
delete b.tabContainer.treeStyleTab;
|
||||
|
||||
this.getTabsArray(b).forEach(function(aTab) {
|
||||
this.getAllTabsArray(b).forEach(function(aTab) {
|
||||
this.stopTabIndentAnimation(aTab);
|
||||
this.stopTabCollapseAnimation(aTab);
|
||||
this.destroyTab(aTab);
|
||||
@ -1705,7 +1705,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
var b = this.mTabBrowser;
|
||||
var value = this.getPref(aPrefName);
|
||||
var tabContainer = b.mTabContainer;
|
||||
var tabs = this.getTabsArray(b);
|
||||
var tabs = this.getAllTabsArray(b);
|
||||
switch (aPrefName)
|
||||
{
|
||||
case 'extensions.treestyletab.tabbar.position':
|
||||
@ -2386,7 +2386,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
var old = aEvent.detail;
|
||||
if (old > tab._tPos) old--;
|
||||
old = this.getTabsArray(b)[old];
|
||||
old = this.getAllTabsArray(b)[old];
|
||||
|
||||
prev = this.getPreviousSiblingTab(old);
|
||||
next = this.getNextSiblingTab(old);
|
||||
@ -2424,7 +2424,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
if (aOldPosition === void(0)) aOldPosition = aTab._tPos;
|
||||
|
||||
var pos = this.getChildIndex(aTab, parent);
|
||||
var oldPos = this.getChildIndex(this.getTabsArray(this.mTabBrowser)[aOldPosition], parent);
|
||||
var oldPos = this.getChildIndex(this.getAllTabsArray(this.mTabBrowser)[aOldPosition], parent);
|
||||
var delta;
|
||||
if (pos == oldPos) { // no move?
|
||||
return;
|
||||
@ -3509,7 +3509,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
var newRoots = [];
|
||||
var shouldClose = (
|
||||
aInfo.action & this.kACTION_IMPORT &&
|
||||
this.getTabsArray(sourceBrowser).length == draggedTabs.length
|
||||
this.getAllTabsArray(sourceBrowser).length == draggedTabs.length
|
||||
);
|
||||
var oldTabs = [];
|
||||
var newTabs = [];
|
||||
@ -3716,13 +3716,18 @@ TreeStyleTabBrowser.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
isDraggingAllTabs : function TSTBrowser_isDraggingAllTabs(aTab)
|
||||
isDraggingAllTabs : function TSTBrowser_isDraggingAllTabs(aTab, aTabs)
|
||||
{
|
||||
var actionInfo = {
|
||||
action : this.kACTIONS_FOR_DESTINATION | this.kACTION_IMPORT
|
||||
};
|
||||
var tabsInfo = this.getDraggedTabsInfoFromOneTab(actionInfo, aTab);
|
||||
return tabsInfo.draggedTabs.length == this.getTabsArray(this.mTabBrowser).length;
|
||||
return tabsInfo.draggedTabs.length == (aTabs || this.getAllTabsArray(this.mTabBrowser)).length;
|
||||
},
|
||||
|
||||
isDraggingAllCurrentTabs : function TSTBrowser_isDraggingAllCurrentTabs(aTab)
|
||||
{
|
||||
return this.isDraggingAllTabs(aTab, this.getTabsArray(this.mTabBrowser));
|
||||
},
|
||||
|
||||
/* commands */
|
||||
@ -3755,7 +3760,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
|
||||
resetAllTabs : function TSTBrowser_resetAllTabs(aPartChildren)
|
||||
{
|
||||
this.getTabsArray(this.mTabBrowser).forEach(function(aTab) {
|
||||
this.getAllTabsArray(this.mTabBrowser).forEach(function(aTab) {
|
||||
this.resetTab(aTab, aPartChildren);
|
||||
}, this);
|
||||
},
|
||||
@ -3775,7 +3780,7 @@ TreeStyleTabBrowser.prototype = {
|
||||
}
|
||||
else {
|
||||
this.removeTabbrowserAttribute(this.kALLOW_COLLAPSE);
|
||||
this.getTabsArray(this.browser).forEach(function(aTab) {
|
||||
this.getAllTabsArray(this.browser).forEach(function(aTab) {
|
||||
this.updateTabIndent(aTab, 0, true);
|
||||
}, this);
|
||||
}
|
||||
|
@ -1222,7 +1222,7 @@ TreeStyleTabBrowserAutoHide.prototype = {
|
||||
this.cancelDelayedShowForShortcut();
|
||||
|
||||
if (
|
||||
sv.getTabs(b).snapshotLength > 1 &&
|
||||
sv.getTabsArray(b).length > 1 &&
|
||||
!aEvent.altKey &&
|
||||
TreeStyleTabService.accelKeyPressed
|
||||
) {
|
||||
|
@ -836,7 +836,7 @@ var TreeStyleTabUtils = {
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShell);
|
||||
var tabs = this.getTabsArray(b);
|
||||
var tabs = this.getAllTabsArray(b);
|
||||
for each (var tab in tabs)
|
||||
{
|
||||
if (tab.linkedBrowser.docShell == docShell)
|
||||
@ -1016,6 +1016,23 @@ var TreeStyleTabUtils = {
|
||||
).booleanValue;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all tabs in the current group as a XPathResult.
|
||||
* It includes tabs hidden by Tab Panorama.
|
||||
*/
|
||||
getAllTabs : function TSTUtils_getTabs(aTabBrowserChild) /* OBSOLETE */
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabBrowserChild);
|
||||
return this.evaluateXPath(
|
||||
'descendant::xul:tab',
|
||||
b.mTabContainer
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all tabs in the current group as a XPathResult.
|
||||
* It excludes tabs hidden by Tab Panorama.
|
||||
*/
|
||||
getTabs : function TSTUtils_getTabs(aTabBrowserChild) /* OBSOLETE */
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabBrowserChild);
|
||||
@ -1025,12 +1042,29 @@ var TreeStyleTabUtils = {
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all tabs in the current group as an array.
|
||||
* It includes tabs hidden by Tab Panorama.
|
||||
*/
|
||||
getAllTabsArray : function TSTUtils_getAllTabsArray(aTabBrowserChild)
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabBrowserChild);
|
||||
return Array.slice(b.mTabContainer.childNodes) ;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns all tabs in the current group as an array.
|
||||
* It excludes tabs hidden by Tab Panorama.
|
||||
*/
|
||||
getTabsArray : function TSTUtils_getTabsArray(aTabBrowserChild)
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabBrowserChild);
|
||||
return b.visibleTabs || Array.slice(b.mTabContainer.childNodes) ;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the first tab in the current group.
|
||||
*/
|
||||
getFirstTab : function TSTUtils_getFirstTab(aTabBrowserChild)
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabBrowserChild);
|
||||
@ -1038,6 +1072,9 @@ var TreeStyleTabUtils = {
|
||||
return tabs ? tabs[0] : b.mTabContainer.firstChild;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the first visible, not collapsed, and not pinned tab.
|
||||
*/
|
||||
getFirstNormalTab : function TSTUtils_getFirstNormalTab(aTabBrowserChild)
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabBrowserChild);
|
||||
@ -1048,6 +1085,9 @@ var TreeStyleTabUtils = {
|
||||
).singleNodeValue;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the last tab in the current group.
|
||||
*/
|
||||
getLastTab : function TSTUtils_getLastTab(aTabBrowserChild)
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabBrowserChild);
|
||||
@ -1055,6 +1095,9 @@ var TreeStyleTabUtils = {
|
||||
return tabs ? tabs[tabs.length-1] : b.mTabContainer.lastChild ;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the next tab in the current group.
|
||||
*/
|
||||
getNextTab : function TSTUtils_getNextTab(aTab)
|
||||
{
|
||||
if (!aTab) return null;
|
||||
@ -1069,6 +1112,9 @@ var TreeStyleTabUtils = {
|
||||
return (tab && tab.localName == 'tab') ? tab : null ;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the previous tab in the current group.
|
||||
*/
|
||||
getPreviousTab : function TSTUtils_getPreviousTab(aTab)
|
||||
{
|
||||
if (!aTab) return null;
|
||||
@ -1083,6 +1129,9 @@ var TreeStyleTabUtils = {
|
||||
return (tab && tab.localName == 'tab') ? tab : null ;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the index of the specified tab, in the current group.
|
||||
*/
|
||||
getTabIndex : function TSTUtils_getTabIndex(aTab)
|
||||
{
|
||||
if (!aTab) return -1;
|
||||
@ -1090,6 +1139,9 @@ var TreeStyleTabUtils = {
|
||||
return this.getTabsArray(b).indexOf(aTab);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the next not collapsed tab in the current group.
|
||||
*/
|
||||
getNextVisibleTab : function TSTUtils_getNextVisibleTab(aTab)
|
||||
{
|
||||
if (!aTab) return null;
|
||||
@ -1106,6 +1158,9 @@ var TreeStyleTabUtils = {
|
||||
return (index < tabs.length-1) ? tabs[index+1] : null ;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the previous not collapsed tab in the current group.
|
||||
*/
|
||||
getPreviousVisibleTab : function TSTUtils_getPreviousVisibleTab(aTab)
|
||||
{
|
||||
if (!aTab) return null;
|
||||
@ -1122,6 +1177,9 @@ var TreeStyleTabUtils = {
|
||||
return (index > 0) ? tabs[index-1] : null ;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the last not collapsed tab in the current group.
|
||||
*/
|
||||
getLastVisibleTab : function TSTUtils_getLastVisibleTab(aTabBrowserChild)
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabBrowserChild);
|
||||
@ -1130,6 +1188,9 @@ var TreeStyleTabUtils = {
|
||||
return tabs.length ? tabs[tabs.length-1] : null ;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a XPathResult of not collapsed tabs in the current group.
|
||||
*/
|
||||
getVisibleTabs : function TSTUtils_getVisibleTabs(aTabBrowserChild) /* OBSOLETE */
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabBrowserChild);
|
||||
@ -1143,6 +1204,9 @@ var TreeStyleTabUtils = {
|
||||
return XPathResult;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns an array of not collapsed tabs in the current group.
|
||||
*/
|
||||
getVisibleTabsArray : function TSTUtils_getVisibleTabsArray(aTabBrowserChild)
|
||||
{
|
||||
var b = this.getTabBrowserFromChild(aTabBrowserChild);
|
||||
@ -1154,6 +1218,10 @@ var TreeStyleTabUtils = {
|
||||
tabs ;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the index of the specified tab, in the array of not collapsed
|
||||
* tabs in the current group.
|
||||
*/
|
||||
getVisibleIndex : function TSTUtils_getVisibleIndex(aTab)
|
||||
{
|
||||
if (!aTab) return -1;
|
||||
@ -1459,7 +1527,7 @@ var TreeStyleTabUtils = {
|
||||
var b = this.getTabBrowserFromChild(aTab);
|
||||
return (
|
||||
this.shouldCloseTabSubtreeOf(aTab) &&
|
||||
this.getDescendantTabs(aTab).length + 1 == this.getTabsArray(b).length
|
||||
this.getDescendantTabs(aTab).length + 1 == this.getAllTabsArray(b).length
|
||||
);
|
||||
},
|
||||
shouldCloseLastTabSubTreeOf : function() { return this.shouldCloseLastTabSubtreeOf.apply(this, arguments); }, // obsolete, for backward compatibility
|
||||
|
Loading…
x
Reference in New Issue
Block a user