| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 import 'dart:math' as math; | 5 import 'dart:math' as math; |
| 6 import 'dart:sky' as sky; | 6 import 'dart:sky' as sky; |
| 7 | 7 |
| 8 import 'package:vector_math/vector_math.dart'; | 8 import 'package:vector_math/vector_math.dart'; |
| 9 | 9 |
| 10 import '../base/debug.dart'; | 10 import '../base/debug.dart'; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 int value = 373; | 56 int value = 373; |
| 57 value = 37 * value + top.hashCode; | 57 value = 37 * value + top.hashCode; |
| 58 value = 37 * value + left.hashCode; | 58 value = 37 * value + left.hashCode; |
| 59 value = 37 * value + bottom.hashCode; | 59 value = 37 * value + bottom.hashCode; |
| 60 value = 37 * value + right.hashCode; | 60 value = 37 * value + right.hashCode; |
| 61 return value; | 61 return value; |
| 62 } | 62 } |
| 63 String toString() => "EdgeDims($top, $right, $bottom, $left)"; | 63 String toString() => "EdgeDims($top, $right, $bottom, $left)"; |
| 64 } | 64 } |
| 65 | 65 |
| 66 class BoxConstraints { | 66 class BoxConstraints extends Constraints { |
| 67 const BoxConstraints({ | 67 const BoxConstraints({ |
| 68 this.minWidth: 0.0, | 68 this.minWidth: 0.0, |
| 69 this.maxWidth: double.INFINITY, | 69 this.maxWidth: double.INFINITY, |
| 70 this.minHeight: 0.0, | 70 this.minHeight: 0.0, |
| 71 this.maxHeight: double.INFINITY | 71 this.maxHeight: double.INFINITY |
| 72 }); | 72 }); |
| 73 | 73 |
| 74 BoxConstraints.tight(Size size) | 74 BoxConstraints.tight(Size size) |
| 75 : minWidth = size.width, | 75 : minWidth = size.width, |
| 76 maxWidth = size.width, | 76 maxWidth = size.width, |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 178 |
| 179 Size constrain(Size size) { | 179 Size constrain(Size size) { |
| 180 Size result = new Size(constrainWidth(size.width), constrainHeight(size.heig
ht)); | 180 Size result = new Size(constrainWidth(size.width), constrainHeight(size.heig
ht)); |
| 181 if (size is _DebugSize) | 181 if (size is _DebugSize) |
| 182 result = new _DebugSize(result, size._owner, size._canBeUsedByParent); | 182 result = new _DebugSize(result, size._owner, size._canBeUsedByParent); |
| 183 return result; | 183 return result; |
| 184 } | 184 } |
| 185 | 185 |
| 186 bool get isInfinite => maxWidth >= double.INFINITY && maxHeight >= double.INFI
NITY; | 186 bool get isInfinite => maxWidth >= double.INFINITY && maxHeight >= double.INFI
NITY; |
| 187 | 187 |
| 188 bool get hasTightWidth => minWidth == maxWidth; | 188 bool get hasTightWidth => minWidth >= maxWidth; |
| 189 bool get hasTightHeight => minHeight == maxHeight; | 189 bool get hasTightHeight => minHeight >= maxHeight; |
| 190 bool get isTight => hasTightWidth && hasTightHeight; | 190 bool get isTight => hasTightWidth && hasTightHeight; |
| 191 | 191 |
| 192 bool operator ==(other) { | 192 bool operator ==(other) { |
| 193 if (identical(this, other)) | 193 if (identical(this, other)) |
| 194 return true; | 194 return true; |
| 195 return other is BoxConstraints && | 195 return other is BoxConstraints && |
| 196 minWidth == other.minWidth && | 196 minWidth == other.minWidth && |
| 197 maxWidth == other.maxWidth && | 197 maxWidth == other.maxWidth && |
| 198 minHeight == other.minHeight && | 198 minHeight == other.minHeight && |
| 199 maxHeight == other.maxHeight; | 199 maxHeight == other.maxHeight; |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1105 | 1105 |
| 1106 void defaultPaint(RenderObjectDisplayList canvas) { | 1106 void defaultPaint(RenderObjectDisplayList canvas) { |
| 1107 RenderBox child = firstChild; | 1107 RenderBox child = firstChild; |
| 1108 while (child != null) { | 1108 while (child != null) { |
| 1109 assert(child.parentData is ParentDataType); | 1109 assert(child.parentData is ParentDataType); |
| 1110 canvas.paintChild(child, child.parentData.position); | 1110 canvas.paintChild(child, child.parentData.position); |
| 1111 child = child.parentData.nextSibling; | 1111 child = child.parentData.nextSibling; |
| 1112 } | 1112 } |
| 1113 } | 1113 } |
| 1114 } | 1114 } |
| OLD | NEW |