when a tab was moved into an existing tree, it was not become a new member of the tree. (regression)
This commit is contained in:
parent
5ea172c3c1
commit
527acb44f8
@ -2180,43 +2180,38 @@ var TreeStyleTabUtils = {
|
|||||||
|
|
||||||
getChildIndex : function TSTUtils_getChildIndex(aTab, aParent) /* PUBLIC API */
|
getChildIndex : function TSTUtils_getChildIndex(aTab, aParent) /* PUBLIC API */
|
||||||
{
|
{
|
||||||
if (this.tabsHash) { // XPath-less implementation
|
var parent = this.getParentTab(aTab);
|
||||||
let parent = this.getParentTab(aTab);
|
if (!aParent || !parent || aParent != parent) {
|
||||||
if (!aParent || !parent || aParent != parent) {
|
let tabs = [aTab].concat(this.getAncestorTabs(aTab));
|
||||||
let ancestors = this.getAncestorTabs(aTab);
|
parent = aTab;
|
||||||
let index = ancestors.indexOf(aParent);
|
for (let i = 0, maxi = tabs.length; i < maxi && parent != aParent; i++)
|
||||||
if (index < 1)
|
{
|
||||||
return -1;
|
aTab = parent;
|
||||||
aTab = ancestors[index-1];
|
parent = i < maxi ? tabs[i+1] : null ;
|
||||||
}
|
}
|
||||||
|
if (parent != aParent)
|
||||||
if (aParent) {
|
|
||||||
let children = aParent.getAttribute(this.kCHILDREN);
|
|
||||||
let list = children.split('|');
|
|
||||||
let id = aTab.getAttribute(this.kID);
|
|
||||||
for (let i = 0, maxi = list.length; i < maxi; i++)
|
|
||||||
{
|
|
||||||
if (list[i] == id) return i;
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
aParent = parent;
|
||||||
else {
|
}
|
||||||
let tabs = this.rootTabs;
|
|
||||||
for (let i = 0, maxi = tabs.length; i < maxi; i++)
|
if (aParent) {
|
||||||
{
|
let children = aParent.getAttribute(this.kCHILDREN);
|
||||||
if (tabs[i] == aTab) return i;
|
let list = children.split('|');
|
||||||
}
|
let id = aTab.getAttribute(this.kID);
|
||||||
|
for (let i = 0, maxi = list.length; i < maxi; i++)
|
||||||
|
{
|
||||||
|
if (list[i] == id) return i;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
var parent = aTab.getAttribute(this.kPARENT);
|
let tabs = this.rootTabs;
|
||||||
if (!parent) return -1;
|
for (let i = 0, maxi = tabs.length; i < maxi; i++)
|
||||||
return this.evaluateXPath(
|
{
|
||||||
'count(preceding-sibling::xul:tab[@'+this.kPARENT+' and @'+this.kPARENT+'="'+parent+'"])',
|
if (tabs[i] == aTab) return i;
|
||||||
aTab,
|
}
|
||||||
Ci.nsIDOMXPathResult.NUMBER_TYPE
|
}
|
||||||
).numberValue;
|
return -1;
|
||||||
},
|
},
|
||||||
|
|
||||||
getXOffsetOfTab : function TSTUtils_getXOffsetOfTab(aTab)
|
getXOffsetOfTab : function TSTUtils_getXOffsetOfTab(aTab)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user