Flatten codes
This commit is contained in:
parent
1f6333c22c
commit
895b038fe7
@ -2929,18 +2929,14 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.isSubtreeCollapsed(tab))
|
this.isSubtreeCollapsed(tab))
|
||||||
this._closeChildTabs(tab);
|
this._closeChildTabs(tab);
|
||||||
|
|
||||||
|
this._saveAndUpdateReferenceTabsInfo(tab);
|
||||||
|
|
||||||
var toBeClosedSibling = this._reserveCloseNeedlessGroupTabSibling(tab);
|
var toBeClosedSibling = this._reserveCloseNeedlessGroupTabSibling(tab);
|
||||||
var nextFocusedTab = null;
|
var nextFocusedTab = null;
|
||||||
|
|
||||||
this._saveAndUpdateReferenceTabsInfo(tab);
|
|
||||||
|
|
||||||
var firstChild = this.getFirstChildTab(tab);
|
var firstChild = this.getFirstChildTab(tab);
|
||||||
if (firstChild) {
|
if (firstChild) {
|
||||||
let children = this.getChildTabs(tab);
|
let children = this.getChildTabs(tab);
|
||||||
this.detachAllChildren(tab, {
|
|
||||||
behavior : closeParentBehavior,
|
|
||||||
dontUpdateIndent : true
|
|
||||||
});
|
|
||||||
|
|
||||||
if (closeParentBehavior == this.kCLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST_CHILD)
|
if (closeParentBehavior == this.kCLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST_CHILD)
|
||||||
this.updateTabsIndentWithDelay(children.slice(0, 1));
|
this.updateTabsIndentWithDelay(children.slice(0, 1));
|
||||||
@ -2952,6 +2948,11 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
nextFocusedTab = firstChild;
|
nextFocusedTab = firstChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.detachAllChildren(tab, {
|
||||||
|
behavior : closeParentBehavior,
|
||||||
|
dontUpdateIndent : true
|
||||||
|
});
|
||||||
|
|
||||||
var parentTab = this.getParentTab(tab);
|
var parentTab = this.getParentTab(tab);
|
||||||
if (parentTab) {
|
if (parentTab) {
|
||||||
if (!nextFocusedTab && tab == this.getLastChildTab(parentTab)) {
|
if (!nextFocusedTab && tab == this.getLastChildTab(parentTab)) {
|
||||||
@ -2964,8 +2965,6 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
let toBeClosedParent = this._reserveCloseNeedlessGroupTabParent(parentTab);
|
let toBeClosedParent = this._reserveCloseNeedlessGroupTabParent(parentTab);
|
||||||
if (toBeClosedParent && nextFocusedTab == toBeClosedParent)
|
if (toBeClosedParent && nextFocusedTab == toBeClosedParent)
|
||||||
nextFocusedTab = this.getNextFocusedTab(parentTab);
|
nextFocusedTab = this.getNextFocusedTab(parentTab);
|
||||||
|
|
||||||
this.detachTab(tab, { dontUpdateIndent : true });
|
|
||||||
}
|
}
|
||||||
else if (!nextFocusedTab) {
|
else if (!nextFocusedTab) {
|
||||||
nextFocusedTab = this.getNextFocusedTab(tab);
|
nextFocusedTab = this.getNextFocusedTab(tab);
|
||||||
@ -2974,6 +2973,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
if (toBeClosedSibling && nextFocusedTab == toBeClosedSibling)
|
if (toBeClosedSibling && nextFocusedTab == toBeClosedSibling)
|
||||||
nextFocusedTab = this.getFirstChildTab(nextFocusedTab);
|
nextFocusedTab = this.getFirstChildTab(nextFocusedTab);
|
||||||
|
|
||||||
|
this.detachTab(tab, { dontUpdateIndent : true });
|
||||||
|
|
||||||
this.checkTabsIndentOverflow();
|
this.checkTabsIndentOverflow();
|
||||||
|
|
||||||
this._restoreTabAttributes(tab, backupAttributes);
|
this._restoreTabAttributes(tab, backupAttributes);
|
||||||
@ -5035,7 +5036,12 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
detachAllChildren : function TSTBrowser_detachAllChildren(aTab, aInfo)
|
detachAllChildren : function TSTBrowser_detachAllChildren(aTab, aInfo)
|
||||||
{
|
{
|
||||||
if (!aTab.parentNode) return; // do nothing for closed tab!
|
if (!aTab.parentNode) // do nothing for closed tab!
|
||||||
|
return;
|
||||||
|
|
||||||
|
var children = this.getChildTabs(aTab);
|
||||||
|
if (!children.length)
|
||||||
|
return;
|
||||||
|
|
||||||
aInfo = aInfo || {};
|
aInfo = aInfo || {};
|
||||||
if (!('behavior' in aInfo))
|
if (!('behavior' in aInfo))
|
||||||
@ -5045,7 +5051,6 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
var b = this.mTabBrowser;
|
var b = this.mTabBrowser;
|
||||||
var parentTab = this.getParentTab(aTab);
|
var parentTab = this.getParentTab(aTab);
|
||||||
var children = this.getChildTabs(aTab);
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.isGroupTab(aTab) &&
|
this.isGroupTab(aTab) &&
|
||||||
|
Loading…
Reference in New Issue
Block a user