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:sky' as sky; | 5 import 'dart:sky' as sky; |
6 | 6 |
7 import 'box.dart'; | 7 import 'box.dart'; |
8 import 'object.dart'; | 8 import 'object.dart'; |
9 import '../painting/text_style.dart'; | 9 import '../painting/text_style.dart'; |
10 | 10 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 151 } |
152 | 152 |
153 void performLayout() { | 153 void performLayout() { |
154 _layout(constraints); | 154 _layout(constraints); |
155 sky.Element root = _layoutRoot.rootElement; | 155 sky.Element root = _layoutRoot.rootElement; |
156 // rootElement.width always expands to fill, use maxContentWidth instead. | 156 // rootElement.width always expands to fill, use maxContentWidth instead. |
157 size = constraints.constrain(new Size(_applyFloatingPointHack(root.maxConten
tWidth), | 157 size = constraints.constrain(new Size(_applyFloatingPointHack(root.maxConten
tWidth), |
158 _applyFloatingPointHack(root.height)))
; | 158 _applyFloatingPointHack(root.height)))
; |
159 } | 159 } |
160 | 160 |
161 void paint(RenderObjectDisplayList canvas) { | 161 void paint(RenderCanvas canvas) { |
162 // Ideally we could compute the min/max intrinsic width/height with a | 162 // Ideally we could compute the min/max intrinsic width/height with a |
163 // non-destructive operation. However, currently, computing these values | 163 // non-destructive operation. However, currently, computing these values |
164 // will destroy state inside the layout root. If that happens, we need to | 164 // will destroy state inside the layout root. If that happens, we need to |
165 // get back the correct state by calling _layout again. | 165 // get back the correct state by calling _layout again. |
166 // | 166 // |
167 // TODO(abarth): Make computing the min/max intrinsic width/height a | 167 // TODO(abarth): Make computing the min/max intrinsic width/height a |
168 // non-destructive operation. | 168 // non-destructive operation. |
169 if (_constraintsForCurrentLayout != constraints && constraints != null) | 169 if (_constraintsForCurrentLayout != constraints && constraints != null) |
170 _layout(constraints); | 170 _layout(constraints); |
171 | 171 |
172 _layoutRoot.paint(canvas); | 172 _layoutRoot.paint(canvas); |
173 } | 173 } |
174 | 174 |
175 // we should probably expose a way to do precise (inter-glpyh) hit testing | 175 // we should probably expose a way to do precise (inter-glpyh) hit testing |
176 | 176 |
177 String debugDescribeSettings(String prefix) { | 177 String debugDescribeSettings(String prefix) { |
178 String result = '${super.debugDescribeSettings(prefix)}'; | 178 String result = '${super.debugDescribeSettings(prefix)}'; |
179 result += '${prefix}inline: ${inline}\n'; | 179 result += '${prefix}inline: ${inline}\n'; |
180 return result; | 180 return result; |
181 } | 181 } |
182 } | 182 } |
OLD | NEW |