ツリーの子だけを閉じる機能が働かなくなっていた

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5680 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-12-27 11:22:44 +00:00
parent ee71505b0f
commit 47826d2029
2 changed files with 30 additions and 27 deletions

View File

@ -1279,43 +1279,30 @@ catch(e) {
removeTabSubtree : function TSTService_removeTabSubtree(aTabOrTabs, aOnlyChildren)
{
var tabs = this.gatherSubtreeMemberTabs(aTabOrTabs, aOnlyChildren);
var tabs = this.gatherSubtreeMemberTabs(aTabOrTabs);
if (!this.warnAboutClosingTabs(tabs.length))
return;
this.splitTabsToSubtrees(tabs).forEach(function(aTabs) {
if (!this.fireTabSubtreeClosingEvent(aTabs[0], aTabs))
return;
this.markAsClosedSet(aTabs);
var b = this.getTabBrowserFromChild(aTabs[0]);
for (var i = tabs.length-1; i > -1; i--)
if (aOnlyChildren)
aTabs = aTabs.slice(1);
if (!aTabs.length)
return;
this.stopRendering();
this.markAsClosedSet(aTabs);
for (var i = aTabs.length-1; i > -1; i--)
{
b.removeTab(aTabs[i]);
}
this.startRendering();
this.fireTabSubtreeClosedEvent(b, aTabs[0], aTabs)
}, this);
},
removeTabSubTree : function() { return this.removeTabSubtree.apply(this, arguments); }, // obsolete, for backward compatibility
splitTabsToSubtrees : function TSTService_splitTabsToSubtrees(aTabs) /* PUBLIC API */
{
var groups = [];
var group = [];
this.cleanUpTabsArray(aTabs)
.forEach(function(aTab) {
var parent = this.getParentTab(aTab);
if (group.indexOf(parent) < 0) {
groups.push(group);
group = [aTab];
}
else {
group.push(aTab);
}
}, this);
groups.push(group);
return groups;
},
fireTabSubtreeClosingEvent : function TSTService_fireTabSubtreeClosingEvent(aParentTab, aClosedTabs)
{
/* PUBLIC API */

View File

@ -726,7 +726,7 @@ var TreeStyleTabUtils = {
return aA._tPos - aB._tPos;
},
gatherSubtreeMemberTabs : function TSTUtils_gatherSubtreeMemberTabs(aTabOrTabs, aOnlyChildren)
gatherSubtreeMemberTabs : function TSTUtils_gatherSubtreeMemberTabs(aTabOrTabs)
{
var tabs = aTabOrTabs;
if (!(tabs instanceof Array)) {
@ -740,14 +740,30 @@ var TreeStyleTabUtils = {
descendant = descendant.concat(b.treeStyleTab.getDescendantTabs(tabs[i]));
}
if (aOnlyChildren)
tabs = this.cleanUpTabsArray(descendant);
else
tabs = this.cleanUpTabsArray(tabs.concat(descendant));
return tabs;
},
splitTabsToSubtrees : function TSTUtils_splitTabsToSubtrees(aTabs) /* PUBLIC API */
{
var groups = [];
var group = [];
this.cleanUpTabsArray(aTabs)
.forEach(function(aTab) {
var parent = this.getParentTab(aTab);
if (!parent || group.indexOf(parent) < 0) {
if (group.length) groups.push(group);
group = [aTab];
}
else {
group.push(aTab);
}
}, this);
if (group.length) groups.push(group);
return groups;
},
// tabbrowser
getTabBrowserFromChild : function TSTUtils_getTabBrowserFromChild(aTabBrowserChild)