Index: Source/devtools/front_end/SplitView.js |
diff --git a/Source/devtools/front_end/SplitView.js b/Source/devtools/front_end/SplitView.js |
index dd61510f43e0e7ead60ab156b2d5818252a4bcc6..10abe6132bd2786f0691e550070bb13ebf15efda 100644 |
--- a/Source/devtools/front_end/SplitView.js |
+++ b/Source/devtools/front_end/SplitView.js |
@@ -68,11 +68,11 @@ WebInspector.SplitView = function(isVertical, secondIsSidebar, settingName, defa |
this._resizable = true; |
this._useDip = !!useDip; |
- this._savedSidebarWidth = defaultSidebarWidth || 200; |
- this._savedSidebarHeight = defaultSidebarHeight || this._savedSidebarWidth; |
+ this._defaultSidebarWidth = defaultSidebarWidth || 200; |
+ this._defaultSidebarHeight = defaultSidebarHeight || this._defaultSidebarWidth; |
- if (0 < this._savedSidebarWidth && this._savedSidebarWidth < 1 && |
- 0 < this._savedSidebarHeight && this._savedSidebarHeight < 1) |
+ if (0 < this._defaultSidebarWidth && this._defaultSidebarWidth < 1 && |
+ 0 < this._defaultSidebarHeight && this._defaultSidebarHeight < 1) |
this._useFraction = true; |
this._settingName = settingName; |
@@ -136,6 +136,9 @@ WebInspector.SplitView.prototype = { |
this.element.classList.add(this._isVertical ? "hbox" : "vbox"); |
delete this._resizerElementSize; |
this._sidebarSize = -1; |
+ this._restoreSidebarSizeFromSettings(); |
+ if (this._shouldSaveShowMode) |
+ this._showMode = this._savedShowMode(); |
}, |
/** |
@@ -144,7 +147,7 @@ WebInspector.SplitView.prototype = { |
_updateLayout: function(animate) |
{ |
delete this._totalSize; // Lazy update. |
- this._innerSetSidebarSize(this._lastSidebarSize(), false, animate); |
+ this._innerSetSidebarSize(this._preferredSidebarSize(), false, animate); |
}, |
/** |
@@ -235,7 +238,7 @@ WebInspector.SplitView.prototype = { |
*/ |
desiredSidebarSize: function() |
{ |
- return this._lastSidebarSize(); |
+ return this._preferredSidebarSize(); |
}, |
/** |
@@ -351,7 +354,7 @@ WebInspector.SplitView.prototype = { |
setSidebarSize: function(size) |
{ |
this._innerSetSidebarSize(size); |
- this._saveSetting(); |
+ this._updatePreferredSidebarSize(); |
}, |
/** |
@@ -605,6 +608,7 @@ WebInspector.SplitView.prototype = { |
{ |
if (this._useDip) |
WebInspector.zoomManager.addEventListener(WebInspector.ZoomManager.Events.ZoomChanged, this._onZoomChanged, this); |
+ this._restoreSidebarSizeFromSettings(); |
this._updateLayout(); |
}, |
@@ -628,7 +632,6 @@ WebInspector.SplitView.prototype = { |
if (!this._resizable) |
return false; |
- this._saveSetting(); |
this._dragOffset = (this._secondIsSidebar ? this.totalSize() - this._sidebarSize : this._sidebarSize) - (this._isVertical ? event.pageX : event.pageY); |
return true; |
}, |
@@ -650,7 +653,7 @@ WebInspector.SplitView.prototype = { |
_endResizerDragging: function(event) |
{ |
delete this._dragOffset; |
- this._saveSetting(); |
+ this._updatePreferredSidebarSize(); |
}, |
hideDefaultResizer: function() |
@@ -728,17 +731,23 @@ WebInspector.SplitView.prototype = { |
/** |
* @return {number} |
*/ |
- _lastSidebarSize: function() |
+ _preferredSidebarSize: function() |
{ |
- var settingForOrientation = this._settingForOrientation(); |
- var size = settingForOrientation ? settingForOrientation.size : 0; |
- if (!size) |
- size = this._isVertical ? this._savedSidebarWidth : this._savedSidebarHeight; |
+ var size = this._savedSidebarSize; |
if (this._useFraction) |
size *= this.totalSize(); |
return size; |
}, |
+ _restoreSidebarSizeFromSettings: function() |
+ { |
+ var settingForOrientation = this._settingForOrientation(); |
+ var size = settingForOrientation ? settingForOrientation.size : 0; |
+ if (!size) |
+ size = this._isVertical ? this._defaultSidebarWidth : this._defaultSidebarHeight; |
+ this._savedSidebarSize = size; |
+ }, |
+ |
/** |
* @return {string} |
*/ |
@@ -759,16 +768,15 @@ WebInspector.SplitView.prototype = { |
return size; |
}, |
- _saveSetting: function() |
+ _updatePreferredSidebarSize: function() |
{ |
- var size = this._sizeToSave(); |
+ this._savedSidebarSize = this._sizeToSave(); |
+ this._saveSetting(); |
+ }, |
- if (size !== -1) { |
- if (this._isVertical) |
- this._savedSidebarWidth = size; |
- else |
- this._savedSidebarHeight = size; |
- } |
+ _saveSetting: function() |
+ { |
+ var size = this._savedSidebarSize; |
var setting = this._setting(); |
if (!setting) |
@@ -793,7 +801,7 @@ WebInspector.SplitView.prototype = { |
{ |
var data = /** @type {{from: number, to: number}} */ (event.data); |
this._innerSetSidebarSize(this.sidebarSize() * data.from / data.to, true); |
- this._saveSetting(); |
+ this._updatePreferredSidebarSize(); |
}, |
/** |