From 54f00c8102409a46977d7cff9c87a9d6a31f7786 Mon Sep 17 00:00:00 2001 From: piro Date: Thu, 16 Sep 2010 13:37:41 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=B0=E3=83=AB=E3=83=BC=E3=83=97=E3=81=AE?= =?UTF-8?q?=E8=87=AA=E5=8B=95=E7=9A=84=E3=81=AA=E5=86=8D=E6=A7=8B=E6=88=90?= =?UTF-8?q?=E3=82=92=E3=82=88=E3=82=8A=E8=B3=A2=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@7245 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletabbrowser.js | 62 ++++++++++----------- 1 file changed, 28 insertions(+), 34 deletions(-) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 7250ddd0..e56d1f02 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -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)