* APIによるタブの移動でのツリー再構築について、処理を簡略化
* TMPでタブの挿入位置を制御する設定のときにブックマーク等から新しいタブを開くとツリーがおかしくなる問題を修正したつもり git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5030 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
c9603addd0
commit
9294210897
@ -473,16 +473,6 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
eval('gBrowser.TMmoveTabTo = '+
|
|
||||||
gBrowser.TMmoveTabTo.toSource().replace(
|
|
||||||
/(aTab.dispatchEvent)/,
|
|
||||||
'this.treeStyleTab.internallyTabMoving = true; $1'
|
|
||||||
).replace(
|
|
||||||
/(return aTab;\})(\)?)$/,
|
|
||||||
'this.treeStyleTab.internallyTabMoving = false; $1$2'
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
window.BrowserHome = window.TM_BrowserHome;
|
window.BrowserHome = window.TM_BrowserHome;
|
||||||
window.BrowserOpenTab = window.TMP_BrowserOpenTab;
|
window.BrowserOpenTab = window.TMP_BrowserOpenTab;
|
||||||
|
|
||||||
|
@ -1687,30 +1687,15 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.attachTabFromPosition(tab, aEvent.detail);
|
this.attachTabFromPosition(tab);
|
||||||
|
|
||||||
this.showTabbarForFeedback();
|
this.showTabbarForFeedback();
|
||||||
},
|
},
|
||||||
|
|
||||||
attachTabFromPosition : function(aTab, aOldPosition)
|
attachTabFromPosition : function(aTab)
|
||||||
{
|
{
|
||||||
var parent = this.getParentTab(aTab);
|
var parent = this.getParentTab(aTab);
|
||||||
|
|
||||||
if (aOldPosition === void(0)) aOldPosition = aTab._tPos;
|
|
||||||
|
|
||||||
var pos = this.getChildIndex(aTab, parent);
|
|
||||||
var oldPos = this.getChildIndex(this.getTabs(this.mTabBrowser).snapshotItem(aOldPosition), parent);
|
|
||||||
var delta;
|
|
||||||
if (pos == oldPos) { // no move?
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (pos < 0 || oldPos < 0) {
|
|
||||||
delta = 2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
delta = Math.abs(pos - oldPos);
|
|
||||||
}
|
|
||||||
|
|
||||||
var prevTab = this.getPreviousTab(aTab);
|
var prevTab = this.getPreviousTab(aTab);
|
||||||
var nextTab = this.getNextTab(aTab);
|
var nextTab = this.getNextTab(aTab);
|
||||||
|
|
||||||
@ -1731,17 +1716,16 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
newParent = null;
|
newParent = null;
|
||||||
}
|
}
|
||||||
else if (!nextTab) {
|
else if (!nextTab) {
|
||||||
newParent = (delta > 1) ? prevParent : parent ;
|
newParent = prevParent || parent ;
|
||||||
}
|
}
|
||||||
else if (prevParent == nextParent) {
|
else if (prevParent == nextParent) {
|
||||||
newParent = prevParent;
|
newParent = prevParent;
|
||||||
}
|
}
|
||||||
else if (prevLevel > nextLevel) {
|
else if (prevLevel > nextLevel) {
|
||||||
var realDelta = Math.abs(aTab._tPos - aOldPosition);
|
newParent = prevParent || parent || nextParent;
|
||||||
newParent = realDelta < 2 ? prevParent : parent ;
|
|
||||||
}
|
}
|
||||||
else if (prevLevel < nextLevel) {
|
else if (prevLevel < nextLevel) {
|
||||||
newParent = this.getParentTab(aTab) || this.getParentTab(nextTab);
|
newParent = parent || nextParent;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newParent != parent) {
|
if (newParent != parent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user