From ce750c00901885f3a8744d6ac0c41e884a576f09 Mon Sep 17 00:00:00 2001 From: piro Date: Thu, 19 Jun 2008 00:15:57 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=B9=E3=82=AF=E3=83=AD=E3=83=BC=E3=83=AB?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E3=82=92=E5=BF=85=E3=81=9A=E6=88=BB=E3=81=99?= =?UTF-8?q?=E5=87=A6=E7=90=86=E3=82=92=E5=8A=A0=E3=81=88=E3=81=9F?= 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@2680 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletabbrowser.js | 35 ++++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 5bbb996d..db80893a 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -111,6 +111,7 @@ TreeStyleTabBrowser.prototype = { b.mTabContainer.addEventListener('dblclick', this, true); b.mTabContainer.addEventListener('mousedown', this, true); b.mTabContainer.addEventListener('select', this, true); + b.mTabContainer.addEventListener('scroll', this, true); var selectNewTab = '_selectNewTab' in b.mTabContainer ? '_selectNewTab' : 'selectNewTab' ; // Fx3 / Fx2 @@ -193,11 +194,7 @@ TreeStyleTabBrowser.prototype = { } return false; }; - if (treeStyleTab.isVertical) { - window.setTimeout(ensureTabVisibleByTST, 0, this.selectedItem); - return; - } - else if (ensureTabVisibleByTST(this.selectedItem)) { + if (ensureTabVisibleByTST(this.selectedItem)) { return; } ]]> @@ -792,6 +789,7 @@ TreeStyleTabBrowser.prototype = { b.mTabContainer.removeEventListener('dblclick', this, true); b.mTabContainer.removeEventListener('mousedown', this, true); b.mTabContainer.removeEventListener('select', this, true); + b.mTabContainer.removeEventListener('scroll', this, true); var tabContext = document.getAnonymousElementByAttribute(b, 'anonid', 'tabContextMenu'); tabContext.removeEventListener('popupshowing', this, false); @@ -974,6 +972,12 @@ TreeStyleTabBrowser.prototype = { case 'TabClose': this.onTabRemoved(aEvent); + + var x = {}, y = {}; + var scrollBoxObject = this.mTabBrowser.mTabContainer.mTabstrip.scrollBoxObject; + scrollBoxObject.getPosition(x, y); + this.lastScrollX = x.value; + this.lastScrollY = y.value; return; case 'TabMove': @@ -1103,7 +1107,20 @@ TreeStyleTabBrowser.prototype = { return; case 'scroll': - this.redrawContentArea(); + var node = aEvent.originalTarget; + if (node && node.ownerDocument == document) { + if (this.lastScrollX < 0 || this.lastScrollY < 0) return; + var x = {}, y = {}; + var scrollBoxObject = this.mTabBrowser.mTabContainer.mTabstrip.scrollBoxObject; + scrollBoxObject.getPosition(x, y); + if (x.value != this.lastScrollX || y.value != this.lastScrollY) + scrollBoxObject.scrollTo(this.lastScrollX, this.lastScrollY); + this.lastScrollX = -1; + this.lastScrollY = -1; + } + else if (this.autoHideEnabled) { + this.redrawContentArea(); + } return; case 'load': @@ -1163,6 +1180,8 @@ TreeStyleTabBrowser.prototype = { return; } }, + lastScrollX : -1, + lastScrollY : -1, onTabAdded : function(aEvent) { @@ -3160,9 +3179,9 @@ TreeStyleTabBrowser.prototype = { this.mTabBrowser.addEventListener('mousedown', this, true); this.mTabBrowser.addEventListener('mouseup', this, true); - this.mTabBrowser.addEventListener('scroll', this, true); this.mTabBrowser.addEventListener('resize', this, true); this.mTabBrowser.addEventListener('load', this, true); + this.mTabBrowser.mPanelContainer.addEventListener('scroll', this, true); if (this.getTreePref('tabbar.autoShow.mousemove')) this.startListenMouseMove(); @@ -3184,9 +3203,9 @@ TreeStyleTabBrowser.prototype = { this.mTabBrowser.removeEventListener('mousedown', this, true); this.mTabBrowser.removeEventListener('mouseup', this, true); - this.mTabBrowser.removeEventListener('scroll', this, true); this.mTabBrowser.removeEventListener('resize', this, true); this.mTabBrowser.removeEventListener('load', this, true); + this.mTabBrowser.mPanelContainer.removeEventListener('scroll', this, true); this.endListenMouseMove(); this.clearTabbarCanvas();