タブが縦置きでない時はタブの上にマージンを取るようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1235 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2007-10-19 06:49:20 +00:00
parent 37d1567be7
commit c95a5d4086

View File

@ -157,6 +157,14 @@ var TreeStyleTabService = {
return (target.localName == 'tabbrowser') ? target : null ;
},
isTabVertical : function(aTabOrChild)
{
var b = this.getTabBrowserFromChildren(aTabOrChild);
if (!b) return false;
var box = b.mTabContainer.mTabstrip || b.mTabContainer ;
return (box.getAttribute('orient') || window.getComputedStyle(box, '').getPropertyValue('-moz-box-orient')) == 'vertical';
},
cleanUpTabsArray : function(aTabs)
{
var b = this.getTabBrowserFromChildren(aTabs[0]);
@ -974,7 +982,7 @@ var TreeStyleTabService = {
if (!aDontUpdateIndent) this.updateTabsIndent([aChild]);
},
updateTabsIndent : function(aTabs, aLevel)
updateTabsIndent : function(aTabs, aLevel, aProp)
{
if (!aTabs || !aTabs.length) return;
@ -988,11 +996,14 @@ var TreeStyleTabService = {
}
}
if (!aProp)
aProp = this.isTabVertical(aTabs[0]) ? 'margin-left' : 'margin-top' ;
var indent = (this.levelMargin * aLevel)+'px';
for (var i = 0, maxi = aTabs.length; i < maxi; i++)
{
aTabs[i].setAttribute('style', aTabs[i].getAttribute('style')+';margin-left:'+indent+' !important;');
this.updateTabsIndent(this.getChildTabsOf(aTabs[i]), aLevel+1);
aTabs[i].setAttribute('style', aTabs[i].getAttribute('style')+';'+aProp+':'+indent+' !important;');
this.updateTabsIndent(this.getChildTabsOf(aTabs[i]), aLevel+1, aProp);
}
},