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);