diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js index a287f523..f45de698 100644 --- a/content/treestyletab/hacks.js +++ b/content/treestyletab/hacks.js @@ -539,7 +539,7 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function() { window.setTimeout(function() { // 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.initTabContentsOrder(t); diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 0d793456..c3e1be43 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -592,6 +592,15 @@ var TreeStyleTabService = { return array; }, + getFirstTab : function(aTabBrowser) + { + return this.evaluateXPath( + 'descendant::xul:tab[1]', + aTabBrowser.mTabContainer, + XPathResult.FIRST_ORDERED_NODE_TYPE + ).singleNodeValue; + }, + getLastTab : function(aTabBrowser) { return this.evaluateXPath( diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index d2405484..02cd7d3c 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -2650,7 +2650,7 @@ TreeStyleTabBrowser.prototype = { var oldMargin = this.levelMargin; var indent = (oldMargin < 0 ? this.baseLebelMargin : oldMargin ) * nest; var maxIndent = ( - this.getTabs(b).snapshotItem(0).boxObject[this.invertedSizeProp] || + this.getFirstTab(b).boxObject[this.invertedSizeProp] || b.mTabContainer.boxObject[this.invertedSizeProp] ) * 0.33; @@ -3002,7 +3002,7 @@ TreeStyleTabBrowser.prototype = { var tabSize = lastVisible.boxObject[this.sizeProp]; 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 endY = this.isVertical ? endPos : 0 ; this.scrollTo(endX, endY);