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 'node.dart'; | 8 import 'node.dart'; |
9 import 'package:vector_math/vector_math.dart'; | 9 import 'package:vector_math/vector_math.dart'; |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 : minWidth = size.width, | 48 : minWidth = size.width, |
49 maxWidth = size.width, | 49 maxWidth = size.width, |
50 minHeight = size.height, | 50 minHeight = size.height, |
51 maxHeight = size.height; | 51 maxHeight = size.height; |
52 | 52 |
53 BoxConstraints deflate(EdgeDims edges) { | 53 BoxConstraints deflate(EdgeDims edges) { |
54 assert(edges != null); | 54 assert(edges != null); |
55 double horizontal = edges.left + edges.right; | 55 double horizontal = edges.left + edges.right; |
56 double vertical = edges.top + edges.bottom; | 56 double vertical = edges.top + edges.bottom; |
57 return new BoxConstraints( | 57 return new BoxConstraints( |
58 minWidth: math.min(0.0, minWidth - horizontal), | 58 minWidth: math.max(0.0, minWidth - horizontal), |
59 maxWidth: maxWidth - horizontal, | 59 maxWidth: maxWidth - horizontal, |
60 minHeight: math.min(0.0, minHeight - vertical), | 60 minHeight: math.max(0.0, minHeight - vertical), |
61 maxHeight: maxHeight - vertical | 61 maxHeight: maxHeight - vertical |
62 ); | 62 ); |
63 } | 63 } |
64 | 64 |
65 final double minWidth; | 65 final double minWidth; |
66 final double maxWidth; | 66 final double maxWidth; |
67 final double minHeight; | 67 final double minHeight; |
68 final double maxHeight; | 68 final double maxHeight; |
69 | 69 |
70 double constrainWidth(double width) { | 70 double constrainWidth(double width) { |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 | 461 |
462 void defaultPaint(RenderNodeDisplayList canvas) { | 462 void defaultPaint(RenderNodeDisplayList canvas) { |
463 RenderBox child = firstChild; | 463 RenderBox child = firstChild; |
464 while (child != null) { | 464 while (child != null) { |
465 assert(child.parentData is ParentDataType); | 465 assert(child.parentData is ParentDataType); |
466 canvas.paintChild(child, child.parentData.position); | 466 canvas.paintChild(child, child.parentData.position); |
467 child = child.parentData.nextSibling; | 467 child = child.parentData.nextSibling; |
468 } | 468 } |
469 } | 469 } |
470 } | 470 } |
OLD | NEW |