"fast restore" should restore collapsed/expand state based on user pref

This commit is contained in:
Piro / SHIMODA Hiroshi 2011-12-08 05:12:33 +09:00
parent acefddccb7
commit 5193c60a3b
2 changed files with 11 additions and 4 deletions

View File

@ -2304,14 +2304,17 @@ TreeStyleTabBrowser.prototype = {
var subTreeCollapsed = this.getTabValue(aTab, this.kSUBTREE_COLLAPSED) == 'true';
var children = this.getTabValue(aTab, this.kCHILDREN);
if (children) {
subTreeCollapsed = this._restoreSubtreeCollapsedState(aTab, subTreeCollapsed);
children.split('|').forEach(function(aChild) {
aChild = this.getTabById(aChild);
if (aChild)
if (aChild) {
this.attachTabTo(aChild, aTab, {
forceExpand : true, // to prevent to collapse the selected tab
dontAnimate : true,
insertBefore : this.getTabById(this.getTabValue(aChild, this.kINSERT_BEFORE))
});
this.collapseExpandTab(aChild, subTreeCollapsed, true);
}
}, this);
this.collapseExpandSubtree(aTab, subTreeCollapsed, true);
}
@ -3315,14 +3318,18 @@ TreeStyleTabBrowser.prototype = {
this.deleteTabValue(aTab, this.kCLOSED_SET_ID);
return closeSetId;
},
_restoreSubtreeCollapsedState : function TSTBrowser_restoreSubtreeCollapsedState(aTab)
_restoreSubtreeCollapsedState : function TSTBrowser_restoreSubtreeCollapsedState(aTab, aCollapsed)
{
var shouldCollapse = this.getTreePref('collapseExpandSubtree.sessionRestore');
if (aCollapsed === void(0))
aCollapsed = this.getTabValue(aTab, this.kSUBTREE_COLLAPSED) == 'true';
var isSubtreeCollapsed = (
this.windowService.restoringTree &&
(
shouldCollapse == this.RESTORED_TREE_COLLAPSED_STATE_LAST_STATE ?
(this.getTabValue(aTab, this.kSUBTREE_COLLAPSED) == 'true') :
aCollapsed :
shouldCollapse == this.RESTORED_TREE_COLLAPSED_STATE_COLLAPSED
)
);

View File

@ -1598,7 +1598,7 @@ TreeStyleTabWindow.prototype = {
}
},
get restoringTree() {
return this.restoringCount > 0;
return this.restoringCount || this.window.__SS_tabsToRestore;
},
/* Pref Listener */