Commit 29654016 authored by Hixie's avatar Hixie

More BoxConstraints asserts

The asserting will continue until morale improves!

* Convert all assert(*.isNormalized) checks to use the new
  debugAssertIsNormalized technology.
* Convert CustomMultiChildLayout to use the new RenderingError
  technology to greatly improve the detail in errors you get when
  writing CustomMultiChildLayout delegates.
* Add BoxConstraints.copyWith().
* Indent the descendants in the rendering exception data dump so that
  when you have multiple children it's clearer what's going on.
parent 64f588c1
...@@ -164,7 +164,7 @@ class RenderBlock extends RenderBlockBase { ...@@ -164,7 +164,7 @@ class RenderBlock extends RenderBlockBase {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (isVertical) { if (isVertical) {
return _getIntrinsicCrossAxis( return _getIntrinsicCrossAxis(
constraints, constraints,
...@@ -176,7 +176,7 @@ class RenderBlock extends RenderBlockBase { ...@@ -176,7 +176,7 @@ class RenderBlock extends RenderBlockBase {
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (isVertical) { if (isVertical) {
return _getIntrinsicCrossAxis( return _getIntrinsicCrossAxis(
constraints, constraints,
...@@ -188,7 +188,7 @@ class RenderBlock extends RenderBlockBase { ...@@ -188,7 +188,7 @@ class RenderBlock extends RenderBlockBase {
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (isVertical) if (isVertical)
return _getIntrinsicMainAxis(constraints, constraints.constrainHeight); return _getIntrinsicMainAxis(constraints, constraints.constrainHeight);
return _getIntrinsicCrossAxis( return _getIntrinsicCrossAxis(
...@@ -199,7 +199,7 @@ class RenderBlock extends RenderBlockBase { ...@@ -199,7 +199,7 @@ class RenderBlock extends RenderBlockBase {
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (isVertical) if (isVertical)
return _getIntrinsicMainAxis(constraints, constraints.constrainHeight); return _getIntrinsicMainAxis(constraints, constraints.constrainHeight);
return _getIntrinsicCrossAxis( return _getIntrinsicCrossAxis(
...@@ -367,28 +367,28 @@ class RenderBlockViewport extends RenderBlockBase { ...@@ -367,28 +367,28 @@ class RenderBlockViewport extends RenderBlockBase {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (isVertical) if (isVertical)
return _getIntrinsicDimension(constraints, minCrossAxisExtentCallback, constraints.constrainWidth); return _getIntrinsicDimension(constraints, minCrossAxisExtentCallback, constraints.constrainWidth);
return constraints.constrainWidth(minExtent); return constraints.constrainWidth(minExtent);
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (isVertical) if (isVertical)
return _getIntrinsicDimension(constraints, maxCrossAxisExtentCallback, constraints.constrainWidth); return _getIntrinsicDimension(constraints, maxCrossAxisExtentCallback, constraints.constrainWidth);
return _getIntrinsicDimension(constraints, totalExtentCallback, new BoxConstraints(minWidth: minExtent).enforce(constraints).constrainWidth); return _getIntrinsicDimension(constraints, totalExtentCallback, new BoxConstraints(minWidth: minExtent).enforce(constraints).constrainWidth);
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (!isVertical) if (!isVertical)
return _getIntrinsicDimension(constraints, minCrossAxisExtentCallback, constraints.constrainHeight); return _getIntrinsicDimension(constraints, minCrossAxisExtentCallback, constraints.constrainHeight);
return constraints.constrainHeight(0.0); return constraints.constrainHeight(0.0);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (!isVertical) if (!isVertical)
return _getIntrinsicDimension(constraints, maxCrossAxisExtentCallback, constraints.constrainHeight); return _getIntrinsicDimension(constraints, maxCrossAxisExtentCallback, constraints.constrainHeight);
return _getIntrinsicDimension(constraints, totalExtentCallback, new BoxConstraints(minHeight: minExtent).enforce(constraints).constrainHeight); return _getIntrinsicDimension(constraints, totalExtentCallback, new BoxConstraints(minHeight: minExtent).enforce(constraints).constrainHeight);
......
...@@ -95,6 +95,21 @@ class BoxConstraints extends Constraints { ...@@ -95,6 +95,21 @@ class BoxConstraints extends Constraints {
minHeight = height != null ? height : double.INFINITY, minHeight = height != null ? height : double.INFINITY,
maxHeight = height != null ? height : double.INFINITY; maxHeight = height != null ? height : double.INFINITY;
/// Returns new box constraints that remove the minimum width and height requirements.
BoxConstraints copyWith({
double minWidth,
double maxWidth,
double minHeight,
double maxHeight
}) {
return new BoxConstraints(
minWidth: minWidth ?? this.minWidth,
maxWidth: maxWidth ?? this.maxWidth,
minHeight: minHeight ?? this.minHeight,
maxHeight: maxHeight ?? this.maxHeight
);
}
/// Returns new box constraints that are smaller by the given edge dimensions. /// Returns new box constraints that are smaller by the given edge dimensions.
BoxConstraints deflate(EdgeDims edges) { BoxConstraints deflate(EdgeDims edges) {
assert(edges != null); assert(edges != null);
......
...@@ -32,12 +32,32 @@ abstract class MultiChildLayoutDelegate { ...@@ -32,12 +32,32 @@ abstract class MultiChildLayoutDelegate {
/// the constraints parameter. The child's size is returned. /// the constraints parameter. The child's size is returned.
Size layoutChild(Object childId, BoxConstraints constraints) { Size layoutChild(Object childId, BoxConstraints constraints) {
final RenderBox child = _idToChild[childId]; final RenderBox child = _idToChild[childId];
assert(child != null);
assert(() { assert(() {
'A MultiChildLayoutDelegate cannot layout the same child more than once.'; if (child == null) {
return _debugChildrenNeedingLayout.remove(child); throw new RenderingError(
'The $this custom multichild layout delegate tried to lay out a non-existent child:\n'
'There is no child with the id "$childId".'
);
}
if (!_debugChildrenNeedingLayout.remove(child)) {
throw new RenderingError(
'The $this custom multichild layout delegate tried to lay out the child with id "$childId" more than once.\n'
'Each child must be laid out exactly once.'
);
}
try {
assert(constraints.debugAssertIsNormalized);
} on AssertionError catch (exception) {
throw new RenderingError(
'The $this custom multichild layout delegate provided invalid box constraints for the child with id "$childId":\n'
'$exception\n'
'The minimum width and height must be greater than or equal to zero.\n'
'The maximum width must be greater than or equal to the minimum width.\n'
'The maximum height must be greater than or equal to the minimum height.'
);
}
return true;
}); });
assert(constraints.isNormalized);
child.layout(constraints, parentUsesSize: true); child.layout(constraints, parentUsesSize: true);
return child.size; return child.size;
} }
...@@ -45,11 +65,29 @@ abstract class MultiChildLayoutDelegate { ...@@ -45,11 +65,29 @@ abstract class MultiChildLayoutDelegate {
/// Specify the child's origin relative to this origin. /// Specify the child's origin relative to this origin.
void positionChild(Object childId, Offset offset) { void positionChild(Object childId, Offset offset) {
final RenderBox child = _idToChild[childId]; final RenderBox child = _idToChild[childId];
assert(child != null); assert(() {
if (child == null) {
throw new RenderingError(
'The $this custom multichild layout delegate tried to position out a non-existent child:\n'
'There is no child with the id "$childId".'
);
}
if (offset == null) {
throw new RenderingError(
'The $this custom multichild layout delegate provided a null position for the child with id "$childId".'
);
}
return true;
});
final MultiChildLayoutParentData childParentData = child.parentData; final MultiChildLayoutParentData childParentData = child.parentData;
childParentData.offset = offset; childParentData.offset = offset;
} }
String _debugDescribeChild(RenderBox child) {
final MultiChildLayoutParentData childParentData = child.parentData;
return '${childParentData.id}: $child';
}
void _callPerformLayout(Size size, BoxConstraints constraints, RenderBox firstChild) { void _callPerformLayout(Size size, BoxConstraints constraints, RenderBox firstChild) {
final Map<Object, RenderBox> previousIdToChild = _idToChild; final Map<Object, RenderBox> previousIdToChild = _idToChild;
...@@ -65,7 +103,16 @@ abstract class MultiChildLayoutDelegate { ...@@ -65,7 +103,16 @@ abstract class MultiChildLayoutDelegate {
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
final MultiChildLayoutParentData childParentData = child.parentData; final MultiChildLayoutParentData childParentData = child.parentData;
assert(childParentData.id != null); assert(() {
if (childParentData.id == null) {
throw new RenderingError(
'The following child has no ID:\n'
' $child\n'
'Every child of a RenderCustomMultiChildLayoutBox must have an ID in its parent data.'
);
}
return true;
});
_idToChild[childParentData.id] = child; _idToChild[childParentData.id] = child;
assert(() { assert(() {
_debugChildrenNeedingLayout.add(child); _debugChildrenNeedingLayout.add(child);
...@@ -75,8 +122,22 @@ abstract class MultiChildLayoutDelegate { ...@@ -75,8 +122,22 @@ abstract class MultiChildLayoutDelegate {
} }
performLayout(size, constraints); performLayout(size, constraints);
assert(() { assert(() {
'A MultiChildLayoutDelegate needs to call layoutChild on every child.'; if (_debugChildrenNeedingLayout.isNotEmpty) {
return _debugChildrenNeedingLayout.isEmpty; if (_debugChildrenNeedingLayout.length > 1) {
throw new RenderingError(
'The $this custom multichild layout delegate forgot to lay out the following children:\n'
' ${_debugChildrenNeedingLayout.map(_debugDescribeChild).join("\n ")}\n'
'Each child must be laid out exactly once.'
);
} else {
throw new RenderingError(
'The $this custom multichild layout delegate forgot to lay out the following child:\n'
' ${_debugDescribeChild(_debugChildrenNeedingLayout.single)}\n'
'Each child must be laid out exactly once.'
);
}
}
return true;
}); });
} finally { } finally {
_idToChild = previousIdToChild; _idToChild = previousIdToChild;
...@@ -94,6 +155,8 @@ abstract class MultiChildLayoutDelegate { ...@@ -94,6 +155,8 @@ abstract class MultiChildLayoutDelegate {
/// constraints. This method must apply layoutChild() to each child. It should /// constraints. This method must apply layoutChild() to each child. It should
/// specify the final position of each child with positionChild(). /// specify the final position of each child with positionChild().
void performLayout(Size size, BoxConstraints constraints); void performLayout(Size size, BoxConstraints constraints);
String toString() => '$runtimeType';
} }
/// Defers the layout of multiple children to a delegate. /// Defers the layout of multiple children to a delegate.
...@@ -131,7 +194,7 @@ class RenderCustomMultiChildLayoutBox extends RenderBox ...@@ -131,7 +194,7 @@ class RenderCustomMultiChildLayoutBox extends RenderBox
} }
Size _getSize(BoxConstraints constraints) { Size _getSize(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.constrain(_delegate.getSize(constraints)); return constraints.constrain(_delegate.getSize(constraints));
} }
......
...@@ -132,22 +132,22 @@ class RenderEditableLine extends RenderBox { ...@@ -132,22 +132,22 @@ class RenderEditableLine extends RenderBox {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.constrainWidth(0.0); return constraints.constrainWidth(0.0);
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.constrainWidth(0.0); return constraints.constrainWidth(0.0);
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.constrainHeight(_preferredHeight); return constraints.constrainHeight(_preferredHeight);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.constrainHeight(_preferredHeight); return constraints.constrainHeight(_preferredHeight);
} }
...@@ -183,7 +183,7 @@ class RenderEditableLine extends RenderBox { ...@@ -183,7 +183,7 @@ class RenderEditableLine extends RenderBox {
// TODO(abarth): This logic should live in TextPainter and be shared with RenderParagraph. // TODO(abarth): This logic should live in TextPainter and be shared with RenderParagraph.
void _layoutText(BoxConstraints constraints) { void _layoutText(BoxConstraints constraints) {
assert(constraints != null); assert(constraints != null);
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (_constraintsForCurrentLayout == constraints) if (_constraintsForCurrentLayout == constraints)
return; // already cached this layout return; // already cached this layout
_textPainter.maxWidth = constraints.maxWidth; _textPainter.maxWidth = constraints.maxWidth;
......
...@@ -142,7 +142,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl ...@@ -142,7 +142,7 @@ class RenderFlex extends RenderBox with ContainerRenderObjectMixin<RenderBox, Fl
double _getIntrinsicSize({ BoxConstraints constraints, double _getIntrinsicSize({ BoxConstraints constraints,
FlexDirection sizingDirection, FlexDirection sizingDirection,
_ChildSizingFunction childSize }) { _ChildSizingFunction childSize }) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
// http://www.w3.org/TR/2015/WD-css-flexbox-1-20150514/#intrinsic-sizes // http://www.w3.org/TR/2015/WD-css-flexbox-1-20150514/#intrinsic-sizes
if (_direction == sizingDirection) { if (_direction == sizingDirection) {
// INTRINSIC MAIN SIZE // INTRINSIC MAIN SIZE
......
...@@ -371,22 +371,22 @@ class RenderGrid extends RenderVirtualViewport<GridParentData> { ...@@ -371,22 +371,22 @@ class RenderGrid extends RenderVirtualViewport<GridParentData> {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _delegate.getMinIntrinsicWidth(constraints, virtualChildCount); return _delegate.getMinIntrinsicWidth(constraints, virtualChildCount);
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _delegate.getMaxIntrinsicWidth(constraints, virtualChildCount); return _delegate.getMaxIntrinsicWidth(constraints, virtualChildCount);
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _delegate.getMinIntrinsicHeight(constraints, virtualChildCount); return _delegate.getMinIntrinsicHeight(constraints, virtualChildCount);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _delegate.getMaxIntrinsicHeight(constraints, virtualChildCount); return _delegate.getMaxIntrinsicHeight(constraints, virtualChildCount);
} }
......
...@@ -206,26 +206,26 @@ class RenderImage extends RenderBox { ...@@ -206,26 +206,26 @@ class RenderImage extends RenderBox {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (_width == null && _height == null) if (_width == null && _height == null)
return constraints.constrainWidth(0.0); return constraints.constrainWidth(0.0);
return _sizeForConstraints(constraints).width; return _sizeForConstraints(constraints).width;
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _sizeForConstraints(constraints).width; return _sizeForConstraints(constraints).width;
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (_width == null && _height == null) if (_width == null && _height == null)
return constraints.constrainHeight(0.0); return constraints.constrainHeight(0.0);
return _sizeForConstraints(constraints).height; return _sizeForConstraints(constraints).height;
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _sizeForConstraints(constraints).height; return _sizeForConstraints(constraints).height;
} }
......
...@@ -79,7 +79,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> { ...@@ -79,7 +79,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
} }
double _getIntrinsicWidth(BoxConstraints constraints) { double _getIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
switch (scrollDirection) { switch (scrollDirection) {
case Axis.vertical: case Axis.vertical:
return constraints.constrainWidth(0.0); return constraints.constrainWidth(0.0);
...@@ -97,7 +97,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> { ...@@ -97,7 +97,7 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
} }
double _getIntrinsicHeight(BoxConstraints constraints) { double _getIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
switch (scrollDirection) { switch (scrollDirection) {
case Axis.vertical: case Axis.vertical:
return constraints.constrainHeight(_preferredExtent); return constraints.constrainHeight(_preferredExtent);
......
...@@ -740,8 +740,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -740,8 +740,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
List<String> descendants = <String>[]; List<String> descendants = <String>[];
const int maxDepth = 5; const int maxDepth = 5;
void visitor(RenderObject child) { void visitor(RenderObject child) {
descendants.add('${" " * depth}$child');
depth += 1; depth += 1;
descendants.add('${" " * depth}$child');
if (depth < maxDepth) if (depth < maxDepth)
child.visitChildren(visitor); child.visitChildren(visitor);
depth -= 1; depth -= 1;
......
...@@ -29,22 +29,22 @@ class RenderSizedOverflowBox extends RenderBox with RenderObjectWithChildMixin<R ...@@ -29,22 +29,22 @@ class RenderSizedOverflowBox extends RenderBox with RenderObjectWithChildMixin<R
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.constrainWidth(_requestedSize.width); return constraints.constrainWidth(_requestedSize.width);
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.constrainWidth(_requestedSize.width); return constraints.constrainWidth(_requestedSize.width);
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.constrainHeight(_requestedSize.height); return constraints.constrainHeight(_requestedSize.height);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.constrainHeight(_requestedSize.height); return constraints.constrainHeight(_requestedSize.height);
} }
......
...@@ -46,7 +46,7 @@ class RenderParagraph extends RenderBox { ...@@ -46,7 +46,7 @@ class RenderParagraph extends RenderBox {
// TODO(abarth): This logic should live in TextPainter and be shared with RenderEditableLine. // TODO(abarth): This logic should live in TextPainter and be shared with RenderEditableLine.
void _layoutText(BoxConstraints constraints) { void _layoutText(BoxConstraints constraints) {
assert(constraints != null); assert(constraints != null);
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (_constraintsForCurrentLayout == constraints) if (_constraintsForCurrentLayout == constraints)
return; // already cached this layout return; // already cached this layout
_textPainter.maxWidth = constraints.maxWidth; _textPainter.maxWidth = constraints.maxWidth;
...@@ -78,12 +78,12 @@ class RenderParagraph extends RenderBox { ...@@ -78,12 +78,12 @@ class RenderParagraph extends RenderBox {
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _getIntrinsicHeight(constraints); return _getIntrinsicHeight(constraints);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _getIntrinsicHeight(constraints); return _getIntrinsicHeight(constraints);
} }
......
...@@ -39,28 +39,28 @@ class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox ...@@ -39,28 +39,28 @@ class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMinIntrinsicWidth(constraints); return child.getMinIntrinsicWidth(constraints);
return super.getMinIntrinsicWidth(constraints); return super.getMinIntrinsicWidth(constraints);
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMaxIntrinsicWidth(constraints); return child.getMaxIntrinsicWidth(constraints);
return super.getMaxIntrinsicWidth(constraints); return super.getMaxIntrinsicWidth(constraints);
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMinIntrinsicHeight(constraints); return child.getMinIntrinsicHeight(constraints);
return super.getMinIntrinsicHeight(constraints); return super.getMinIntrinsicHeight(constraints);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMaxIntrinsicHeight(constraints); return child.getMaxIntrinsicHeight(constraints);
return super.getMaxIntrinsicHeight(constraints); return super.getMaxIntrinsicHeight(constraints);
...@@ -162,7 +162,7 @@ class RenderConstrainedBox extends RenderProxyBox { ...@@ -162,7 +162,7 @@ class RenderConstrainedBox extends RenderProxyBox {
BoxConstraints additionalConstraints BoxConstraints additionalConstraints
}) : _additionalConstraints = additionalConstraints, super(child) { }) : _additionalConstraints = additionalConstraints, super(child) {
assert(additionalConstraints != null); assert(additionalConstraints != null);
assert(additionalConstraints.isNormalized); assert(additionalConstraints.debugAssertIsNormalized);
} }
/// Additional constraints to apply to [child] during layout /// Additional constraints to apply to [child] during layout
...@@ -170,7 +170,7 @@ class RenderConstrainedBox extends RenderProxyBox { ...@@ -170,7 +170,7 @@ class RenderConstrainedBox extends RenderProxyBox {
BoxConstraints _additionalConstraints; BoxConstraints _additionalConstraints;
void set additionalConstraints (BoxConstraints newConstraints) { void set additionalConstraints (BoxConstraints newConstraints) {
assert(newConstraints != null); assert(newConstraints != null);
assert(newConstraints.isNormalized); assert(newConstraints.debugAssertIsNormalized);
if (_additionalConstraints == newConstraints) if (_additionalConstraints == newConstraints)
return; return;
_additionalConstraints = newConstraints; _additionalConstraints = newConstraints;
...@@ -178,28 +178,28 @@ class RenderConstrainedBox extends RenderProxyBox { ...@@ -178,28 +178,28 @@ class RenderConstrainedBox extends RenderProxyBox {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMinIntrinsicWidth(_additionalConstraints.enforce(constraints)); return child.getMinIntrinsicWidth(_additionalConstraints.enforce(constraints));
return _additionalConstraints.enforce(constraints).constrainWidth(0.0); return _additionalConstraints.enforce(constraints).constrainWidth(0.0);
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMaxIntrinsicWidth(_additionalConstraints.enforce(constraints)); return child.getMaxIntrinsicWidth(_additionalConstraints.enforce(constraints));
return _additionalConstraints.enforce(constraints).constrainWidth(0.0); return _additionalConstraints.enforce(constraints).constrainWidth(0.0);
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMinIntrinsicHeight(_additionalConstraints.enforce(constraints)); return child.getMinIntrinsicHeight(_additionalConstraints.enforce(constraints));
return _additionalConstraints.enforce(constraints).constrainHeight(0.0); return _additionalConstraints.enforce(constraints).constrainHeight(0.0);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMaxIntrinsicHeight(_additionalConstraints.enforce(constraints)); return child.getMaxIntrinsicHeight(_additionalConstraints.enforce(constraints));
return _additionalConstraints.enforce(constraints).constrainHeight(0.0); return _additionalConstraints.enforce(constraints).constrainHeight(0.0);
...@@ -306,28 +306,28 @@ class RenderFractionallySizedBox extends RenderProxyBox { ...@@ -306,28 +306,28 @@ class RenderFractionallySizedBox extends RenderProxyBox {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMinIntrinsicWidth(_getInnerConstraints(constraints)); return child.getMinIntrinsicWidth(_getInnerConstraints(constraints));
return _getInnerConstraints(constraints).constrainWidth(0.0); return _getInnerConstraints(constraints).constrainWidth(0.0);
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMaxIntrinsicWidth(_getInnerConstraints(constraints)); return child.getMaxIntrinsicWidth(_getInnerConstraints(constraints));
return _getInnerConstraints(constraints).constrainWidth(0.0); return _getInnerConstraints(constraints).constrainWidth(0.0);
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMinIntrinsicHeight(_getInnerConstraints(constraints)); return child.getMinIntrinsicHeight(_getInnerConstraints(constraints));
return _getInnerConstraints(constraints).constrainHeight(0.0); return _getInnerConstraints(constraints).constrainHeight(0.0);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMaxIntrinsicHeight(_getInnerConstraints(constraints)); return child.getMaxIntrinsicHeight(_getInnerConstraints(constraints));
return _getInnerConstraints(constraints).constrainHeight(0.0); return _getInnerConstraints(constraints).constrainHeight(0.0);
...@@ -396,7 +396,7 @@ class RenderAspectRatio extends RenderProxyBox { ...@@ -396,7 +396,7 @@ class RenderAspectRatio extends RenderProxyBox {
} }
Size _applyAspectRatio(BoxConstraints constraints) { Size _applyAspectRatio(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
double width = constraints.constrainWidth(); double width = constraints.constrainWidth();
double height = constraints.constrainHeight(width / _aspectRatio); double height = constraints.constrainHeight(width / _aspectRatio);
return new Size(width, height); return new Size(width, height);
...@@ -475,12 +475,12 @@ class RenderIntrinsicWidth extends RenderProxyBox { ...@@ -475,12 +475,12 @@ class RenderIntrinsicWidth extends RenderProxyBox {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return getMaxIntrinsicWidth(constraints); return getMaxIntrinsicWidth(constraints);
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child == null) if (child == null)
return constraints.constrainWidth(0.0); return constraints.constrainWidth(0.0);
double childResult = child.getMaxIntrinsicWidth(constraints); double childResult = child.getMaxIntrinsicWidth(constraints);
...@@ -488,7 +488,7 @@ class RenderIntrinsicWidth extends RenderProxyBox { ...@@ -488,7 +488,7 @@ class RenderIntrinsicWidth extends RenderProxyBox {
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child == null) if (child == null)
return constraints.constrainHeight(0.0); return constraints.constrainHeight(0.0);
double childResult = child.getMinIntrinsicHeight(_getInnerConstraints(constraints)); double childResult = child.getMinIntrinsicHeight(_getInnerConstraints(constraints));
...@@ -496,7 +496,7 @@ class RenderIntrinsicWidth extends RenderProxyBox { ...@@ -496,7 +496,7 @@ class RenderIntrinsicWidth extends RenderProxyBox {
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child == null) if (child == null)
return constraints.constrainHeight(0.0); return constraints.constrainHeight(0.0);
double childResult = child.getMaxIntrinsicHeight(_getInnerConstraints(constraints)); double childResult = child.getMaxIntrinsicHeight(_getInnerConstraints(constraints));
...@@ -545,26 +545,26 @@ class RenderIntrinsicHeight extends RenderProxyBox { ...@@ -545,26 +545,26 @@ class RenderIntrinsicHeight extends RenderProxyBox {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child == null) if (child == null)
return constraints.constrainWidth(0.0); return constraints.constrainWidth(0.0);
return child.getMinIntrinsicWidth(_getInnerConstraints(constraints)); return child.getMinIntrinsicWidth(_getInnerConstraints(constraints));
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child == null) if (child == null)
return constraints.constrainWidth(0.0); return constraints.constrainWidth(0.0);
return child.getMaxIntrinsicWidth(_getInnerConstraints(constraints)); return child.getMaxIntrinsicWidth(_getInnerConstraints(constraints));
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return getMaxIntrinsicHeight(constraints); return getMaxIntrinsicHeight(constraints);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child == null) if (child == null)
return constraints.constrainHeight(0.0); return constraints.constrainHeight(0.0);
return child.getMaxIntrinsicHeight(constraints); return child.getMaxIntrinsicHeight(constraints);
......
...@@ -19,28 +19,28 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi ...@@ -19,28 +19,28 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMinIntrinsicWidth(constraints); return child.getMinIntrinsicWidth(constraints);
return super.getMinIntrinsicWidth(constraints); return super.getMinIntrinsicWidth(constraints);
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMaxIntrinsicWidth(constraints); return child.getMaxIntrinsicWidth(constraints);
return super.getMaxIntrinsicWidth(constraints); return super.getMaxIntrinsicWidth(constraints);
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMinIntrinsicHeight(constraints); return child.getMinIntrinsicHeight(constraints);
return super.getMinIntrinsicHeight(constraints); return super.getMinIntrinsicHeight(constraints);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return child.getMaxIntrinsicHeight(constraints); return child.getMaxIntrinsicHeight(constraints);
return super.getMaxIntrinsicHeight(constraints); return super.getMaxIntrinsicHeight(constraints);
...@@ -107,7 +107,7 @@ class RenderPadding extends RenderShiftedBox { ...@@ -107,7 +107,7 @@ class RenderPadding extends RenderShiftedBox {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
double totalPadding = padding.left + padding.right; double totalPadding = padding.left + padding.right;
if (child != null) if (child != null)
return constraints.constrainWidth(child.getMinIntrinsicWidth(constraints.deflate(padding)) + totalPadding); return constraints.constrainWidth(child.getMinIntrinsicWidth(constraints.deflate(padding)) + totalPadding);
...@@ -115,7 +115,7 @@ class RenderPadding extends RenderShiftedBox { ...@@ -115,7 +115,7 @@ class RenderPadding extends RenderShiftedBox {
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
double totalPadding = padding.left + padding.right; double totalPadding = padding.left + padding.right;
if (child != null) if (child != null)
return constraints.constrainWidth(child.getMaxIntrinsicWidth(constraints.deflate(padding)) + totalPadding); return constraints.constrainWidth(child.getMaxIntrinsicWidth(constraints.deflate(padding)) + totalPadding);
...@@ -123,7 +123,7 @@ class RenderPadding extends RenderShiftedBox { ...@@ -123,7 +123,7 @@ class RenderPadding extends RenderShiftedBox {
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
double totalPadding = padding.top + padding.bottom; double totalPadding = padding.top + padding.bottom;
if (child != null) if (child != null)
return constraints.constrainHeight(child.getMinIntrinsicHeight(constraints.deflate(padding)) + totalPadding); return constraints.constrainHeight(child.getMinIntrinsicHeight(constraints.deflate(padding)) + totalPadding);
...@@ -131,7 +131,7 @@ class RenderPadding extends RenderShiftedBox { ...@@ -131,7 +131,7 @@ class RenderPadding extends RenderShiftedBox {
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
double totalPadding = padding.top + padding.bottom; double totalPadding = padding.top + padding.bottom;
if (child != null) if (child != null)
return constraints.constrainHeight(child.getMaxIntrinsicHeight(constraints.deflate(padding)) + totalPadding); return constraints.constrainHeight(child.getMaxIntrinsicHeight(constraints.deflate(padding)) + totalPadding);
...@@ -465,22 +465,22 @@ class RenderOverflowBox extends RenderShiftedBox { ...@@ -465,22 +465,22 @@ class RenderOverflowBox extends RenderShiftedBox {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.minWidth; return constraints.minWidth;
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.minWidth; return constraints.minWidth;
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.minHeight; return constraints.minHeight;
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return constraints.minHeight; return constraints.minHeight;
} }
...@@ -554,22 +554,22 @@ class RenderCustomOneChildLayoutBox extends RenderShiftedBox { ...@@ -554,22 +554,22 @@ class RenderCustomOneChildLayoutBox extends RenderShiftedBox {
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _getSize(constraints).width; return _getSize(constraints).width;
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _getSize(constraints).width; return _getSize(constraints).width;
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _getSize(constraints).height; return _getSize(constraints).height;
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
return _getSize(constraints).height; return _getSize(constraints).height;
} }
...@@ -582,7 +582,7 @@ class RenderCustomOneChildLayoutBox extends RenderShiftedBox { ...@@ -582,7 +582,7 @@ class RenderCustomOneChildLayoutBox extends RenderShiftedBox {
void performLayout() { void performLayout() {
if (child != null) { if (child != null) {
BoxConstraints childConstraints = delegate.getConstraintsForChild(constraints); BoxConstraints childConstraints = delegate.getConstraintsForChild(constraints);
assert(childConstraints.isNormalized); assert(childConstraints.debugAssertIsNormalized);
child.layout(childConstraints, parentUsesSize: !childConstraints.isTight); child.layout(childConstraints, parentUsesSize: !childConstraints.isTight);
final BoxParentData childParentData = child.parentData; final BoxParentData childParentData = child.parentData;
childParentData.offset = delegate.getPositionForChild(size, childConstraints.isTight ? childConstraints.smallest : child.size); childParentData.offset = delegate.getPositionForChild(size, childConstraints.isTight ? childConstraints.smallest : child.size);
......
...@@ -220,7 +220,7 @@ abstract class RenderStackBase extends RenderBox ...@@ -220,7 +220,7 @@ abstract class RenderStackBase extends RenderBox
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
double width = constraints.minWidth; double width = constraints.minWidth;
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
...@@ -235,7 +235,7 @@ abstract class RenderStackBase extends RenderBox ...@@ -235,7 +235,7 @@ abstract class RenderStackBase extends RenderBox
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
bool hasNonPositionedChildren = false; bool hasNonPositionedChildren = false;
double width = constraints.minWidth; double width = constraints.minWidth;
RenderBox child = firstChild; RenderBox child = firstChild;
...@@ -255,7 +255,7 @@ abstract class RenderStackBase extends RenderBox ...@@ -255,7 +255,7 @@ abstract class RenderStackBase extends RenderBox
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
double height = constraints.minHeight; double height = constraints.minHeight;
RenderBox child = firstChild; RenderBox child = firstChild;
while (child != null) { while (child != null) {
...@@ -270,7 +270,7 @@ abstract class RenderStackBase extends RenderBox ...@@ -270,7 +270,7 @@ abstract class RenderStackBase extends RenderBox
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
bool hasNonPositionedChildren = false; bool hasNonPositionedChildren = false;
double height = constraints.minHeight; double height = constraints.minHeight;
RenderBox child = firstChild; RenderBox child = firstChild;
......
...@@ -195,28 +195,28 @@ class RenderViewport extends RenderViewportBase with RenderObjectWithChildMixin< ...@@ -195,28 +195,28 @@ class RenderViewport extends RenderViewportBase with RenderObjectWithChildMixin<
} }
double getMinIntrinsicWidth(BoxConstraints constraints) { double getMinIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return constraints.constrainWidth(child.getMinIntrinsicWidth(_getInnerConstraints(constraints))); return constraints.constrainWidth(child.getMinIntrinsicWidth(_getInnerConstraints(constraints)));
return super.getMinIntrinsicWidth(constraints); return super.getMinIntrinsicWidth(constraints);
} }
double getMaxIntrinsicWidth(BoxConstraints constraints) { double getMaxIntrinsicWidth(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return constraints.constrainWidth(child.getMaxIntrinsicWidth(_getInnerConstraints(constraints))); return constraints.constrainWidth(child.getMaxIntrinsicWidth(_getInnerConstraints(constraints)));
return super.getMaxIntrinsicWidth(constraints); return super.getMaxIntrinsicWidth(constraints);
} }
double getMinIntrinsicHeight(BoxConstraints constraints) { double getMinIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return constraints.constrainHeight(child.getMinIntrinsicHeight(_getInnerConstraints(constraints))); return constraints.constrainHeight(child.getMinIntrinsicHeight(_getInnerConstraints(constraints)));
return super.getMinIntrinsicHeight(constraints); return super.getMinIntrinsicHeight(constraints);
} }
double getMaxIntrinsicHeight(BoxConstraints constraints) { double getMaxIntrinsicHeight(BoxConstraints constraints) {
assert(constraints.isNormalized); assert(constraints.debugAssertIsNormalized);
if (child != null) if (child != null)
return constraints.constrainHeight(child.getMaxIntrinsicHeight(_getInnerConstraints(constraints))); return constraints.constrainHeight(child.getMaxIntrinsicHeight(_getInnerConstraints(constraints)));
return super.getMaxIntrinsicHeight(constraints); return super.getMaxIntrinsicHeight(constraints);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment