| Index: sky/sdk/lib/rendering/box.dart
|
| diff --git a/sky/sdk/lib/rendering/box.dart b/sky/sdk/lib/rendering/box.dart
|
| index 460956bacb482e35f7f27a5266c12626bf64a0ad..5c1e884199219b4f201d8f5ea9acd7debdd99fc3 100644
|
| --- a/sky/sdk/lib/rendering/box.dart
|
| +++ b/sky/sdk/lib/rendering/box.dart
|
| @@ -41,6 +41,7 @@ class EdgeDims {
|
| final double bottom;
|
| final double left;
|
|
|
| + @override
|
| bool operator ==(other) {
|
| if (identical(this, other))
|
| return true;
|
| @@ -51,6 +52,7 @@ class EdgeDims {
|
| && left == other.left;
|
| }
|
|
|
| + @override
|
| int get hashCode {
|
| int value = 373;
|
| value = 37 * value + top.hashCode;
|
| @@ -59,6 +61,8 @@ class EdgeDims {
|
| value = 37 * value + right.hashCode;
|
| return value;
|
| }
|
| +
|
| + @override
|
| String toString() => "EdgeDims($top, $right, $bottom, $left)";
|
| }
|
|
|
| @@ -211,6 +215,8 @@ class BoxConstraints extends Constraints {
|
|
|
| bool get hasTightWidth => minWidth >= maxWidth;
|
| bool get hasTightHeight => minHeight >= maxHeight;
|
| +
|
| + @override
|
| bool get isTight => hasTightWidth && hasTightHeight;
|
|
|
| bool contains(Size size) {
|
| @@ -218,6 +224,7 @@ class BoxConstraints extends Constraints {
|
| (minHeight <= size.height) && (size.height <= math.max(minHeight, maxHeight));
|
| }
|
|
|
| + @override
|
| bool operator ==(other) {
|
| if (identical(this, other))
|
| return true;
|
| @@ -227,6 +234,8 @@ class BoxConstraints extends Constraints {
|
| minHeight == other.minHeight &&
|
| maxHeight == other.maxHeight;
|
| }
|
| +
|
| + @override
|
| int get hashCode {
|
| int value = 373;
|
| value = 37 * value + minWidth.hashCode;
|
| @@ -236,6 +245,7 @@ class BoxConstraints extends Constraints {
|
| return value;
|
| }
|
|
|
| + @override
|
| String toString() => "BoxConstraints($minWidth<=w<$maxWidth, $minHeight<=h<$maxHeight)";
|
| }
|
|
|
| @@ -251,6 +261,8 @@ class BoxParentData extends ParentData {
|
| assert(RenderObject.debugDoingLayout);
|
| _position = value;
|
| }
|
| +
|
| + @override
|
| String toString() => 'position=$position';
|
| }
|
|
|
| @@ -258,6 +270,7 @@ enum TextBaseline { alphabetic, ideographic }
|
|
|
| abstract class RenderBox extends RenderObject {
|
|
|
| + @override
|
| void setupParentData(RenderObject child) {
|
| if (child.parentData is! BoxParentData)
|
| child.parentData = new BoxParentData();
|
| @@ -350,7 +363,10 @@ abstract class RenderBox extends RenderObject {
|
| return null;
|
| }
|
|
|
| + @override
|
| BoxConstraints get constraints => super.constraints;
|
| +
|
| + @override
|
| bool debugDoesMeetConstraints() {
|
| assert(constraints != null);
|
| assert(_size != null);
|
| @@ -361,6 +377,7 @@ abstract class RenderBox extends RenderObject {
|
| return result;
|
| }
|
|
|
| + @override
|
| void markNeedsLayout() {
|
| if (_cachedBaselines != null && _cachedBaselines.isNotEmpty) {
|
| // if we have cached data, then someone must have used our data
|
| @@ -380,11 +397,15 @@ abstract class RenderBox extends RenderObject {
|
| }
|
| super.markNeedsLayout();
|
| }
|
| +
|
| + @override
|
| void performResize() {
|
| // default behaviour for subclasses that have sizedByParent = true
|
| size = constraints.constrain(Size.zero);
|
| assert(!size.isInfinite);
|
| }
|
| +
|
| + @override
|
| void performLayout() {
|
| // descendants have to either override performLayout() to set both
|
| // width and height and lay out children, or, set sizedByParent to
|
| @@ -429,8 +450,10 @@ abstract class RenderBox extends RenderObject {
|
| _size = inDebugBuild ? new _DebugSize(value, this, debugCanParentUseSize) : value;
|
| }
|
|
|
| + @override
|
| Rect get paintBounds => Point.origin & size;
|
|
|
| + @override
|
| String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}size: ${size}\n';
|
| }
|
|
|
| @@ -442,36 +465,42 @@ class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox
|
| this.child = child;
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicWidth(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMinIntrinsicWidth(constraints);
|
| return super.getMinIntrinsicWidth(constraints);
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicWidth(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMaxIntrinsicWidth(constraints);
|
| return super.getMaxIntrinsicWidth(constraints);
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicHeight(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMinIntrinsicHeight(constraints);
|
| return super.getMinIntrinsicHeight(constraints);
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicHeight(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMaxIntrinsicHeight(constraints);
|
| return super.getMaxIntrinsicHeight(constraints);
|
| }
|
|
|
| + @override
|
| double computeDistanceToActualBaseline(TextBaseline baseline) {
|
| if (child != null)
|
| return child.getDistanceToActualBaseline(baseline);
|
| return super.computeDistanceToActualBaseline(baseline);
|
| }
|
|
|
| + @override
|
| void performLayout() {
|
| if (child != null) {
|
| child.layout(constraints, parentUsesSize: true);
|
| @@ -481,6 +510,7 @@ class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox
|
| }
|
| }
|
|
|
| + @override
|
| void hitTestChildren(HitTestResult result, { Point position }) {
|
| if (child != null)
|
| child.hitTest(result, position: position);
|
| @@ -488,6 +518,7 @@ class RenderProxyBox extends RenderBox with RenderObjectWithChildMixin<RenderBox
|
| super.hitTestChildren(result, position: position);
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| if (child != null)
|
| canvas.paintChild(child, offset.toPoint());
|
| @@ -513,30 +544,35 @@ class RenderConstrainedBox extends RenderProxyBox {
|
| markNeedsLayout();
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicWidth(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMinIntrinsicWidth(_additionalConstraints.apply(constraints));
|
| return constraints.constrainWidth(0.0);
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicWidth(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMaxIntrinsicWidth(_additionalConstraints.apply(constraints));
|
| return constraints.constrainWidth(0.0);
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicHeight(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMinIntrinsicHeight(_additionalConstraints.apply(constraints));
|
| return constraints.constrainHeight(0.0);
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicHeight(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMaxIntrinsicHeight(_additionalConstraints.apply(constraints));
|
| return constraints.constrainHeight(0.0);
|
| }
|
|
|
| + @override
|
| void performLayout() {
|
| if (child != null) {
|
| child.layout(_additionalConstraints.apply(constraints), parentUsesSize: true);
|
| @@ -546,6 +582,7 @@ class RenderConstrainedBox extends RenderProxyBox {
|
| }
|
| }
|
|
|
| + @override
|
| String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}additionalConstraints: ${additionalConstraints}\n';
|
| }
|
|
|
| @@ -597,10 +634,12 @@ class RenderShrinkWrapWidth extends RenderProxyBox {
|
| return constraints.applyWidth(applyStep(width, _stepWidth));
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicWidth(BoxConstraints constraints) {
|
| return getMaxIntrinsicWidth(constraints);
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicWidth(BoxConstraints constraints) {
|
| if (child == null)
|
| return constraints.constrainWidth(0.0);
|
| @@ -608,6 +647,7 @@ class RenderShrinkWrapWidth extends RenderProxyBox {
|
| return constraints.constrainWidth(applyStep(childResult, _stepWidth));
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicHeight(BoxConstraints constraints) {
|
| if (child == null)
|
| return constraints.constrainWidth(0.0);
|
| @@ -615,6 +655,7 @@ class RenderShrinkWrapWidth extends RenderProxyBox {
|
| return constraints.constrainHeight(applyStep(childResult, _stepHeight));
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicHeight(BoxConstraints constraints) {
|
| if (child == null)
|
| return constraints.constrainWidth(0.0);
|
| @@ -622,6 +663,7 @@ class RenderShrinkWrapWidth extends RenderProxyBox {
|
| return constraints.constrainHeight(applyStep(childResult, _stepHeight));
|
| }
|
|
|
| + @override
|
| void performLayout() {
|
| if (child != null) {
|
| BoxConstraints childConstraints = _getInnerConstraints(constraints);
|
| @@ -634,6 +676,7 @@ class RenderShrinkWrapWidth extends RenderProxyBox {
|
| }
|
| }
|
|
|
| + @override
|
| String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}stepWidth: ${stepWidth}\n${prefix}stepHeight: ${stepHeight}\n';
|
|
|
| }
|
| @@ -655,6 +698,7 @@ class RenderOpacity extends RenderProxyBox {
|
| markNeedsPaint();
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| if (child != null) {
|
| int a = (_opacity * 255).round();
|
| @@ -702,6 +746,7 @@ class RenderColorFilter extends RenderProxyBox {
|
| markNeedsPaint();
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| if (child != null) {
|
| Paint paint = new Paint()
|
| @@ -716,6 +761,7 @@ class RenderColorFilter extends RenderProxyBox {
|
| class RenderClipRect extends RenderProxyBox {
|
| RenderClipRect({ RenderBox child }) : super(child);
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| if (child != null) {
|
| canvas.save();
|
| @@ -753,6 +799,7 @@ class RenderClipRRect extends RenderProxyBox {
|
| markNeedsPaint();
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| if (child != null) {
|
| Rect rect = offset & size;
|
| @@ -768,6 +815,7 @@ class RenderClipRRect extends RenderProxyBox {
|
| class RenderClipOval extends RenderProxyBox {
|
| RenderClipOval({ RenderBox child }) : super(child);
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| if (child != null) {
|
| Rect rect = offset & size;
|
| @@ -789,30 +837,35 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi
|
| this.child = child;
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicWidth(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMinIntrinsicWidth(constraints);
|
| return super.getMinIntrinsicWidth(constraints);
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicWidth(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMaxIntrinsicWidth(constraints);
|
| return super.getMaxIntrinsicWidth(constraints);
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicHeight(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMinIntrinsicHeight(constraints);
|
| return super.getMinIntrinsicHeight(constraints);
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicHeight(BoxConstraints constraints) {
|
| if (child != null)
|
| return child.getMaxIntrinsicHeight(constraints);
|
| return super.getMaxIntrinsicHeight(constraints);
|
| }
|
|
|
| + @override
|
| double computeDistanceToActualBaseline(TextBaseline baseline) {
|
| double result;
|
| if (child != null) {
|
| @@ -827,11 +880,13 @@ abstract class RenderShiftedBox extends RenderBox with RenderObjectWithChildMixi
|
| return result;
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| if (child != null)
|
| canvas.paintChild(child, child.parentData.position + offset);
|
| }
|
|
|
| + @override
|
| void hitTestChildren(HitTestResult result, { Point position }) {
|
| if (child != null) {
|
| assert(child.parentData is BoxParentData);
|
| @@ -862,6 +917,7 @@ class RenderPadding extends RenderShiftedBox {
|
| markNeedsLayout();
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicWidth(BoxConstraints constraints) {
|
| double totalPadding = padding.left + padding.right;
|
| if (child != null)
|
| @@ -869,6 +925,7 @@ class RenderPadding extends RenderShiftedBox {
|
| return constraints.constrainWidth(totalPadding);
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicWidth(BoxConstraints constraints) {
|
| double totalPadding = padding.left + padding.right;
|
| if (child != null)
|
| @@ -876,6 +933,7 @@ class RenderPadding extends RenderShiftedBox {
|
| return constraints.constrainWidth(totalPadding);
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicHeight(BoxConstraints constraints) {
|
| double totalPadding = padding.top + padding.bottom;
|
| if (child != null)
|
| @@ -883,6 +941,7 @@ class RenderPadding extends RenderShiftedBox {
|
| return constraints.constrainHeight(totalPadding);
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicHeight(BoxConstraints constraints) {
|
| double totalPadding = padding.top + padding.bottom;
|
| if (child != null)
|
| @@ -890,6 +949,7 @@ class RenderPadding extends RenderShiftedBox {
|
| return constraints.constrainHeight(totalPadding);
|
| }
|
|
|
| + @override
|
| void performLayout() {
|
| assert(padding != null);
|
| if (child == null) {
|
| @@ -909,6 +969,7 @@ class RenderPadding extends RenderShiftedBox {
|
| ));
|
| }
|
|
|
| + @override
|
| String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}padding: ${padding}\n';
|
| }
|
|
|
| @@ -951,6 +1012,7 @@ class RenderPositionedBox extends RenderShiftedBox {
|
| markNeedsLayout();
|
| }
|
|
|
| + @override
|
| void performLayout() {
|
| if (child != null) {
|
| child.layout(constraints.loosen(), parentUsesSize: true);
|
| @@ -963,6 +1025,7 @@ class RenderPositionedBox extends RenderShiftedBox {
|
| }
|
| }
|
|
|
| + @override
|
| String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}horizontal: ${horizontal}\n${prefix}vertical: ${vertical}\n';
|
| }
|
|
|
| @@ -999,6 +1062,7 @@ class RenderBaseline extends RenderShiftedBox {
|
| markNeedsLayout();
|
| }
|
|
|
| + @override
|
| void performLayout() {
|
| if (child != null) {
|
| child.layout(constraints.loosen(), parentUsesSize: true);
|
| @@ -1011,6 +1075,7 @@ class RenderBaseline extends RenderShiftedBox {
|
| }
|
| }
|
|
|
| + @override
|
| String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}baseline: ${baseline}\nbaselineType: ${baselineType}';
|
| }
|
|
|
| @@ -1081,30 +1146,36 @@ class RenderImage extends RenderBox {
|
| return constraints.constrain(requestedSize);
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicWidth(BoxConstraints constraints) {
|
| if (requestedSize.width == null && requestedSize.height == null)
|
| return constraints.constrainWidth(0.0);
|
| return _sizeForConstraints(constraints).width;
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicWidth(BoxConstraints constraints) {
|
| return _sizeForConstraints(constraints).width;
|
| }
|
|
|
| + @override
|
| double getMinIntrinsicHeight(BoxConstraints constraints) {
|
| if (requestedSize.width == null && requestedSize.height == null)
|
| return constraints.constrainHeight(0.0);
|
| return _sizeForConstraints(constraints).height;
|
| }
|
|
|
| + @override
|
| double getMaxIntrinsicHeight(BoxConstraints constraints) {
|
| return _sizeForConstraints(constraints).height;
|
| }
|
|
|
| + @override
|
| void performLayout() {
|
| size = _sizeForConstraints(constraints);
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| if (_image == null)
|
| return;
|
| @@ -1123,6 +1194,7 @@ class RenderImage extends RenderBox {
|
| canvas.restore();
|
| }
|
|
|
| + @override
|
| String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}dimensions: ${requestedSize}\n';
|
| }
|
|
|
| @@ -1147,6 +1219,7 @@ class RenderDecoratedBox extends RenderProxyBox {
|
| markNeedsPaint();
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| assert(size.width != null);
|
| assert(size.height != null);
|
| @@ -1154,10 +1227,12 @@ class RenderDecoratedBox extends RenderProxyBox {
|
| super.paint(canvas, offset);
|
| }
|
|
|
| + @override
|
| String debugDescribeSettings(String prefix) => '${super.debugDescribeSettings(prefix)}${prefix}decoration:\n${_painter.decoration.toString(prefix + " ")}\n';
|
| }
|
|
|
| class RenderTransform extends RenderProxyBox {
|
| + @override
|
| bool get createNewDisplayList => true;
|
|
|
| RenderTransform({
|
| @@ -1208,6 +1283,7 @@ class RenderTransform extends RenderProxyBox {
|
| markNeedsPaint();
|
| }
|
|
|
| + @override
|
| void hitTestChildren(HitTestResult result, { Point position }) {
|
| Matrix4 inverse = new Matrix4.zero();
|
| /* double det = */ inverse.copyInverse(_transform);
|
| @@ -1219,6 +1295,7 @@ class RenderTransform extends RenderProxyBox {
|
| super.hitTestChildren(result, position: transformed);
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| canvas.save();
|
| canvas.translate(offset.dx, offset.dy);
|
| @@ -1227,6 +1304,7 @@ class RenderTransform extends RenderProxyBox {
|
| canvas.restore();
|
| }
|
|
|
| + @override
|
| String debugDescribeSettings(String prefix) {
|
| List<String> result = _transform.toString().split('\n').map((s) => '$prefix $s\n').toList();
|
| result.removeLast();
|
| @@ -1246,6 +1324,7 @@ class RenderSizeObserver extends RenderProxyBox {
|
|
|
| SizeChangedCallback callback;
|
|
|
| + @override
|
| void performLayout() {
|
| Size oldSize = size;
|
|
|
| @@ -1277,11 +1356,13 @@ class RenderCustomPaint extends RenderProxyBox {
|
| markNeedsPaint();
|
| }
|
|
|
| + @override
|
| void attach() {
|
| assert(_callback != null);
|
| super.attach();
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| assert(_callback != null);
|
| canvas.translate(offset.dx, offset.dy);
|
| @@ -1303,6 +1384,7 @@ class ViewConstraints {
|
| }
|
|
|
| class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox> {
|
| + @override
|
| bool get createNewDisplayList => true;
|
|
|
| RenderView({
|
| @@ -1330,12 +1412,15 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
|
|
|
| // We never call layout() on this class, so this should never get
|
| // checked. (This class is laid out using scheduleInitialLayout().)
|
| + @override
|
| bool debugDoesMeetConstraints() { assert(false); return false; }
|
|
|
| + @override
|
| void performResize() {
|
| assert(false);
|
| }
|
|
|
| + @override
|
| void performLayout() {
|
| if (_rootConstraints.orientation != _orientation) {
|
| if (_orientation != null && child != null)
|
| @@ -1349,6 +1434,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
|
| child.layout(new BoxConstraints.tight(_size));
|
| }
|
|
|
| + @override
|
| void rotate({ int oldAngle, int newAngle, Duration time }) {
|
| assert(false); // nobody tells the screen to rotate, the whole rotate() dance is started from our performResize()
|
| }
|
| @@ -1363,6 +1449,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
|
| return true;
|
| }
|
|
|
| + @override
|
| void paint(PaintingCanvas canvas, Offset offset) {
|
| if (child != null)
|
| canvas.paintChild(child, offset.toPoint());
|
| @@ -1380,6 +1467,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin<RenderBox>
|
| }
|
| }
|
|
|
| + @override
|
| Rect get paintBounds => Point.origin & size;
|
| }
|
|
|
|
|