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 library fn; | 5 library fn; |
6 | 6 |
7 import 'app.dart'; | 7 import 'app.dart'; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection'; | 9 import 'dart:collection'; |
10 import 'dart:mirrors'; | 10 import 'dart:mirrors'; |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 _nodeMap.remove(root); | 322 _nodeMap.remove(root); |
323 super._remove(); | 323 super._remove(); |
324 } | 324 } |
325 } | 325 } |
326 | 326 |
327 abstract class OneChildRenderObjectWrapper extends RenderObjectWrapper { | 327 abstract class OneChildRenderObjectWrapper extends RenderObjectWrapper { |
328 final UINode child; | 328 final UINode child; |
329 | 329 |
330 OneChildRenderObjectWrapper({ this.child, Object key }) : super(key: key); | 330 OneChildRenderObjectWrapper({ this.child, Object key }) : super(key: key); |
331 | 331 |
332 void syncRenderObject(RenderNodeWrapper old) { | 332 void syncRenderObject(RenderObjectWrapper old) { |
333 super.syncRenderNode(old); | 333 super.syncRenderObject(old); |
334 UINode oldChild = old == null ? null : (old as OneChildRenderNodeWrapper).ch
ild; | 334 UINode oldChild = old == null ? null : (old as OneChildRenderObjectWrapper).
child; |
335 syncChild(child, oldChild, null); | 335 syncChild(child, oldChild, null); |
336 } | 336 } |
337 | 337 |
338 void insert(RenderObjectWrapper child, dynamic slot) { | 338 void insert(RenderObjectWrapper child, dynamic slot) { |
339 assert(slot == null); | 339 assert(slot == null); |
340 root.child = child.root; | 340 root.child = child.root; |
341 } | 341 } |
342 | 342 |
343 void removeChild(UINode node) { | 343 void removeChild(UINode node) { |
344 root.child = null; | 344 root.child = null; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 ) { | 430 ) { |
431 assert(!_debugHasDuplicateIds()); | 431 assert(!_debugHasDuplicateIds()); |
432 } | 432 } |
433 | 433 |
434 void insert(RenderObjectWrapper child, dynamic slot) { | 434 void insert(RenderObjectWrapper child, dynamic slot) { |
435 assert(slot == null || slot is RenderObject); | 435 assert(slot == null || slot is RenderObject); |
436 root.add(child.root, before: slot); | 436 root.add(child.root, before: slot); |
437 } | 437 } |
438 | 438 |
439 void removeChild(UINode node) { | 439 void removeChild(UINode node) { |
440 assert(root is ContainerRenderNodeMixin); | 440 assert(root is ContainerRenderObjectMixin); |
441 root.remove(node.root); | 441 root.remove(node.root); |
442 super.removeChild(node); | 442 super.removeChild(node); |
443 } | 443 } |
444 | 444 |
445 void _remove() { | 445 void _remove() { |
446 assert(children != null); | 446 assert(children != null); |
447 for (var child in children) { | 447 for (var child in children) { |
448 assert(child != null); | 448 assert(child != null); |
449 removeChild(child); | 449 removeChild(child); |
450 } | 450 } |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 assert(root.parent is RenderView); | 954 assert(root.parent is RenderView); |
955 } | 955 } |
956 } | 956 } |
957 | 957 |
958 class Text extends Component { | 958 class Text extends Component { |
959 Text(this.data) : super(key: '*text*'); | 959 Text(this.data) : super(key: '*text*'); |
960 final String data; | 960 final String data; |
961 bool get interchangeable => true; | 961 bool get interchangeable => true; |
962 UINode build() => new Paragraph(text: data); | 962 UINode build() => new Paragraph(text: data); |
963 } | 963 } |
OLD | NEW |