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

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

Issue 214663005: [DevTools] Add preferred size to WebInspector.View. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: saved main size 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
Index: Source/devtools/front_end/View.js
diff --git a/Source/devtools/front_end/View.js b/Source/devtools/front_end/View.js
index 628014ef822d389da600eb9b2156492cca66adbe..3d9f9f78e8851e2c31261d2f57febdb335384aa6 100644
--- a/Source/devtools/front_end/View.js
+++ b/Source/devtools/front_end/View.js
@@ -527,10 +527,12 @@ WebInspector.View.prototype = {
/**
* @param {number} width
* @param {number} height
+ * @param {number=} preferredWidth
+ * @param {number=} preferredHeight
*/
- setMinimumSize: function(width, height)
+ setMinimumSize: function(width, height, preferredWidth, preferredHeight)
{
- this._minimumSize = new Size(width, height);
+ this._minimumSize = new Size(width, height, preferredWidth, preferredHeight);
this.invalidateMinimumSize();
},
@@ -540,7 +542,7 @@ WebInspector.View.prototype = {
_hasNonZeroMinimumSize: function()
{
var size = this.minimumSize();
- return size.width || size.height;
+ return !!(size.width || size.height || size.preferredWidth || size.preferredHeight);
},
invalidateMinimumSize: function()
@@ -610,8 +612,7 @@ WebInspector.VBox.prototype = {
*/
calculateMinimumSize: function()
{
- var width = 0;
- var height = 0;
+ var size = new Size(0, 0);
/**
* @this {!WebInspector.View}
@@ -619,13 +620,13 @@ WebInspector.VBox.prototype = {
*/
function updateForChild()
{
- var size = this.minimumSize();
- width = Math.max(width, size.width);
- height += size.height;
+ var childSize = this.minimumSize();
+ size = size.widthToMax(childSize);
+ size = size.addHeight(childSize);
}
this._callOnVisibleChildren(updateForChild);
- return new Size(width, height);
+ return size;
},
__proto__: WebInspector.View.prototype
@@ -647,8 +648,7 @@ WebInspector.HBox.prototype = {
*/
calculateMinimumSize: function()
{
- var width = 0;
- var height = 0;
+ var size = new Size(0, 0);
/**
* @this {!WebInspector.View}
@@ -656,13 +656,13 @@ WebInspector.HBox.prototype = {
*/
function updateForChild()
{
- var size = this.minimumSize();
- width += size.width;
- height = Math.max(height, size.height);
+ var childSize = this.minimumSize();
+ size = size.addWidth(childSize);
+ size = size.heightToMax(childSize);
}
this._callOnVisibleChildren(updateForChild);
- return new Size(width, height);
+ return size;
},
__proto__: WebInspector.View.prototype
« Source/devtools/front_end/SplitView.js ('K') | « Source/devtools/front_end/TabbedPane.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698