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 'package:vector_math/vector_math.dart'; | 5 import 'package:vector_math/vector_math.dart'; |
6 | 6 |
7 import '../rendering/block.dart'; | 7 import '../rendering/block.dart'; |
8 import '../rendering/box.dart'; | 8 import '../rendering/box.dart'; |
9 import '../rendering/flex.dart'; | 9 import '../rendering/flex.dart'; |
10 import '../rendering/object.dart'; | 10 import '../rendering/object.dart'; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 } | 300 } |
301 | 301 |
302 class Positioned extends ParentDataNode { | 302 class Positioned extends ParentDataNode { |
303 Positioned({ | 303 Positioned({ |
304 String key, | 304 String key, |
305 UINode child, | 305 UINode child, |
306 double top, | 306 double top, |
307 double right, | 307 double right, |
308 double bottom, | 308 double bottom, |
309 double left | 309 double left |
310 }) : super(content, | 310 }) : super(child, |
311 new StackParentData()..top = top | 311 new StackParentData()..top = top |
312 ..right = right | 312 ..right = right |
313 ..bottom = bottom | 313 ..bottom = bottom |
314 ..left = left, | 314 ..left = left, |
315 key: key); | 315 key: key); |
316 } | 316 } |
317 | 317 |
318 class Flex extends MultiChildRenderObjectWrapper { | 318 class Flex extends MultiChildRenderObjectWrapper { |
319 | 319 |
320 Flex(List<UINode> children, { | 320 Flex(List<UINode> children, { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 root.src = src; | 395 root.src = src; |
396 root.requestedSize = size; | 396 root.requestedSize = size; |
397 } | 397 } |
398 | 398 |
399 void insert(RenderObjectWrapper child, dynamic slot) { | 399 void insert(RenderObjectWrapper child, dynamic slot) { |
400 assert(false); | 400 assert(false); |
401 // Image does not support having children currently | 401 // Image does not support having children currently |
402 } | 402 } |
403 | 403 |
404 } | 404 } |
| 405 |
| 406 class UINodeToRenderBoxAdapter extends RenderObjectWrapper { |
| 407 |
| 408 UINodeToRenderBoxAdapter(RenderBox renderBox) |
| 409 : this.renderBox = renderBox, |
| 410 super(key: renderBox.hashCode.toString()); |
| 411 |
| 412 RenderBox get root => super.root; |
| 413 RenderBox createNode() => this.renderBox; |
| 414 |
| 415 final RenderBox renderBox; |
| 416 |
| 417 void syncRenderObject(UINode old) { |
| 418 super.syncRenderObject(old); |
| 419 if (old != null) { |
| 420 assert(old is UINodeToRenderBoxAdapter); |
| 421 assert(root == old.renderBox); |
| 422 } |
| 423 } |
| 424 |
| 425 void insert(RenderObjectWrapper child, dynamic slot) { |
| 426 assert(false); |
| 427 // UINodeToRenderBoxAdapter cannot have UINode children; by |
| 428 // definition, it is the transition out of the UINode world. |
| 429 } |
| 430 |
| 431 } |
OLD | NEW |