Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 import 'package:vector_math/vector_math.dart'; | 2 import 'package:vector_math/vector_math.dart'; |
| 3 | 3 |
| 4 import '../rendering/block.dart'; | 4 import '../rendering/block.dart'; |
| 5 import '../rendering/box.dart'; | 5 import '../rendering/box.dart'; |
| 6 import '../rendering/flex.dart'; | 6 import '../rendering/flex.dart'; |
| 7 import '../rendering/object.dart'; | 7 import '../rendering/object.dart'; |
| 8 import '../rendering/paragraph.dart'; | 8 import '../rendering/paragraph.dart'; |
| 9 import '../rendering/stack.dart'; | 9 import '../rendering/stack.dart'; |
| 10 import 'ui_node.dart'; | 10 import 'ui_node.dart'; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 | 136 |
| 137 RenderPositionedBox get root { RenderPositionedBox result = super.root; return result; } | 137 RenderPositionedBox get root { RenderPositionedBox result = super.root; return result; } |
| 138 | 138 |
| 139 RenderPositionedBox createNode() => new RenderPositionedBox(); | 139 RenderPositionedBox createNode() => new RenderPositionedBox(); |
| 140 | 140 |
| 141 } | 141 } |
| 142 | 142 |
| 143 class SizedBox extends OneChildRenderObjectWrapper { | 143 class SizedBox extends OneChildRenderObjectWrapper { |
| 144 | 144 |
| 145 SizedBox({ | 145 SizedBox({ |
| 146 double width: double.INFINITY, | 146 this.width, |
| 147 double height: double.INFINITY, | 147 this.height, |
| 148 UINode child, | 148 UINode child, |
| 149 Object key | 149 Object key |
| 150 }) : desiredSize = new Size(width, height), super(child: child, key: key); | 150 }) : super(child: child, key: key); |
| 151 | 151 |
| 152 RenderSizedBox get root { RenderSizedBox result = super.root; return result; } | 152 RenderConstrainedBox get root { RenderConstrainedBox result = super.root; retu rn result; } |
| 153 final Size desiredSize; | |
| 154 | 153 |
| 155 RenderSizedBox createNode() => new RenderSizedBox(desiredSize: desiredSize); | 154 final double width; |
| 155 final double height; | |
| 156 | |
| 157 RenderConstrainedBox createNode() => new RenderConstrainedBox(additionalConstr aints: _getConstraints()); | |
| 158 | |
| 159 BoxConstraints _getConstraints() { | |
|
abarth-chromium
2015/06/15 22:50:55
BoxConstraints get _additionalConstraints { ... }
| |
| 160 var result = const BoxConstraints(); | |
| 161 if (width != null) | |
| 162 result = result.applyWidth(width); | |
| 163 if (height != null) | |
| 164 result = result.applyHeight(height); | |
| 165 return result; | |
| 166 } | |
| 156 | 167 |
| 157 void syncRenderObject(SizedBox old) { | 168 void syncRenderObject(SizedBox old) { |
| 158 super.syncRenderObject(old); | 169 super.syncRenderObject(old); |
| 159 root.desiredSize = desiredSize; | 170 root.additionalConstraints = _getConstraints(); |
| 160 } | 171 } |
| 161 | 172 |
| 162 } | 173 } |
| 163 | 174 |
| 164 class ConstrainedBox extends OneChildRenderObjectWrapper { | 175 class ConstrainedBox extends OneChildRenderObjectWrapper { |
| 165 | 176 |
| 166 ConstrainedBox({ this.constraints, UINode child, Object key }) | 177 ConstrainedBox({ this.constraints, UINode child, Object key }) |
| 167 : super(child: child, key: key); | 178 : super(child: child, key: key); |
| 168 | 179 |
| 169 RenderConstrainedBox get root { RenderConstrainedBox result = super.root; retu rn result; } | 180 RenderConstrainedBox get root { RenderConstrainedBox result = super.root; retu rn result; } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 233 final EdgeDims margin; | 244 final EdgeDims margin; |
| 234 final EdgeDims padding; | 245 final EdgeDims padding; |
| 235 final Matrix4 transform; | 246 final Matrix4 transform; |
| 236 final double width; | 247 final double width; |
| 237 final double height; | 248 final double height; |
| 238 | 249 |
| 239 UINode build() { | 250 UINode build() { |
| 240 UINode current = child; | 251 UINode current = child; |
| 241 | 252 |
| 242 if (child == null && width == null && height == null) | 253 if (child == null && width == null && height == null) |
| 243 current = new SizedBox(); | 254 current = new SizedBox( |
| 255 width: double.INFINITY, | |
| 256 height: double.INFINITY | |
| 257 ); | |
| 244 | 258 |
| 245 if (padding != null) | 259 if (padding != null) |
| 246 current = new Padding(padding: padding, child: current); | 260 current = new Padding(padding: padding, child: current); |
| 247 | 261 |
| 248 if (decoration != null) | 262 if (decoration != null) |
| 249 current = new DecoratedBox(decoration: decoration, child: current); | 263 current = new DecoratedBox(decoration: decoration, child: current); |
| 250 | 264 |
| 251 if (width != null || height != null) | 265 if (width != null || height != null) |
| 252 current = new SizedBox( | 266 current = new SizedBox( |
| 253 width: width == null ? double.INFINITY : width, | 267 width: width, |
| 254 height: height == null ? double.INFINITY : height, | 268 height: height, |
| 255 child: current | 269 child: current |
| 256 ); | 270 ); |
| 257 | 271 |
| 258 if (constraints != null) | 272 if (constraints != null) |
| 259 current = new ConstrainedBox(constraints: constraints, child: current); | 273 current = new ConstrainedBox(constraints: constraints, child: current); |
| 260 | 274 |
| 261 if (margin != null) | 275 if (margin != null) |
| 262 current = new Padding(padding: margin, child: current); | 276 current = new Padding(padding: margin, child: current); |
| 263 | 277 |
| 264 if (transform != null) | 278 if (transform != null) |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 381 root.src = src; | 395 root.src = src; |
| 382 root.requestedSize = size; | 396 root.requestedSize = size; |
| 383 } | 397 } |
| 384 | 398 |
| 385 void insert(RenderObjectWrapper child, dynamic slot) { | 399 void insert(RenderObjectWrapper child, dynamic slot) { |
| 386 assert(false); | 400 assert(false); |
| 387 // Image does not support having children currently | 401 // Image does not support having children currently |
| 388 } | 402 } |
| 389 | 403 |
| 390 } | 404 } |
| OLD | NEW |