children of a newly pinned tab should be treated same to children of a closed tab (partial fix for https://github.com/piroor/treestyletab/issues/155 )

This commit is contained in:
SHIMODA Hiroshi 2011-09-06 11:33:38 +09:00
parent edea442249
commit 6201e7a523

View File

@ -3520,25 +3520,31 @@ TreeStyleTabBrowser.prototype = {
{ {
var parentTab = this.getParentTab(aTab); var parentTab = this.getParentTab(aTab);
if (!parentTab) if (!parentTab) {
this.collapseExpandSubtree(aTab, false); this.collapseExpandSubtree(aTab, false);
}
else {
let b = this.browser;
this.internallyTabMovingCount++;
this.getChildTabs(aTab).reverse().forEach(function(aChildTab) {
/**
* Children of the newly pinned tab are possibly
* moved to the top of the tab bar, by TabMove event
* from the newly pinned tab. So, we have to
* reposition unexpectedly moved children.
*/
if (aChildTab._tPos < parentTab._tPos)
b.moveTabTo(aChildTab, parentTab._tPos);
}, this);
this.internallyTabMovingCount--;
}
this.getChildTabs(aTab).reverse().forEach( this.partAllChildren(aTab, {
parentTab ? behavior : this.getCloseParentBehaviorForTab(
function(aChildTab) { aTab,
this.attachTabTo(aChildTab, parentTab, { this.kCLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST_CHILD
dontExpand : true, )
/** });
* Children of the newly pinned tab are possibly
* moved to the top of the tab bar, by TabMove event
* from the newly pinned tab. So, we have to
* reposition unexpectedly moved children.
*/
dontMove : aChildTab._tPos > parentTab._tPos
});
} :
this.partTab,
this);
this.partTab(aTab); this.partTab(aTab);
this.collapseExpandTab(aTab, false); this.collapseExpandTab(aTab, false);