From b665a8ca11c9f308457a0b776c2f59920c57aae4 Mon Sep 17 00:00:00 2001 From: Piro / SHIMODA Hiroshi Date: Sat, 22 Jan 2011 13:38:08 +0900 Subject: [PATCH] don't update advanceSelectedTab twice --- content/treestyletab/treestyletabbrowser.js | 66 ++++++++++++--------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 38ae6daa..ffc86b11 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -1049,34 +1049,19 @@ TreeStyleTabBrowser.prototype = { { var b = this.mTabBrowser; - eval('b.mTabContainer.advanceSelectedTab = '+ - b.mTabContainer.advanceSelectedTab.toSource().replace( - '{', - - ) - ); + var source = b.mTabContainer.advanceSelectedTab.toSource(); + if (source.indexOf('treeStyleTab.handleAdvanceSelectedTab') < 0) { + eval('b.mTabContainer.advanceSelectedTab = '+ + source.replace( + '{', + + ) + ); + } eval('b.mTabContainer._notifyBackgroundTab = '+ b.mTabContainer._notifyBackgroundTab.toSource().replace( @@ -1668,6 +1653,7 @@ TreeStyleTabBrowser.prototype = { this.removeTabStripAttribute('width'); this.removeTabStripAttribute('height'); this.removeTabStripAttribute('ordinal'); + this._endListenTabbarEvents(); this.mTabBrowser.mTabContainer.parentNode.classList.remove(this.kTABBAR_TOOLBAR); }, @@ -3192,6 +3178,30 @@ TreeStyleTabBrowser.prototype = { } }, + handleAdvanceSelectedTab : function TSTBrowser_handleAdvanceSelectedTab(aDir, aWrap, aTabbar) + { + this._focusChangedByShortcut = TreeStyleTabService.accelKeyPressed; + + if (!this.canCollapseSubtree(aTabbar.selectedItem) || + this.getTreePref('focusMode') != this.kFOCUS_VISIBLE) + return false; + + var nextTab = (aDir < 0) ? this.getPreviousVisibleTab(aTabbar.selectedItem) : this.getNextVisibleTab(aTabbar.selectedItem) ; + if (!nextTab && aWrap) { + nextTab = this.evaluateXPath( + 'child::xul:tab[not(@'+this.kCOLLAPSED+'="true")]['+ + (aDir < 0 ? 'last()' : '1' )+ + ']', + aTabbar, + XPathResult.FIRST_ORDERED_NODE_TYPE + ).singleNodeValue; + } + if (nextTab && nextTab != aTabbar.selectedItem) + aTabbar._selectNewTab(nextTab, aDir, aWrap); + + return true; + }, + onTabClick : function TSTBrowser_onTabClick(aEvent, aTab) { aTab = aTab || this.getTabFromEvent(aEvent);