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

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

Issue 1172503004: Enable setting the UINode key for ParentDataNodes (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 | « sky/sdk/lib/framework/components2/menu_item.dart ('k') | 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 node.setParent(this); 147 node.setParent(this);
148 node._sync(oldNode, slot); 148 node._sync(oldNode, slot);
149 assert(node.root is RenderObject); 149 assert(node.root is RenderObject);
150 return node; 150 return node;
151 } 151 }
152 } 152 }
153 153
154 abstract class ContentNode extends UINode { 154 abstract class ContentNode extends UINode {
155 UINode content; 155 UINode content;
156 156
157 ContentNode(UINode content) : this.content = content, super(key: content._key) ; 157 ContentNode(UINode content, { Object key }) : this.content = content, super(ke y: key);
158 158
159 void _sync(UINode old, dynamic slot) { 159 void _sync(UINode old, dynamic slot) {
160 UINode oldContent = old == null ? null : (old as ContentNode).content; 160 UINode oldContent = old == null ? null : (old as ContentNode).content;
161 content = syncChild(content, oldContent, slot); 161 content = syncChild(content, oldContent, slot);
162 assert(content.root != null); 162 assert(content.root != null);
163 root = content.root; 163 root = content.root;
164 } 164 }
165 165
166 void remove() { 166 void remove() {
167 if (content != null) 167 if (content != null)
168 removeChild(content); 168 removeChild(content);
169 super.remove(); 169 super.remove();
170 } 170 }
171 } 171 }
172 172
173 class ParentDataNode extends ContentNode { 173 class ParentDataNode extends ContentNode {
174 final ParentData parentData; 174 final ParentData parentData;
175 175
176 ParentDataNode(UINode content, this.parentData): super(content); 176 ParentDataNode(UINode content, this.parentData, { Object key }): super(content , key: key);
177 } 177 }
178 178
179 typedef void GestureEventListener(sky.GestureEvent e); 179 typedef void GestureEventListener(sky.GestureEvent e);
180 typedef void PointerEventListener(sky.PointerEvent e); 180 typedef void PointerEventListener(sky.PointerEvent e);
181 typedef void EventListener(sky.Event e); 181 typedef void EventListener(sky.Event e);
182 182
183 class EventListenerNode extends ContentNode { 183 class EventListenerNode extends ContentNode {
184 final Map<String, sky.EventListener> listeners; 184 final Map<String, sky.EventListener> listeners;
185 185
186 static Map<String, sky.EventListener> _createListeners({ 186 static Map<String, sky.EventListener> _createListeners({
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 }) : super(key: key, children: children); 747 }) : super(key: key, children: children);
748 748
749 void syncRenderObject(UINode old) { 749 void syncRenderObject(UINode old) {
750 super.syncRenderObject(old); 750 super.syncRenderObject(old);
751 root.direction = direction; 751 root.direction = direction;
752 root.justifyContent = justifyContent; 752 root.justifyContent = justifyContent;
753 } 753 }
754 } 754 }
755 755
756 class FlexExpandingChild extends ParentDataNode { 756 class FlexExpandingChild extends ParentDataNode {
757 FlexExpandingChild(UINode content, [int flex = 1]) 757 FlexExpandingChild(UINode content, { int flex: 1, Object key })
758 : super(content, new FlexBoxParentData()..flex = flex); 758 : super(content, new FlexBoxParentData()..flex = flex, key: key);
759 } 759 }
760 760
761 class Image extends RenderObjectWrapper { 761 class Image extends RenderObjectWrapper {
762 RenderImage root; 762 RenderImage root;
763 RenderImage createNode() => new RenderImage(this.src, this.size); 763 RenderImage createNode() => new RenderImage(this.src, this.size);
764 764
765 final String src; 765 final String src;
766 final Size size; 766 final Size size;
767 767
768 Image({ 768 Image({
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 assert(root.parent is RenderView); 1060 assert(root.parent is RenderView);
1061 } 1061 }
1062 } 1062 }
1063 1063
1064 class Text extends Component { 1064 class Text extends Component {
1065 Text(this.data) : super(key: '*text*'); 1065 Text(this.data) : super(key: '*text*');
1066 final String data; 1066 final String data;
1067 bool get interchangeable => true; 1067 bool get interchangeable => true;
1068 UINode build() => new Paragraph(text: data); 1068 UINode build() => new Paragraph(text: data);
1069 } 1069 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/framework/components2/menu_item.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698