From 3e349f09bb60c91d36cc1866e1a5d9dbfd5ad3c0 Mon Sep 17 00:00:00 2001 From: piro Date: Thu, 22 Apr 2010 08:12:31 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=83=96=E3=83=90=E3=83=BC=E3=81=AE?= =?UTF-8?q?=E5=B9=85=E3=82=84=E9=AB=98=E3=81=95=E3=81=8C=E3=82=A6=E3=82=A3?= =?UTF-8?q?=E3=83=B3=E3=83=89=E3=82=A6=E3=81=AE=E5=A4=A7=E3=81=8D=E3=81=95?= =?UTF-8?q?=E3=82=92=E3=81=AA=E3=82=8B=E3=81=B9=E3=81=8F=E8=B6=85=E3=81=88?= =?UTF-8?q?=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=97=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@6605 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 32 ++++++++++++++++--- content/treestyletab/treestyletabbrowser.js | 7 ++-- .../treestyletabbrowser_autoHide.js | 6 ++-- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 62acee0b..bbc599ad 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -108,6 +108,30 @@ var TreeStyleTabService = { { return window.gToolbox && gToolbox.customizing; }, + + maxTabbarWidth : function TSTService_maxTabbarWidth(aWidth, aTabBrowser) + { + aTabBrowser = aTabBrowser || this.browser; + return Math.min( + aWidth, + parseInt(Math.min( + window.innerWidth, + aTabBrowser.boxObject.width + ) * 0.9) + ); + }, + + maxTabbarHeight : function TSTService_maxTabbarHeight(aHeight, aTabBrowser) + { + aTabBrowser = aTabBrowser || this.browser; + return Math.min( + aHeight, + parseInt(Math.min( + window.innerHeight, + aTabBrowser.boxObject.height + ) * 0.9) + ); + }, /* Initializing */ @@ -1443,13 +1467,13 @@ catch(e) { window.setTimeout(function(aSelf) { if (!b.treeStyleTab.clickedOnTabbarResizerGrippy) { if (!b.treeStyleTab.isVertical) { - aSelf.setTreePref('tabbar.height', box.height); + aSelf.setTreePref('tabbar.height', aSelf.maxTabbarHeight(box.height, b)); } else { if (!b.treeStyleTab.autoHide.expanded) - aSelf.setTreePref('tabbar.shrunkenWidth', box.width); + aSelf.setTreePref('tabbar.shrunkenWidth', aSelf.maxTabbarWidth(box.width, b)); else - aSelf.setTreePref('tabbar.width', box.width); + aSelf.setTreePref('tabbar.width', aSelf.maxTabbarWidth(box.width, b)); } } b.treeStyleTab.updateFloatingTabbar(); @@ -1559,7 +1583,7 @@ catch(e) { }, 250, this); }, updateAeroPeekPreviewsTimer : null, - updateAeroPeekPreviewsInternal : function TSTService_updateAeroPeekPreviewsInternal() + updateAeroPeekPreviewsInternal : function TSTService_updateAeroPeekPreviewsInternal() { this.AeroPeek.windows.some(function(aTabWindow) { if (aTabWindow.win == window) { diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 9c7bcabf..d686cf25 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -942,7 +942,8 @@ TreeStyleTabBrowser.prototype = { this.setTabbrowserAttribute(this.kMODE, 'vertical'); - this.setTabStripAttribute('width', this.getTreePref('tabbar.width')); + let width = this.maxTabbarWidth(this.getTreePref('tabbar.width'), b); + this.setTabStripAttribute('width', width); this.removeTabStripAttribute('height'); b.mPanelContainer.removeAttribute('height'); @@ -960,7 +961,7 @@ TreeStyleTabBrowser.prototype = { /* in Firefox 3, the width of the rightside tab bar unexpectedly becomes 0 on the startup. so, we have to set the width again. */ - aSelf.setTabStripAttribute('width', aSelf.getTreePref('tabbar.width')); + aSelf.setTabStripAttribute('width', width); indicator.setAttribute('ordinal', 1); aSelf.setTabStripAttribute('ordinal', 30); aSplitter.setAttribute('ordinal', 20); @@ -1149,7 +1150,7 @@ TreeStyleTabBrowser.prototype = { } else { this.removeTabbrowserAttribute(this.kFIXED, b); - this.setTabStripAttribute('height', this.getTreePref('tabbar.height')); + this.setTabStripAttribute('height', this.maxTabbarHeight(this.getTreePref('tabbar.height'), b)); if (toggleTabsOnTop) toggleTabsOnTop.setAttribute('disabled', true); } diff --git a/content/treestyletab/treestyletabbrowser_autoHide.js b/content/treestyletab/treestyletabbrowser_autoHide.js index 1dc1f18e..649038b0 100644 --- a/content/treestyletab/treestyletabbrowser_autoHide.js +++ b/content/treestyletab/treestyletabbrowser_autoHide.js @@ -370,9 +370,9 @@ TreeStyleTabBrowserAutoHide.prototype = { if (aForceExpanded || this.expanded || this.mode != this.kMODE_SHRINK) - this.setTreePref('tabbar.width', aWidth); + this.setTreePref('tabbar.width', this.mOwner.maxTabbarWidth(aWidth)); else - this.setTreePref('tabbar.shrunkenWidth', aWidth); + this.setTreePref('tabbar.shrunkenWidth', this.mOwner.maxTabbarWidth(aWidth)); }, updateMenuItem : function TSTAutoHide_updateMenuItem(aNode) @@ -513,7 +513,7 @@ TreeStyleTabBrowserAutoHide.prototype = { default: case this.kMODE_SHRINK: if (pos == 'left' || pos == 'right') - sv.setTabStripAttribute('width', this.getTreePref('tabbar.width')); + sv.setTabStripAttribute('width', sv.maxTabbarWidth(this.getTreePref('tabbar.width'))); break; } sv.updateFloatingTabbar(true);