Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1001)

Unified Diff: Source/devtools/front_end/SplitView.js

Issue 185063005: Revert of DevTools: Do not save split view size on show mode changes. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/http/tests/inspector/network/network-sidebar-width.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/SplitView.js
diff --git a/Source/devtools/front_end/SplitView.js b/Source/devtools/front_end/SplitView.js
index 5e86ace079538d38457467da4a930a919faebb78..c5958d8e9987283fdce7cd15fd355bc92e725e61 100644
--- a/Source/devtools/front_end/SplitView.js
+++ b/Source/devtools/front_end/SplitView.js
@@ -68,11 +68,11 @@
this._resizable = true;
this._useDip = !!useDip;
- this._defaultSidebarWidth = defaultSidebarWidth || 200;
- this._defaultSidebarHeight = defaultSidebarHeight || this._defaultSidebarWidth;
-
- if (0 < this._defaultSidebarWidth && this._defaultSidebarWidth < 1 &&
- 0 < this._defaultSidebarHeight && this._defaultSidebarHeight < 1)
+ this._savedSidebarWidth = defaultSidebarWidth || 200;
+ this._savedSidebarHeight = defaultSidebarHeight || this._savedSidebarWidth;
+
+ if (0 < this._savedSidebarWidth && this._savedSidebarWidth < 1 &&
+ 0 < this._savedSidebarHeight && this._savedSidebarHeight < 1)
this._useFraction = true;
this._settingName = settingName;
@@ -136,7 +136,6 @@
this.element.classList.add(this._isVertical ? "hbox" : "vbox");
delete this._resizerElementSize;
this._sidebarSize = -1;
- this._preferredSidebarSize = this._savedSidebarSize();
},
/**
@@ -145,7 +144,7 @@
_updateLayout: function(animate)
{
delete this._totalSize; // Lazy update.
- this._innerSetSidebarSize(this._preferredSidebarSize, false, animate);
+ this._innerSetSidebarSize(this._lastSidebarSize(), false, animate);
},
/**
@@ -236,7 +235,7 @@
*/
desiredSidebarSize: function()
{
- return this._preferredSidebarSize;
+ return this._lastSidebarSize();
},
/**
@@ -352,7 +351,7 @@
setSidebarSize: function(size)
{
this._innerSetSidebarSize(size);
- this._updatePreferredSidebarSize();
+ this._saveSetting();
},
/**
@@ -629,6 +628,7 @@
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 +650,7 @@
_endResizerDragging: function(event)
{
delete this._dragOffset;
- this._updatePreferredSidebarSize();
+ this._saveSetting();
},
hideDefaultResizer: function()
@@ -728,12 +728,12 @@
/**
* @return {number}
*/
- _savedSidebarSize: function()
+ _lastSidebarSize: function()
{
var settingForOrientation = this._settingForOrientation();
var size = settingForOrientation ? settingForOrientation.size : 0;
if (!size)
- size = this._isVertical ? this._defaultSidebarWidth : this._defaultSidebarHeight;
+ size = this._isVertical ? this._savedSidebarWidth : this._savedSidebarHeight;
if (this._useFraction)
size *= this.totalSize();
return size;
@@ -759,15 +759,16 @@
return size;
},
- _updatePreferredSidebarSize: function()
- {
- this._preferredSidebarSize = this._sizeToSave();
- this._saveSetting();
- },
-
_saveSetting: function()
{
- var size = this._preferredSidebarSize;
+ var size = this._sizeToSave();
+
+ if (size !== -1) {
+ if (this._isVertical)
+ this._savedSidebarWidth = size;
+ else
+ this._savedSidebarHeight = size;
+ }
var setting = this._setting();
if (!setting)
@@ -792,7 +793,7 @@
{
var data = /** @type {{from: number, to: number}} */ (event.data);
this._innerSetSidebarSize(this.sidebarSize() * data.from / data.to, true);
- this._updatePreferredSidebarSize();
+ this._saveSetting();
},
/**
« no previous file with comments | « LayoutTests/http/tests/inspector/network/network-sidebar-width.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698