IDの再設定が完了した後にまとめてツリーを復元するようにしてみた(でも期待通りにまだ動かない)
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5151 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
1d5bde0f09
commit
501a1518c4
@ -1759,16 +1759,16 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
var tab = aTab;
|
var tab = aTab;
|
||||||
var b = this.mTabBrowser;
|
var b = this.mTabBrowser;
|
||||||
var id = this.getTabValue(tab, this.kID);
|
var id = this.getTabValue(tab, this.kID);
|
||||||
var maybeDuplicated = false;
|
var mayBeDuplicated = false;
|
||||||
|
|
||||||
tab.setAttribute(this.kID+'-temp', id);
|
tab.setAttribute(this.kID+'-temp', id);
|
||||||
if (this.isTabDuplicated(tab)) { // this is a duplicated tab!
|
if (this.isTabDuplicated(tab)) { // this is a duplicated tab!
|
||||||
maybeDuplicated = true;
|
mayBeDuplicated = true;
|
||||||
id = this.redirectId(id);
|
id = this.redirectId(id);
|
||||||
}
|
}
|
||||||
tab.removeAttribute(this.kID+'-temp');
|
tab.removeAttribute(this.kID+'-temp');
|
||||||
|
|
||||||
if (!maybeDuplicated) {
|
if (!mayBeDuplicated) {
|
||||||
/* If it has a parent, it is wrongly attacched by tab moving
|
/* If it has a parent, it is wrongly attacched by tab moving
|
||||||
on restoring. Restoring the old ID (the next statement)
|
on restoring. Restoring the old ID (the next statement)
|
||||||
breaks the children list of the temporary parent and causes
|
breaks the children list of the temporary parent and causes
|
||||||
@ -1790,14 +1790,27 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
if (tab.getAttribute(this.kID) != id) {
|
if (tab.getAttribute(this.kID) != id) {
|
||||||
this.setTabValue(tab, this.kID, id);
|
this.setTabValue(tab, this.kID, id);
|
||||||
window.setTimeout(function(aSelf) {
|
this.delayedRestoringTasks.push({
|
||||||
aSelf.restoreStructureInternal(tab, aWithoutAnimation, maybeDuplicated);
|
tab : tab,
|
||||||
|
withoutAnimation : aWithoutAnimation,
|
||||||
|
mayBeDuplicated : mayBeDuplicated
|
||||||
|
});
|
||||||
|
if (this.delayedRestoringTimer)
|
||||||
|
window.clearTimeout(this.delayedRestoringTimer);
|
||||||
|
this.delayedRestoringTimer = window.setTimeout(function(aSelf) {
|
||||||
|
aSelf.delayedRestoringTasks.forEach(function(aTask) {
|
||||||
|
aSelf.restoreStructureInternal(aTask.tab, aTask.withoutAnimation, aTask.mayBeDuplicated);
|
||||||
|
});
|
||||||
|
aSelf.delayedRestoringTasks = [];
|
||||||
|
aSelf.delayedRestoringTimer = null;
|
||||||
}, 100, this);
|
}, 100, this);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this.restoreStructureInternal(tab, aWithoutAnimation, maybeDuplicated);
|
this.restoreStructureInternal(tab, aWithoutAnimation, mayBeDuplicated);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
delayedRestoringTimer : null,
|
||||||
|
delayedRestoringTasks : [],
|
||||||
restoreStructureInternal : function (aTab, aWithoutAnimation, aMayBeDuplicated)
|
restoreStructureInternal : function (aTab, aWithoutAnimation, aMayBeDuplicated)
|
||||||
{
|
{
|
||||||
var tab = aTab;
|
var tab = aTab;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user