自動でサブツリーを開閉するとき、他のサブツリーについてはルートだけをたたむようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1230 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-10-19 01:59:43 +00:00
parent 3e94c50af9
commit f6c034ec86

View File

@ -997,7 +997,8 @@ var TreeStyleTabService = {
collapseExpandTreesIntelligentlyFor : function(aTab) collapseExpandTreesIntelligentlyFor : function(aTab)
{ {
var b = this.getTabBrowserFromChildren(aTab); var b = this.getTabBrowserFromChildren(aTab);
var parent = this.getParentTabOf(aTab);
var expandedParentTabs = [ var expandedParentTabs = [
aTab.getAttribute(this.kID) aTab.getAttribute(this.kID)
]; ];
@ -1016,18 +1017,24 @@ var TreeStyleTabService = {
null null
); );
var collapseTab; var collapseTab;
var isDescendant; var dontCollapse;
for (var i = 0, maxi = xpathResult.snapshotLength; i < maxi; i++) for (var i = 0, maxi = xpathResult.snapshotLength; i < maxi; i++)
{ {
isDescendant = false; dontCollapse = false;
collapseTab = xpathResult.snapshotItem(i); collapseTab = xpathResult.snapshotItem(i);
var parentTab = collapseTab;
while (parentTab = this.getParentTabOf(parentTab)) parentTab = this.getParentTabOf(collapseTab);
{ if (parentTab) {
if (parentTab != aTab) continue; dontCollapse = true;
isDescendant = true; do {
if (parentTab != parent) continue;
dontCollapse = false;
break;
}
while (parentTab = this.getParentTabOf(parentTab));
} }
if (!isDescendant)
if (!dontCollapse)
this.collapseExpandTabSubTree(collapseTab, true); this.collapseExpandTabSubTree(collapseTab, true);
} }
} }