「自動で畳む」状態の時のタブバーのリサイズでタブバーの大きさがウィンドウより大きくなってしまう可能性を無くした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6610 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-04-22 09:24:21 +00:00
parent bae827ac24
commit a4a693080f
2 changed files with 25 additions and 9 deletions

View File

@ -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 */

View File

@ -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;
}
},