グループの自動的な再構成をより賢く

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@7245 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-09-16 13:37:41 +00:00
parent 801e04b795
commit 54f00c8102

View File

@ -2547,47 +2547,41 @@ TreeStyleTabBrowser.prototype = {
tabVisibilityChangedTabs : [],
updateTreeByTabVisibility : function TSTBrowser_updateTreeByTabVisibility(aChangedTabs)
{
aChangedTabs = aChangedTabs || [];
var hiddenTabs = aChangedTabs.filter(function(aTab) { return aTab.hidden; });
var shownTabs = aChangedTabs.filter(function(aTab) { return !aTab.hidden; });
var tabs = this.getAllTabsArray(this.mTabBrowser);
aChangedTabs.forEach(function(aTab) {
this.collapseExpandTab(aTab, false, true);
if (aTab.hidden) {
this.partAllChildren(aTab, {
behavior : this.getParentTab(aTab) ?
this.getTreePref('closeParentBehavior') :
this.getTreePref('closeRootBehavior')
});
this.partTab(aTab);
}
else {
this.attachTabFromPosition(aTab, tabs.length-1);
}
}, this);
/*
this.internallyTabMovingCount++;
var tabs = this.getAllTabsArray(this.mTabBrowser);
aChangedTabs = aChangedTabs || tabs;
tabs.reverse().forEach(function(aTab) {
var parent = this.getParentTab(aTab);
var attached = false;
if (parent && aTab.hidden != parent.hidden) {
this.collapseExpandTab(aTab, false, true);
let target = (
parent.hidden &&
aChangedTabs.indexOf(parent) > -1
) ? parent : aTab ;
this.partAllChildren(target, {
behavior : parent ?
this.getTreePref('closeParentBehavior') :
this.getTreePref('closeRootBehavior')
});
this.partTab(target);
var ancestor = parent;
var lastNextTab = null;
while (ancestor = this.getParentTab(ancestor))
{
if (ancestor.hidden == aTab.hidden) {
this.attachTabTo(aTab, ancestor, {
dontMove : true,
insertBefore : lastNextTab
});
attached = true;
break;
}
lastNextTab = this.getNextSiblingTab(ancestor);
}
if (!attached) {
this.collapseExpandTab(aTab, false, true);
this.partTab(aTab);
}
}
if (!aTab.hidden && aChangedTabs.indexOf(aTab) > -1)
if (
!aTab.hidden &&
!attached &&
!parent &&
aChangedTabs.indexOf(aTab) > -1
)
this.attachTabFromPosition(aTab, tabs.length-1);
}, this);
*/
this.internallyTabMovingCount--;
},
onTabRestoring : function TSTBrowser_onTabRestoring(aEvent)