From 5c58302c7b0f993df9c70718a4b0c5476e1e75f3 Mon Sep 17 00:00:00 2001 From: piro Date: Thu, 9 Sep 2010 10:03:03 +0000 Subject: [PATCH] =?UTF-8?q?API=E5=90=8D=E5=A4=89=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@7165 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletabbrowser.js | 23 +++++++++++---------- install.rdf | 2 +- modules/utils.js | 10 +++++++++ 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 6565787c..620f2099 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -145,11 +145,14 @@ TreeStyleTabBrowser.prototype = { return false; }, - positionVerticalPinnedTabs : function TSTBrowser_positionVerticalPinnedTabs(aWidth, aHeight) + positionPinnedTabs : function TSTBrowser_positionPinnedTabs(aWidth, aHeight) { + if (!this.isVertical) + return; + var b = this.mTabBrowser; var tabbar = b.tabContainer; - var count = b._numPinnedTabs; + var count = this.pinnedTabsCount; var width = aWidth || this.PINNED_TAB_DEFAULT_WIDTH; var height = aHeight || this.PINNED_TAB_DEFAULT_HEIGHT; var maxCol = Math.floor(tabbar.boxObject.width / width); @@ -164,6 +167,7 @@ TreeStyleTabBrowser.prototype = { style.MozMarginStart = ''; style.setProperty('margin-left', (width * col)+'px', 'important'); style.setProperty('margin-top', (- height * (maxRow - row))+'px', 'important'); + style.top = style.right = style.bottom = style.left = ''; col++; if (col >= maxCol) { col = 0; @@ -174,18 +178,15 @@ TreeStyleTabBrowser.prototype = { PINNED_TAB_DEFAULT_WIDTH : 24, PINNED_TAB_DEFAULT_HEIGHT : 24, - clearPinnedTabsAppearance : function TSTBrowser_clearPinnedTabsAppearance() + resetPinnedTabs : function TSTBrowser_resetPinnedTabs() { var b = this.mTabBrowser; var tabbar = b.tabContainer; - tabbar.style.MozMarginStart = ''; - tabbar.style.marginTop = ''; - for (var i = 0, count = b._numPinnedTabs; i < count; i++) + tabbar.style.MozMarginStart = tabbar.style.marginTop = ''; + for (var i = 0, count = this.pinnedTabsCount; i < count; i++) { let style = tabbar.childNodes[i].style; - style.MozMarginStart = ''; - style.marginLeft = ''; - style.marginTop = ''; + style.MozMarginStart = style.marginLeft = style.marginTop = ''; } }, @@ -451,10 +452,10 @@ TreeStyleTabBrowser.prototype = { '{', .toString() ).replace( 'this.mTabstrip.ensureElementIsVisible', diff --git a/install.rdf b/install.rdf index 8fbcc3f5..e213d341 100644 --- a/install.rdf +++ b/install.rdf @@ -5,7 +5,7 @@ -1 ); }, + + get pinnedTabsCount() + { + return this.evaluateXPath( + 'count(child::xul:tab[@pinned="true"])', + this.browser.mTabContainer, + Ci.nsIDOMXPathResult.NUMBER_TYPE + ).numberValue; + }, + /* tabbar position */