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 |