diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js index 109664bc..52b33a51 100644 --- a/content/treestyletab/hacks.js +++ b/content/treestyletab/hacks.js @@ -477,10 +477,10 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function() { window.BrowserHome = window.TM_BrowserHome; window.BrowserOpenTab = window.TMP_BrowserOpenTab; - gBrowser.treeStyleTab.internallyTabMoving = false; + gBrowser.treeStyleTab.internallyTabMovingCount--; }, 0); - gBrowser.treeStyleTab.internallyTabMoving = true; // until "TMmoveTabTo" method is overwritten + gBrowser.treeStyleTab.internallyTabMovingCount++; // until "TMmoveTabTo" method is overwritten } diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 448804df..c4a408ae 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -124,6 +124,10 @@ TreeStyleTabBrowser.prototype = { { var b = this.mTabBrowser; + this.internallyTabMovingCount = 0; + this.subTreeMovingCount = 0; + this.subTreeChildrenMovingCount = 0; + let (splitter, toggler) { splitter = document.getAnonymousElementByAttribute(b, 'class', this.kSPLITTER); if (!splitter) { @@ -335,7 +339,7 @@ TreeStyleTabBrowser.prototype = { ).replace( 'this.moveTabToStart();', ) ); @@ -360,7 +364,7 @@ TreeStyleTabBrowser.prototype = { ).replace( 'this.moveTabToEnd();', ) ); @@ -1379,9 +1383,9 @@ TreeStyleTabBrowser.prototype = { if (newIndex > -1) { if (newIndex > tab._tPos) newIndex--; - this.internallyTabMoving = true; + this.internallyTabMovingCount++; b.moveTabTo(tab, newIndex); - this.internallyTabMoving = false; + this.internallyTabMovingCount--; } } @@ -1612,12 +1616,12 @@ TreeStyleTabBrowser.prototype = { var b = this.mTabBrowser; this.initTabContents(tab); // twisty vanished after the tab is moved!! - if (this.hasChildTabs(tab) && !this.isSubTreeMoving) { + if (this.hasChildTabs(tab) && !this.subTreeMovingCount) { this.moveTabSubTreeTo(tab, tab._tPos); } var parentTab = this.getParentTab(tab); - if (parentTab && !this.isSubTreeChildrenMoving) { + if (parentTab && !this.subTreeChildrenMovingCount) { this.updateChildrenArray(parentTab); } @@ -1662,8 +1666,8 @@ TreeStyleTabBrowser.prototype = { this.deleteTabValue(old, this.kINSERT_BEFORE); if ( - this.isSubTreeMoving || - this.internallyTabMoving + this.subTreeMovingCount || + this.internallyTabMovingCount ) return; @@ -2548,10 +2552,10 @@ TreeStyleTabBrowser.prototype = { var newIndex = aInfo.insertBefore ? aInfo.insertBefore._tPos : lastTabIndex ; if (aInfo.insertBefore && newIndex > tab._tPos) newIndex--; - this.internallyTabMoving = true; + this.internallyTabMovingCount++; targetBrowser.moveTabTo(tab, newIndex); this.collapseExpandTab(tab, false, true); - this.internallyTabMoving = false; + this.internallyTabMovingCount--; }, this); @@ -3096,21 +3100,21 @@ TreeStyleTabBrowser.prototype = { if (!aTab) return; var b = this.mTabBrowser; - this.isSubTreeMoving = true; + this.subTreeMovingCount++; - this.internallyTabMoving = true; + this.internallyTabMovingCount++; b.moveTabTo(aTab, aIndex); - this.internallyTabMoving = false; + this.internallyTabMovingCount--; - this.isSubTreeChildrenMoving = true; - this.internallyTabMoving = true; + this.subTreeChildrenMovingCount++; + this.internallyTabMovingCount++; this.getDescendantTabs(aTab).forEach(function(aDescendantTab, aIndex) { b.moveTabTo(aDescendantTab, aTab._tPos + aIndex + (aTab._tPos < aDescendantTab._tPos ? 1 : 0 )); }, this); - this.internallyTabMoving = false; - this.isSubTreeChildrenMoving = false; + this.internallyTabMovingCount--; + this.subTreeChildrenMovingCount--; - this.isSubTreeMoving = false; + this.subTreeMovingCount--; }, moveTabLevel : function(aEvent) @@ -3138,14 +3142,14 @@ TreeStyleTabBrowser.prototype = { else { var nextTab = this.getNextSiblingTab(parentTab); this.partTab(b.mCurrentTab); - this.internallyTabMoving = true; + this.internallyTabMovingCount++; if (nextTab) { b.moveTabTo(b.mCurrentTab, nextTab._tPos - 1); } else { b.moveTabTo(b.mCurrentTab, this.getLastTab(b)._tPos); } - this.internallyTabMoving = false; + this.internallyTabMovingCount--; b.mCurrentTab.focus(); return true; } diff --git a/content/treestyletab/treestyletabbrowser_autoHide.js b/content/treestyletab/treestyletabbrowser_autoHide.js index 565188ba..4d79a259 100644 --- a/content/treestyletab/treestyletabbrowser_autoHide.js +++ b/content/treestyletab/treestyletabbrowser_autoHide.js @@ -844,7 +844,7 @@ TreeStyleTabBrowserAutoHide.prototype = { return; case 'TabMove': - if (!this.mOwner.isSubTreeMoving && !this.mOwner.internallyTabMoving) + if (!this.mOwner.subTreeMovingCount && !this.mOwner.internallyTabMovingCount) this.showForFeedback(); return;