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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 // getMaxIntrinsicHeight should return the smallest height beyond which | 210 // getMaxIntrinsicHeight should return the smallest height beyond which |
211 // increasing the height never decreases the width. | 211 // increasing the height never decreases the width. |
212 // If the layout algorithm used is width-in-height-out, i.e. the height | 212 // If the layout algorithm used is width-in-height-out, i.e. the height |
213 // depends on the width and not vice versa, then this will return the same | 213 // depends on the width and not vice versa, then this will return the same |
214 // as getMinIntrinsicHeight(). | 214 // as getMinIntrinsicHeight(). |
215 double getMaxIntrinsicHeight(BoxConstraints constraints) { | 215 double getMaxIntrinsicHeight(BoxConstraints constraints) { |
216 return constraints.constrainHeight(0.0); | 216 return constraints.constrainHeight(0.0); |
217 } | 217 } |
218 | 218 |
219 BoxConstraints get constraints => super.constraints as BoxConstraints; | 219 BoxConstraints get constraints { BoxConstraints result = super.constraints; re
turn result; } |
220 void performResize() { | 220 void performResize() { |
221 // default behaviour for subclasses that have sizedByParent = true | 221 // default behaviour for subclasses that have sizedByParent = true |
222 size = constraints.constrain(Size.zero); | 222 size = constraints.constrain(Size.zero); |
223 assert(size.height < double.INFINITY); | 223 assert(size.height < double.INFINITY); |
224 assert(size.width < double.INFINITY); | 224 assert(size.width < double.INFINITY); |
225 } | 225 } |
226 void performLayout() { | 226 void performLayout() { |
227 // descendants have to either override performLayout() to set both | 227 // descendants have to either override performLayout() to set both |
228 // width and height and lay out children, or, set sizedByParent to | 228 // width and height and lay out children, or, set sizedByParent to |
229 // true so that performResize()'s logic above does its thing. | 229 // true so that performResize()'s logic above does its thing. |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 | 1119 |
1120 void defaultPaint(RenderObjectDisplayList canvas) { | 1120 void defaultPaint(RenderObjectDisplayList canvas) { |
1121 RenderBox child = firstChild; | 1121 RenderBox child = firstChild; |
1122 while (child != null) { | 1122 while (child != null) { |
1123 assert(child.parentData is ParentDataType); | 1123 assert(child.parentData is ParentDataType); |
1124 canvas.paintChild(child, child.parentData.position); | 1124 canvas.paintChild(child, child.parentData.position); |
1125 child = child.parentData.nextSibling; | 1125 child = child.parentData.nextSibling; |
1126 } | 1126 } |
1127 } | 1127 } |
1128 } | 1128 } |
OLD | NEW |