From a4a693080fd7ea18db862bfad08ef30d7843b297 Mon Sep 17 00:00:00 2001 From: piro Date: Thu, 22 Apr 2010 09:24:21 +0000 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=E8=87=AA=E5=8B=95=E3=81=A7=E7=95=B3?= =?UTF-8?q?=E3=82=80=E3=80=8D=E7=8A=B6=E6=85=8B=E3=81=AE=E6=99=82=E3=81=AE?= =?UTF-8?q?=E3=82=BF=E3=83=96=E3=83=90=E3=83=BC=E3=81=AE=E3=83=AA=E3=82=B5?= =?UTF-8?q?=E3=82=A4=E3=82=BA=E3=81=A7=E3=82=BF=E3=83=96=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=81=AE=E5=A4=A7=E3=81=8D=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=82=88=E3=82=8A=E5=A4=A7=E3=81=8D?= =?UTF-8?q?=E3=81=8F=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=97=E3=81=BE=E3=81=86?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E6=80=A7=E3=82=92=E7=84=A1=E3=81=8F=E3=81=97?= =?UTF-8?q?=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@6610 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 4 ++-- modules/utils.js | 30 +++++++++++++++++++++------- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index abaf0248..720209b1 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -113,14 +113,14 @@ var TreeStyleTabService = { { aTabBrowser = aTabBrowser || this.browser; var max = Math.max(window.outerWidth, parseInt(document.documentElement.getAttribute('width') || 0)); - return Math.min(aWidth, max * 0.7); + return Math.min(aWidth, max * this.DEFAULT_SHRUNKEN_WIDTH_RATIO); }, maxTabbarHeight : function TSTService_maxTabbarHeight(aHeight, aTabBrowser) { aTabBrowser = aTabBrowser || this.browser; var max = Math.max(window.outerHeight, parseInt(document.documentElement.getAttribute('height') || 0)); - return Math.min(aHeight, max * 0.7); + return Math.min(aHeight, max * this.DEFAULT_SHRUNKEN_WIDTH_RATIO); }, /* Initializing */ diff --git a/modules/utils.js b/modules/utils.js index 50014818..605540dd 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -143,6 +143,9 @@ var TreeStyleTabUtils = { kINSERT_FISRT : 0, kINSERT_LAST : 1, + + MAX_TABBAR_SIZE_RATIO : 0.8, + DEFAULT_SHRUNKEN_WIDTH_RATIO : 0.67, /* base variables */ baseIndent : 12, @@ -1723,14 +1726,27 @@ var TreeStyleTabUtils = { { var expanded = this.getTreePref('tabbar.width'); var shrunken = this.getTreePref('tabbar.shrunkenWidth'); - if (expanded <= shrunken) { + var originalExpanded = expanded; + var originalShrunken = shrunken; + if (aPrefName == 'extensions.treestyletab.tabbar.shrunkenWidth') { + if (expanded <= shrunken) + expanded = parseInt(shrunken / this.DEFAULT_SHRUNKEN_WIDTH_RATIO) + let w = this.browserWindow; + if (w && expanded > w.gBrowser.boxObject.width) { + expanded = w.gBrowser.boxObject.width * this.MAX_TABBAR_SIZE_RATIO; + if (expanded <= shrunken) + shrunken = parseInt(expanded * this.DEFAULT_SHRUNKEN_WIDTH_RATIO) + } + } + else { + if (expanded <= shrunken) + shrunken = parseInt(expanded * this.DEFAULT_SHRUNKEN_WIDTH_RATIO); + } + if (expanded != originalExpanded || + shrunken != originalShrunken) { 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 - this.setTreePref('tabbar.width', parseInt(shrunken * 1.5)); + this.setTreePref('tabbar.width', expanded); + this.setTreePref('tabbar.shrunkenWidth', shrunken); this.tabbarWidthResetting = false; } },