From d3d440cd392c24f63ff30a99e8a7dba523861ce0 Mon Sep 17 00:00:00 2001 From: piro Date: Mon, 20 Apr 2009 13:00:05 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=83=8B=E3=83=A1=E3=83=BC=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E5=8A=B9=E6=9E=9C=E3=81=AE=E9=96=8B=E5=A7=8B?= =?UTF-8?q?=E3=82=BF=E3=82=A4=E3=83=9F=E3=83=B3=E3=82=B0=E3=82=92=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= 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@4149 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletabbrowser.js | 28 +++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 0ad72e18..58d1a9b0 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -1432,6 +1432,8 @@ TreeStyleTabBrowser.prototype = { this.setTabValue(tab, this.kINSERT_BEFORE, next.getAttribute(this.kID)); var backupAttributes = {}; + var indentModifiedTabs = []; + if (firstChild) { backupAttributes[this.kCHILDREN] = this.getTabValue(tab, this.kCHILDREN); let children = this.getChildTabs(tab); @@ -1453,11 +1455,9 @@ TreeStyleTabBrowser.prototype = { this.partTab(aTab, true); } ), this); - this.updateTabsIndent(children); - this.checkTabsIndentOverflow(); - if (closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_ATTACH) { + indentModifiedTabs = indentModifiedTabs.concat(children); + if (closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_ATTACH) nextFocusedTab = firstChild; - } } if (parentTab) { @@ -1496,8 +1496,9 @@ TreeStyleTabBrowser.prototype = { ) b.selectedTab = nextFocusedTab; + if (indentModifiedTabs.length) + this.updateTabsIndentWithDelay(indentModifiedTabs); this.checkTabsIndentOverflow(); - this.showTabbarForFeedback(); for (var i in backupAttributes) @@ -2795,6 +2796,23 @@ TreeStyleTabBrowser.prototype = { this.updateTabsIndent(this.getChildTabs(aTab), aLevel+1, aProp); }, this); }, + updateTabsIndentWithDelay : function() + { + if (this.updateTabsIndentWithDelayTimer) + window.clearTimeout(this.updateTabsIndentWithDelayTimer); + + this.updateTabsIndentWithDelayTasks.push(Array.slice(arguments)); + + this.updateTabsIndentWithDelayTimer = window.setTimeout(function(aSelf) { + aSelf.updateTabsIndentWithDelayTasks.forEach(function(aTask) { + aSelf.updateTabsIndent.apply(aSelf, aTask); + }, aSelf); + window.clearTimeout(aSelf.updateTabsIndentWithDelayTimer); + aSelf.updateTabsIndentWithDelayTimer = null; + }, 0, this); + }, + updateTabsIndentWithDelayTasks : [], + updateTabsIndentWithDelayTimer : null, updateTabIndent : function(aTab, aProp, aIndent, aJustNow) {