Flatten codes

This commit is contained in:
Piro / YUKI Hiroshi 2013-05-06 04:52:55 +09:00
parent 1f6333c22c
commit 895b038fe7

View File

@ -2929,18 +2929,14 @@ TreeStyleTabBrowser.prototype = {
this.isSubtreeCollapsed(tab))
this._closeChildTabs(tab);
this._saveAndUpdateReferenceTabsInfo(tab);
var toBeClosedSibling = this._reserveCloseNeedlessGroupTabSibling(tab);
var nextFocusedTab = null;
this._saveAndUpdateReferenceTabsInfo(tab);
var firstChild = this.getFirstChildTab(tab);
if (firstChild) {
let children = this.getChildTabs(tab);
this.detachAllChildren(tab, {
behavior : closeParentBehavior,
dontUpdateIndent : true
});
if (closeParentBehavior == this.kCLOSE_PARENT_BEHAVIOR_PROMOTE_FIRST_CHILD)
this.updateTabsIndentWithDelay(children.slice(0, 1));
@ -2952,6 +2948,11 @@ TreeStyleTabBrowser.prototype = {
nextFocusedTab = firstChild;
}
this.detachAllChildren(tab, {
behavior : closeParentBehavior,
dontUpdateIndent : true
});
var parentTab = this.getParentTab(tab);
if (parentTab) {
if (!nextFocusedTab && tab == this.getLastChildTab(parentTab)) {
@ -2964,8 +2965,6 @@ TreeStyleTabBrowser.prototype = {
let toBeClosedParent = this._reserveCloseNeedlessGroupTabParent(parentTab);
if (toBeClosedParent && nextFocusedTab == toBeClosedParent)
nextFocusedTab = this.getNextFocusedTab(parentTab);
this.detachTab(tab, { dontUpdateIndent : true });
}
else if (!nextFocusedTab) {
nextFocusedTab = this.getNextFocusedTab(tab);
@ -2974,6 +2973,8 @@ TreeStyleTabBrowser.prototype = {
if (toBeClosedSibling && nextFocusedTab == toBeClosedSibling)
nextFocusedTab = this.getFirstChildTab(nextFocusedTab);
this.detachTab(tab, { dontUpdateIndent : true });
this.checkTabsIndentOverflow();
this._restoreTabAttributes(tab, backupAttributes);
@ -5035,7 +5036,12 @@ TreeStyleTabBrowser.prototype = {
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 || {};
if (!('behavior' in aInfo))
@ -5045,7 +5051,6 @@ TreeStyleTabBrowser.prototype = {
var b = this.mTabBrowser;
var parentTab = this.getParentTab(aTab);
var children = this.getChildTabs(aTab);
if (
this.isGroupTab(aTab) &&