| 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 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:sky' as sky; | 9 import 'dart:sky' as sky; |
| 10 import 'reflect.dart' as reflect; | 10 import 'reflect.dart' as reflect; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 */ | 25 */ |
| 26 abstract class UINode { | 26 abstract class UINode { |
| 27 String _key; | 27 String _key; |
| 28 UINode _parent; | 28 UINode _parent; |
| 29 UINode get parent => _parent; | 29 UINode get parent => _parent; |
| 30 RenderCSS _root; | 30 RenderCSS _root; |
| 31 bool _defunct = false; | 31 bool _defunct = false; |
| 32 | 32 |
| 33 UINode({ Object key }) { | 33 UINode({ Object key }) { |
| 34 _key = key == null ? "$runtimeType" : "$runtimeType-$key"; | 34 _key = key == null ? "$runtimeType" : "$runtimeType-$key"; |
| 35 assert(this is App || _inRenderDirtyComponents); // you should not build the
UI tree ahead of time, build it only during build() |
| 35 } | 36 } |
| 36 | 37 |
| 37 // Subclasses which implements Nodes that become stateful may return true | 38 // Subclasses which implements Nodes that become stateful may return true |
| 38 // if the |old| node has become stateful and should be retained. | 39 // if the |old| node has become stateful and should be retained. |
| 39 bool _willSync(UINode old) => false; | 40 bool _willSync(UINode old) => false; |
| 40 | 41 |
| 41 bool get interchangeable => false; // if true, then keys can be duplicated | 42 bool get interchangeable => false; // if true, then keys can be duplicated |
| 42 | 43 |
| 43 void _sync(UINode old, RenderCSSContainer host, RenderCSS insertBefore); | 44 void _sync(UINode old, RenderCSSContainer host, RenderCSS insertBefore); |
| 44 | 45 |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 _sync(null, _host, _root); | 923 _sync(null, _host, _root); |
| 923 } | 924 } |
| 924 } | 925 } |
| 925 | 926 |
| 926 class Text extends Component { | 927 class Text extends Component { |
| 927 Text(this.data) : super(key: '*text*'); | 928 Text(this.data) : super(key: '*text*'); |
| 928 final String data; | 929 final String data; |
| 929 bool get interchangeable => true; | 930 bool get interchangeable => true; |
| 930 UINode build() => new Paragraph(children: [new TextFragment(data)]); | 931 UINode build() => new Paragraph(children: [new TextFragment(data)]); |
| 931 } | 932 } |
| OLD | NEW |