| 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:async'; | 5 import 'dart:async'; |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import 'dart:mirrors'; | 7 import 'dart:mirrors'; |
| 8 import 'dart:sky' as sky; | 8 import 'dart:sky' as sky; |
| 9 | 9 |
| 10 import '../app/view.dart'; | 10 import '../app/view.dart'; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 } | 158 } |
| 159 | 159 |
| 160 } | 160 } |
| 161 | 161 |
| 162 | 162 |
| 163 // Descendants of TagNode provide a way to tag RenderObjectWrapper and | 163 // Descendants of TagNode provide a way to tag RenderObjectWrapper and |
| 164 // Component nodes with annotations, such as event listeners, | 164 // Component nodes with annotations, such as event listeners, |
| 165 // stylistic information, etc. | 165 // stylistic information, etc. |
| 166 abstract class TagNode extends Widget { | 166 abstract class TagNode extends Widget { |
| 167 | 167 |
| 168 TagNode(Widget content, { String key }) | 168 TagNode(Widget child, { String key }) |
| 169 : this.content = content, super(key: key); | 169 : this.child = child, super(key: key); |
| 170 | 170 |
| 171 Widget content; | 171 Widget child; |
| 172 | 172 |
| 173 void _sync(Widget old, dynamic slot) { | 173 void _sync(Widget old, dynamic slot) { |
| 174 Widget oldContent = old == null ? null : (old as TagNode).content; | 174 Widget oldChild = old == null ? null : (old as TagNode).child; |
| 175 content = syncChild(content, oldContent, slot); | 175 child = syncChild(child, oldChild, slot); |
| 176 assert(content.root != null); | 176 assert(child.root != null); |
| 177 _root = content.root; | 177 _root = child.root; |
| 178 assert(_root == root); // in case a subclass reintroduces it | 178 assert(_root == root); // in case a subclass reintroduces it |
| 179 } | 179 } |
| 180 | 180 |
| 181 void remove() { | 181 void remove() { |
| 182 if (content != null) | 182 if (child != null) |
| 183 removeChild(content); | 183 removeChild(child); |
| 184 super.remove(); | 184 super.remove(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void detachRoot() { | 187 void detachRoot() { |
| 188 if (content != null) | 188 if (child != null) |
| 189 content.detachRoot(); | 189 child.detachRoot(); |
| 190 } | 190 } |
| 191 | 191 |
| 192 } | 192 } |
| 193 | 193 |
| 194 class ParentDataNode extends TagNode { | 194 class ParentDataNode extends TagNode { |
| 195 ParentDataNode(Widget content, this.parentData, { String key }) | 195 ParentDataNode(Widget child, this.parentData, { String key }) |
| 196 : super(content, key: key); | 196 : super(child, key: key); |
| 197 final ParentData parentData; | 197 final ParentData parentData; |
| 198 } | 198 } |
| 199 | 199 |
| 200 typedef void GestureEventListener(sky.GestureEvent e); | 200 typedef void GestureEventListener(sky.GestureEvent e); |
| 201 typedef void PointerEventListener(sky.PointerEvent e); | 201 typedef void PointerEventListener(sky.PointerEvent e); |
| 202 typedef void EventListener(sky.Event e); | 202 typedef void EventListener(sky.Event e); |
| 203 | 203 |
| 204 class Listener extends TagNode { | 204 class Listener extends TagNode { |
| 205 | 205 |
| 206 Listener({ | 206 Listener({ |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 880 if (root.parent == null) { | 880 if (root.parent == null) { |
| 881 // we haven't attached it yet | 881 // we haven't attached it yet |
| 882 assert(_container.child == null); | 882 assert(_container.child == null); |
| 883 _container.child = root; | 883 _container.child = root; |
| 884 } | 884 } |
| 885 assert(root.parent == _container); | 885 assert(root.parent == _container); |
| 886 } | 886 } |
| 887 | 887 |
| 888 Widget build() => builder(); | 888 Widget build() => builder(); |
| 889 } | 889 } |
| OLD | NEW |