| 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 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
| 8 import 'object.dart'; | 8 import 'object.dart'; |
| 9 import '../painting/shadows.dart'; | 9 import '../painting/shadows.dart'; |
| 10 import 'package:vector_math/vector_math.dart'; | 10 import 'package:vector_math/vector_math.dart'; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 maxWidth: maxWidth, | 126 maxWidth: maxWidth, |
| 127 minHeight: minHeight, | 127 minHeight: minHeight, |
| 128 maxHeight: math.min(maxHeight, height)); | 128 maxHeight: math.min(maxHeight, height)); |
| 129 } | 129 } |
| 130 | 130 |
| 131 final double minWidth; | 131 final double minWidth; |
| 132 final double maxWidth; | 132 final double maxWidth; |
| 133 final double minHeight; | 133 final double minHeight; |
| 134 final double maxHeight; | 134 final double maxHeight; |
| 135 | 135 |
| 136 static double _clamp({double min: 0.0, double value: 0.0, double max: double.I
NFINITY}) { |
| 137 assert(min != null); |
| 138 assert(value != null); |
| 139 assert(max != null); |
| 140 return math.max(min, math.min(max, value)); |
| 141 } |
| 142 |
| 136 double constrainWidth(double width) { | 143 double constrainWidth(double width) { |
| 137 return clamp(min: minWidth, max: maxWidth, value: width); | 144 return _clamp(min: minWidth, max: maxWidth, value: width); |
| 138 } | 145 } |
| 139 | 146 |
| 140 double constrainHeight(double height) { | 147 double constrainHeight(double height) { |
| 141 return clamp(min: minHeight, max: maxHeight, value: height); | 148 return _clamp(min: minHeight, max: maxHeight, value: height); |
| 142 } | 149 } |
| 143 | 150 |
| 144 Size constrain(Size size) { | 151 Size constrain(Size size) { |
| 145 return new Size(constrainWidth(size.width), constrainHeight(size.height)); | 152 return new Size(constrainWidth(size.width), constrainHeight(size.height)); |
| 146 } | 153 } |
| 147 | 154 |
| 148 bool get isInfinite => maxWidth >= double.INFINITY || maxHeight >= double.INFI
NITY; | 155 bool get isInfinite => maxWidth >= double.INFINITY || maxHeight >= double.INFI
NITY; |
| 149 | 156 |
| 150 int get hashCode { | 157 int get hashCode { |
| 151 int value = 373; | 158 int value = 373; |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 String toString() => 'BorderSide($color, $width)'; | 620 String toString() => 'BorderSide($color, $width)'; |
| 614 } | 621 } |
| 615 | 622 |
| 616 class Border { | 623 class Border { |
| 617 const Border({ | 624 const Border({ |
| 618 this.top: BorderSide.none, | 625 this.top: BorderSide.none, |
| 619 this.right: BorderSide.none, | 626 this.right: BorderSide.none, |
| 620 this.bottom: BorderSide.none, | 627 this.bottom: BorderSide.none, |
| 621 this.left: BorderSide.none | 628 this.left: BorderSide.none |
| 622 }); | 629 }); |
| 630 |
| 623 const Border.all(BorderSide side) : | 631 const Border.all(BorderSide side) : |
| 624 top = side, | 632 top = side, |
| 625 right = side, | 633 right = side, |
| 626 bottom = side, | 634 bottom = side, |
| 627 left = side; | 635 left = side; |
| 636 |
| 628 final BorderSide top; | 637 final BorderSide top; |
| 629 final BorderSide right; | 638 final BorderSide right; |
| 630 final BorderSide bottom; | 639 final BorderSide bottom; |
| 631 final BorderSide left; | 640 final BorderSide left; |
| 632 | 641 |
| 633 int get hashCode { | 642 int get hashCode { |
| 634 int value = 373; | 643 int value = 373; |
| 635 value = 37 * value * top.hashCode; | 644 value = 37 * value * top.hashCode; |
| 636 value = 37 * value * right.hashCode; | 645 value = 37 * value * right.hashCode; |
| 637 value = 37 * value * bottom.hashCode; | 646 value = 37 * value * bottom.hashCode; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 | 1031 |
| 1023 void defaultPaint(RenderObjectDisplayList canvas) { | 1032 void defaultPaint(RenderObjectDisplayList canvas) { |
| 1024 RenderBox child = firstChild; | 1033 RenderBox child = firstChild; |
| 1025 while (child != null) { | 1034 while (child != null) { |
| 1026 assert(child.parentData is ParentDataType); | 1035 assert(child.parentData is ParentDataType); |
| 1027 canvas.paintChild(child, child.parentData.position); | 1036 canvas.paintChild(child, child.parentData.position); |
| 1028 child = child.parentData.nextSibling; | 1037 child = child.parentData.nextSibling; |
| 1029 } | 1038 } |
| 1030 } | 1039 } |
| 1031 } | 1040 } |
| OLD | NEW |