Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: sky/sdk/lib/framework/fn2.dart

Issue 1169853008: Rename the confusingly named "ContentNode" class to "TagNode". (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 assert(!node.mounted); 148 assert(!node.mounted);
149 node.setParent(this); 149 node.setParent(this);
150 node._sync(oldNode, slot); 150 node._sync(oldNode, slot);
151 assert(node.root is RenderObject); 151 assert(node.root is RenderObject);
152 return node; 152 return node;
153 } 153 }
154 } 154 }
155 155
156 abstract class ContentNode extends UINode { 156 // Descendants of TagNode provide a way to tag RenderObjectWrapper and
157 // Component nodes with annotations, such as event listeners,
158 // stylistic information, etc.
159 abstract class TagNode extends UINode {
157 UINode content; 160 UINode content;
158 161
159 ContentNode(UINode content, { Object key }) : this.content = content, super(ke y: key); 162 TagNode(UINode content, { Object key }) : this.content = content, super(key: k ey);
160 163
161 void _sync(UINode old, dynamic slot) { 164 void _sync(UINode old, dynamic slot) {
162 UINode oldContent = old == null ? null : (old as ContentNode).content; 165 UINode oldContent = old == null ? null : (old as TagNode).content;
163 content = syncChild(content, oldContent, slot); 166 content = syncChild(content, oldContent, slot);
164 assert(content.root != null); 167 assert(content.root != null);
165 root = content.root; 168 root = content.root;
166 } 169 }
167 170
168 void remove() { 171 void remove() {
169 if (content != null) 172 if (content != null)
170 removeChild(content); 173 removeChild(content);
171 super.remove(); 174 super.remove();
172 } 175 }
173 } 176 }
174 177
175 class ParentDataNode extends ContentNode { 178 class ParentDataNode extends TagNode {
176 final ParentData parentData; 179 final ParentData parentData;
177 180
178 ParentDataNode(UINode content, this.parentData, { Object key }): super(content , key: key); 181 ParentDataNode(UINode content, this.parentData, { Object key }): super(content , key: key);
179 } 182 }
180 183
181 typedef void GestureEventListener(sky.GestureEvent e); 184 typedef void GestureEventListener(sky.GestureEvent e);
182 typedef void PointerEventListener(sky.PointerEvent e); 185 typedef void PointerEventListener(sky.PointerEvent e);
183 typedef void EventListener(sky.Event e); 186 typedef void EventListener(sky.Event e);
184 187
185 class EventListenerNode extends ContentNode { 188 class EventListenerNode extends TagNode {
186 final Map<String, sky.EventListener> listeners; 189 final Map<String, sky.EventListener> listeners;
187 190
188 static Map<String, sky.EventListener> _createListeners({ 191 static Map<String, sky.EventListener> _createListeners({
189 EventListener onWheel, 192 EventListener onWheel,
190 GestureEventListener onGestureFlingCancel, 193 GestureEventListener onGestureFlingCancel,
191 GestureEventListener onGestureFlingStart, 194 GestureEventListener onGestureFlingStart,
192 GestureEventListener onGestureScrollStart, 195 GestureEventListener onGestureScrollStart,
193 GestureEventListener onGestureScrollUpdate, 196 GestureEventListener onGestureScrollUpdate,
194 GestureEventListener onGestureTap, 197 GestureEventListener onGestureTap,
195 GestureEventListener onGestureTapDown, 198 GestureEventListener onGestureTapDown,
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 assert(root.parent is RenderView); 1077 assert(root.parent is RenderView);
1075 } 1078 }
1076 } 1079 }
1077 1080
1078 class Text extends Component { 1081 class Text extends Component {
1079 Text(this.data) : super(key: '*text*'); 1082 Text(this.data) : super(key: '*text*');
1080 final String data; 1083 final String data;
1081 bool get interchangeable => true; 1084 bool get interchangeable => true;
1082 UINode build() => new Paragraph(text: data); 1085 UINode build() => new Paragraph(text: data);
1083 } 1086 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698