タブの内容を左右反転している時、クローズボックスの表示・非表示が切り替わった後で

タブの内容の並び順が壊れる問題を修正

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4410 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-05-12 15:09:49 +00:00
parent a3c4b4552e
commit d6fd326493

View File

@ -214,11 +214,11 @@ TreeStyleTabBrowser.prototype = {
eval('b.mTabContainer.adjustTabstrip = '+
b.mTabContainer.adjustTabstrip.toSource().replace(
/(\})(\)?)$/,
/(\}\)?)$/,
<![CDATA[
var b = TreeStyleTabService.getTabBrowserFromChild(this);
b.treeStyleTab.updateInvertedTabContentsOrder(true);
$1$2]]>
$1]]>
)
);
@ -661,8 +661,14 @@ TreeStyleTabBrowser.prototype = {
var counter = document.getAnonymousElementByAttribute(aTab, 'class', this.kCOUNTER_CONTAINER);
var inverted = this.mTabBrowser.getAttribute(this.kTAB_CONTENTS_INVERTED) == 'true';
// top-level contents
var nodes = Array.slice(document.getAnonymousNodes(aTab));
// reset order
nodes.forEach(function(aNode, aIndex) {
aNode.setAttribute('ordinal', aIndex);
}, this);
// rearrange top-level contents
nodes.splice(nodes.indexOf(close), 1);
if (inverted) {
if (this.mTabBrowser.getAttribute(this.kCLOSEBOX_INVERTED) == 'true')
@ -682,7 +688,7 @@ TreeStyleTabBrowser.prototype = {
aNode.setAttribute('ordinal', (count - aIndex + 1) * 100);
}, this);
// contents in "tab-image-middle"
// rearrange contents in "tab-image-middle"
nodes = Array.slice(label.parentNode.childNodes);
nodes.splice(nodes.indexOf(counter), 1);
if (inverted) nodes.reverse();
@ -697,19 +703,13 @@ TreeStyleTabBrowser.prototype = {
updateInvertedTabContentsOrder : function(aAll)
{
if (this.getTreePref('tabbar.position') != 'right' ||
!this.getTreePref('tabbar.invertTabContents')) return;
if (!this.getTreePref('tabbar.invertTabContents')) return;
window.setTimeout(function(aSelf) {
var b = aSelf.mTabBrowser;
if (aAll) {
aSelf.getTabsArray(b).forEach(function(aTab) {
var tabs = aAll ? aSelf.getTabsArray(b) : [b.selectedTab] ;
tabs.forEach(function(aTab) {
aSelf.initTabContentsOrder(aTab);
});
}
else {
aSelf.initTabContentsOrder(b.selectedTab);
}
}, 0, this);
},