不可視のタブがある時にツリーの構造がおかしくなる問題に対処(不可視のタブは自動的に下に寄せるようにした)

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@7282 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-10-13 15:06:41 +00:00
parent 79276e57e9
commit faf4d3a47d

View File

@ -2550,6 +2550,7 @@ TreeStyleTabBrowser.prototype = {
this.internallyTabMovingCount++; this.internallyTabMovingCount++;
var tabs = this.getAllTabsArray(this.mTabBrowser); var tabs = this.getAllTabsArray(this.mTabBrowser);
aChangedTabs = aChangedTabs || tabs; aChangedTabs = aChangedTabs || tabs;
var lastVisibleTab = this.getLastVisibleTab(this.mTabBrowser);
tabs.reverse().forEach(function(aTab) { tabs.reverse().forEach(function(aTab) {
var parent = this.getParentTab(aTab); var parent = this.getParentTab(aTab);
var attached = false; var attached = false;
@ -2573,6 +2574,7 @@ TreeStyleTabBrowser.prototype = {
this.partTab(aTab); this.partTab(aTab);
} }
} }
if ( if (
!aTab.hidden && !aTab.hidden &&
!attached && !attached &&
@ -2580,6 +2582,15 @@ TreeStyleTabBrowser.prototype = {
aChangedTabs.indexOf(aTab) > -1 aChangedTabs.indexOf(aTab) > -1
) )
this.attachTabFromPosition(aTab, tabs.length-1); this.attachTabFromPosition(aTab, tabs.length-1);
// Hidden tabs have to be moved below visible tabs, because
// sometimes hidden tabs between visible tabs break tree
// structure.
if (aTab.hidden) {
let newPos = lastVisibleTab._tPos;
if (aTab.tPos < lastVisibleTab._tPos) newPos--;
this.mTabBrowser.moveTabTo(aTab, newPos);
}
}, this); }, this);
this.internallyTabMovingCount--; this.internallyTabMovingCount--;
}, },