diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 54ebb279..abaf0248 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -112,25 +112,15 @@ var TreeStyleTabService = { maxTabbarWidth : function TSTService_maxTabbarWidth(aWidth, aTabBrowser) { aTabBrowser = aTabBrowser || this.browser; - return Math.min( - aWidth, - parseInt(Math.min( - Math.max(window.outerWidth, parseInt(document.documentElement.getAttribute('width'))), - aTabBrowser.boxObject.width - ) * 0.9) - ); + var max = Math.max(window.outerWidth, parseInt(document.documentElement.getAttribute('width') || 0)); + return Math.min(aWidth, max * 0.7); }, maxTabbarHeight : function TSTService_maxTabbarHeight(aHeight, aTabBrowser) { aTabBrowser = aTabBrowser || this.browser; - return Math.min( - aHeight, - parseInt(Math.min( - Math.max(window.outerHeight, parseInt(document.documentElement.getAttribute('height'))), - aTabBrowser.boxObject.height - ) * 0.9) - ); + var max = Math.max(window.outerHeight, parseInt(document.documentElement.getAttribute('height') || 0)); + return Math.min(aHeight, max * 0.7); }, /* Initializing */ diff --git a/modules/utils.js b/modules/utils.js index 160c4338..50014818 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -1725,6 +1725,8 @@ var TreeStyleTabUtils = { var shrunken = this.getTreePref('tabbar.shrunkenWidth'); if (expanded <= shrunken) { this.tabbarWidthResetting = true; + var w = this.browserWindow; + if (w) expanded = Math.min(expanded, w.outerWidth); if (aPrefName == 'extensions.treestyletab.tabbar.width') this.setTreePref('tabbar.shrunkenWidth', parseInt(expanded / 1.5)); else