getFirstTab()

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@3539 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-01-26 06:39:51 +00:00
parent f362343c48
commit f5260a4308
3 changed files with 12 additions and 3 deletions

View File

@ -539,7 +539,7 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function() {
window.setTimeout(function() { window.setTimeout(function() {
// correct broken appearance of the first tab // correct broken appearance of the first tab
var t = gBrowser.treeStyleTab.getTabs(gBrowser).snapshotItem(0); var t = gBrowser.treeStyleTab.getFirstTab(gBrowser);
gBrowser.treeStyleTab.initTabAttributes(t); gBrowser.treeStyleTab.initTabAttributes(t);
gBrowser.treeStyleTab.initTabContentsOrder(t); gBrowser.treeStyleTab.initTabContentsOrder(t);

View File

@ -592,6 +592,15 @@ var TreeStyleTabService = {
return array; return array;
}, },
getFirstTab : function(aTabBrowser)
{
return this.evaluateXPath(
'descendant::xul:tab[1]',
aTabBrowser.mTabContainer,
XPathResult.FIRST_ORDERED_NODE_TYPE
).singleNodeValue;
},
getLastTab : function(aTabBrowser) getLastTab : function(aTabBrowser)
{ {
return this.evaluateXPath( return this.evaluateXPath(

View File

@ -2650,7 +2650,7 @@ TreeStyleTabBrowser.prototype = {
var oldMargin = this.levelMargin; var oldMargin = this.levelMargin;
var indent = (oldMargin < 0 ? this.baseLebelMargin : oldMargin ) * nest; var indent = (oldMargin < 0 ? this.baseLebelMargin : oldMargin ) * nest;
var maxIndent = ( var maxIndent = (
this.getTabs(b).snapshotItem(0).boxObject[this.invertedSizeProp] || this.getFirstTab(b).boxObject[this.invertedSizeProp] ||
b.mTabContainer.boxObject[this.invertedSizeProp] b.mTabContainer.boxObject[this.invertedSizeProp]
) * 0.33; ) * 0.33;
@ -3002,7 +3002,7 @@ TreeStyleTabBrowser.prototype = {
var tabSize = lastVisible.boxObject[this.sizeProp]; var tabSize = lastVisible.boxObject[this.sizeProp];
if (lastPosition - parentPosition + tabSize > containerSize - tabSize) { // out of screen if (lastPosition - parentPosition + tabSize > containerSize - tabSize) { // out of screen
var endPos = parentPosition - this.getTabs(b).snapshotItem(0).boxObject[this.positionProp] - tabSize * 0.5; var endPos = parentPosition - this.getFirstTab(b).boxObject[this.positionProp] - tabSize * 0.5;
var endX = this.isVertical ? 0 : endPos ; var endX = this.isVertical ? 0 : endPos ;
var endY = this.isVertical ? endPos : 0 ; var endY = this.isVertical ? endPos : 0 ;
this.scrollTo(endX, endY); this.scrollTo(endX, endY);