TabCandyによるグループ変更でツリーが壊れる問題を修正
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@7076 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
e1ac61ddf2
commit
0206d67498
@ -1336,13 +1336,12 @@ catch(e) {
|
|||||||
|
|
||||||
frame.Item.prototype.__treestyletab__setParent = frame.Item.prototype.setParent;
|
frame.Item.prototype.__treestyletab__setParent = frame.Item.prototype.setParent;
|
||||||
frame.Item.prototype.setParent = function(aParent) {
|
frame.Item.prototype.setParent = function(aParent) {
|
||||||
var currentParent = this.parent;
|
if (this.tab && this.parent && this.parent != aParent)
|
||||||
var returnValue = this.__treestyletab__setParent.apply(this, arguments);
|
frame.parent.TreeStyleTabService
|
||||||
if (this.tab && currentParent != aParent) {
|
.getTabBrowserFromChild(this.tab)
|
||||||
let b = frame.parent.TreeStyleTabService.getTabBrowserFromChild(this.tab);
|
.treeStyleTab
|
||||||
b.treeStyleTab.partTab(this.tab);
|
.onTabGroupModified(this.tab);
|
||||||
}
|
return this.__treestyletab__setParent.apply(this, arguments);
|
||||||
return returnValue;
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -2098,7 +2098,7 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
var subtreeCollapsed = this.isSubtreeCollapsed(tab);
|
var subtreeCollapsed = this.isSubtreeCollapsed(tab);
|
||||||
if (
|
if (
|
||||||
closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_CLOSE ||
|
closeParentBehavior == this.CHILDREN_CLOSE ||
|
||||||
subtreeCollapsed
|
subtreeCollapsed
|
||||||
) {
|
) {
|
||||||
let tabs = this.getDescendantTabs(tab);
|
let tabs = this.getDescendantTabs(tab);
|
||||||
@ -2156,61 +2156,22 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (firstChild) {
|
if (firstChild) {
|
||||||
backupAttributes[this.kCHILDREN] = this.getTabValue(tab, this.kCHILDREN);
|
backupAttributes[this.kCHILDREN] = this.getTabValue(tab, this.kCHILDREN);
|
||||||
let children = this.getChildTabs(tab);
|
let children = this.getChildTabs(tab);
|
||||||
children.forEach((
|
let behavior = parentTab ? closeParentBehavior : closeRootBehavior ;
|
||||||
(closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_DETACH) ?
|
if (behavior == this.CHILDREN_PROMOTE_FIRST &&
|
||||||
function(aTab) {
|
parentTab &&
|
||||||
indentModifiedTabs.push(aTab);
|
this.getChildTabs(parentTab).length == 1)
|
||||||
this.partTab(aTab, {
|
behavior = this.CHILDREN_PROMOTE_ALL;
|
||||||
|
indentModifiedTabs = indentModifiedTabs.concat(
|
||||||
|
behavior == this.CHILDREN_PROMOTE_FIRST ?
|
||||||
|
[children[0]] :
|
||||||
|
children
|
||||||
|
);
|
||||||
|
this.partAllChildren(tab, {
|
||||||
|
behavior : behavior,
|
||||||
dontUpdateIndent : true
|
dontUpdateIndent : true
|
||||||
});
|
});
|
||||||
this.moveTabSubtreeTo(aTab, this.getLastTab(b)._tPos);
|
if (behavior == this.CHILDREN_PROMOTE_ALL ||
|
||||||
} :
|
behavior == this.CHILDREN_PROMOTE_FIRST)
|
||||||
(parentTab ?
|
|
||||||
(
|
|
||||||
closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST &&
|
|
||||||
this.getChildTabs(parentTab).length > 1
|
|
||||||
) :
|
|
||||||
closeRootBehavior == this.CLOSE_ROOT_BEHAVIOR_PROMOTE_FIRST
|
|
||||||
) ?
|
|
||||||
function(aTab, aIndex) {
|
|
||||||
this.partTab(aTab, { dontUpdateIndent : true });
|
|
||||||
if (aIndex == 0) {
|
|
||||||
nextFocusedTab = aTab;
|
|
||||||
indentModifiedTabs.push(aTab);
|
|
||||||
if (parentTab) {
|
|
||||||
this.attachTabTo(aTab, parentTab, {
|
|
||||||
dontUpdateIndent : true,
|
|
||||||
dontExpand : true,
|
|
||||||
dontMove : true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.collapseExpandSubtree(aTab, false);
|
|
||||||
this.deleteTabValue(aTab, this.kSUBTREE_COLLAPSED);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.attachTabTo(aTab, children[0], {
|
|
||||||
dontUpdateIndent : true,
|
|
||||||
dontExpand : true,
|
|
||||||
dontMove : true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} :
|
|
||||||
parentTab ?
|
|
||||||
function(aTab) {
|
|
||||||
indentModifiedTabs.push(aTab);
|
|
||||||
this.attachTabTo(aTab, parentTab, {
|
|
||||||
dontUpdateIndent : true,
|
|
||||||
dontExpand : true,
|
|
||||||
dontMove : true
|
|
||||||
});
|
|
||||||
} :
|
|
||||||
function(aTab) {
|
|
||||||
indentModifiedTabs.push(aTab);
|
|
||||||
this.partTab(aTab, { dontUpdateIndent : true });
|
|
||||||
}
|
|
||||||
), this);
|
|
||||||
if (closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_PROMOTE_ALL ||
|
|
||||||
closeParentBehavior == this.CLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST)
|
|
||||||
nextFocusedTab = firstChild;
|
nextFocusedTab = firstChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2293,12 +2254,11 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (collapsed)
|
if (collapsed)
|
||||||
this.startRendering();
|
this.startRendering();
|
||||||
},
|
},
|
||||||
CLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST : 3,
|
CHILDREN_PROMOTE_FIRST : 3,
|
||||||
CLOSE_PARENT_BEHAVIOR_PROMOTE_ALL : 0,
|
CHILDREN_PROMOTE_ALL : 0,
|
||||||
CLOSE_PARENT_BEHAVIOR_DETACH : 1,
|
CHILDREN_DETACH : 1,
|
||||||
CLOSE_PARENT_BEHAVIOR_CLOSE : 2,
|
CHILDREN_SIMPLY_DETACH : 4,
|
||||||
CLOSE_ROOT_BEHAVIOR_PROMOTE_FIRST : 3,
|
CHILDREN_CLOSE : 2, // onTabRemoved only
|
||||||
CLOSE_ROOT_BEHAVIOR_DETACH : 1,
|
|
||||||
getNextFocusedTab : function TSTBrowser_getNextFocusedTab(aTab)
|
getNextFocusedTab : function TSTBrowser_getNextFocusedTab(aTab)
|
||||||
{
|
{
|
||||||
return this.getNextSiblingTab(aTab) ||
|
return this.getNextSiblingTab(aTab) ||
|
||||||
@ -3206,6 +3166,20 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.removeTabbrowserAttribute(this.kPRINT_PREVIEW);
|
this.removeTabbrowserAttribute(this.kPRINT_PREVIEW);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onTabGroupModified : function TSTBrowser_onTabGroupModified(aTab)
|
||||||
|
{
|
||||||
|
window.setTimeout(function(aSelf) {
|
||||||
|
if (aTab.hasAttribute(aSelf.kREMOVED))
|
||||||
|
return;
|
||||||
|
aSelf.partAllChildren(aTab, {
|
||||||
|
behavior : aSelf.getParentTab(aTab) ?
|
||||||
|
aSelf.getTreePref('closeParentBehavior') :
|
||||||
|
aSelf.getTreePref('closeRootBehavior')
|
||||||
|
});
|
||||||
|
aSelf.partTab(aTab);
|
||||||
|
}, 0, this);
|
||||||
|
},
|
||||||
|
|
||||||
/* drag and drop */
|
/* drag and drop */
|
||||||
|
|
||||||
get tabbarDNDObserver()
|
get tabbarDNDObserver()
|
||||||
@ -3937,9 +3911,58 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
partAllChildren : function TSTBrowser_partAllChildren(aTab, aInfo)
|
partAllChildren : function TSTBrowser_partAllChildren(aTab, aInfo)
|
||||||
{
|
{
|
||||||
this.getChildTabs(aTab).forEach(function(aTab) {
|
aInfo = aInfo || {};
|
||||||
|
if (!('behavior' in aInfo))
|
||||||
|
aInfo.behavior = this.CHILDREN_SIMPLY_DETACH;
|
||||||
|
if (aInfo.behavior == this.CHILDREN_CLOSE)
|
||||||
|
aInfo.behavior = this.CHILDREN_PROMOTE_FIRST;
|
||||||
|
|
||||||
|
var dontUpdateIndent = aInfo.dontUpdateIndent;
|
||||||
|
|
||||||
|
var b = this.mTabBrowser;
|
||||||
|
var parentTab = this.getParentTab(aTab);
|
||||||
|
var children = this.getChildTabs(aTab);
|
||||||
|
children.forEach((
|
||||||
|
aInfo.behavior == this.CHILDREN_DETACH ?
|
||||||
|
function(aTab) {
|
||||||
this.partTab(aTab, aInfo);
|
this.partTab(aTab, aInfo);
|
||||||
}, this);
|
this.moveTabSubtreeTo(aTab, this.getLastTab(b)._tPos);
|
||||||
|
} :
|
||||||
|
aInfo.behavior == this.CHILDREN_PROMOTE_FIRST ?
|
||||||
|
function(aTab, aIndex) {
|
||||||
|
this.partTab(aTab, aInfo);
|
||||||
|
if (aIndex == 0) {
|
||||||
|
if (parentTab) {
|
||||||
|
this.attachTabTo(aTab, parentTab, {
|
||||||
|
__proto__ : aInfo,
|
||||||
|
dontExpand : true,
|
||||||
|
dontMove : true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.collapseExpandSubtree(aTab, false);
|
||||||
|
this.deleteTabValue(aTab, this.kSUBTREE_COLLAPSED);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.attachTabTo(aTab, children[0], {
|
||||||
|
__proto__ : aInfo,
|
||||||
|
dontExpand : true,
|
||||||
|
dontMove : true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
} :
|
||||||
|
aInfo.behavior == this.CHILDREN_PROMOTE_ALL && parentTab ?
|
||||||
|
function(aTab) {
|
||||||
|
this.attachTabTo(aTab, parentTab, {
|
||||||
|
__proto__ : aInfo,
|
||||||
|
dontExpand : true,
|
||||||
|
dontMove : true
|
||||||
|
});
|
||||||
|
} :
|
||||||
|
// aInfo.behavior == this.CHILDREN_SIMPLY_DETACH ?
|
||||||
|
function(aTab) {
|
||||||
|
this.partTab(aTab, aInfo);
|
||||||
|
}
|
||||||
|
), this);
|
||||||
},
|
},
|
||||||
|
|
||||||
updateTabsIndent : function TSTBrowser_updateTabsIndent(aTabs, aLevel, aJustNow)
|
updateTabsIndent : function TSTBrowser_updateTabsIndent(aTabs, aLevel, aJustNow)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user