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

Side by Side Diff: sky/sdk/lib/widgets/widget.dart

Issue 1193513007: Rename EventListenerNode to Listener (Closed) Base URL: git@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/widgets/toggleable.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 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 class ParentDataNode extends TagNode { 180 class ParentDataNode extends TagNode {
181 ParentDataNode(Widget content, this.parentData, { String key }) 181 ParentDataNode(Widget content, this.parentData, { String key })
182 : super(content, key: key); 182 : super(content, key: key);
183 final ParentData parentData; 183 final ParentData parentData;
184 } 184 }
185 185
186 typedef void GestureEventListener(sky.GestureEvent e); 186 typedef void GestureEventListener(sky.GestureEvent e);
187 typedef void PointerEventListener(sky.PointerEvent e); 187 typedef void PointerEventListener(sky.PointerEvent e);
188 typedef void EventListener(sky.Event e); 188 typedef void EventListener(sky.Event e);
189 189
190 class EventListenerNode extends TagNode { 190 class Listener extends TagNode {
191 191
192 EventListenerNode(Widget content, { 192 Listener({
193 Widget child,
193 EventListener onWheel, 194 EventListener onWheel,
194 GestureEventListener onGestureFlingCancel, 195 GestureEventListener onGestureFlingCancel,
195 GestureEventListener onGestureFlingStart, 196 GestureEventListener onGestureFlingStart,
196 GestureEventListener onGestureScrollStart, 197 GestureEventListener onGestureScrollStart,
197 GestureEventListener onGestureScrollUpdate, 198 GestureEventListener onGestureScrollUpdate,
198 GestureEventListener onGestureTap, 199 GestureEventListener onGestureTap,
199 GestureEventListener onGestureTapDown, 200 GestureEventListener onGestureTapDown,
200 PointerEventListener onPointerCancel, 201 PointerEventListener onPointerCancel,
201 PointerEventListener onPointerDown, 202 PointerEventListener onPointerDown,
202 PointerEventListener onPointerMove, 203 PointerEventListener onPointerMove,
203 PointerEventListener onPointerUp, 204 PointerEventListener onPointerUp,
204 Map<String, sky.EventListener> custom 205 Map<String, sky.EventListener> custom
205 }) : listeners = _createListeners( 206 }) : listeners = _createListeners(
206 onWheel: onWheel, 207 onWheel: onWheel,
207 onGestureFlingCancel: onGestureFlingCancel, 208 onGestureFlingCancel: onGestureFlingCancel,
208 onGestureFlingStart: onGestureFlingStart, 209 onGestureFlingStart: onGestureFlingStart,
209 onGestureScrollUpdate: onGestureScrollUpdate, 210 onGestureScrollUpdate: onGestureScrollUpdate,
210 onGestureScrollStart: onGestureScrollStart, 211 onGestureScrollStart: onGestureScrollStart,
211 onGestureTap: onGestureTap, 212 onGestureTap: onGestureTap,
212 onGestureTapDown: onGestureTapDown, 213 onGestureTapDown: onGestureTapDown,
213 onPointerCancel: onPointerCancel, 214 onPointerCancel: onPointerCancel,
214 onPointerDown: onPointerDown, 215 onPointerDown: onPointerDown,
215 onPointerMove: onPointerMove, 216 onPointerMove: onPointerMove,
216 onPointerUp: onPointerUp, 217 onPointerUp: onPointerUp,
217 custom: custom 218 custom: custom
218 ), 219 ),
219 super(content); 220 super(child);
220 221
221 final Map<String, sky.EventListener> listeners; 222 final Map<String, sky.EventListener> listeners;
222 223
223 static Map<String, sky.EventListener> _createListeners({ 224 static Map<String, sky.EventListener> _createListeners({
224 EventListener onWheel, 225 EventListener onWheel,
225 GestureEventListener onGestureFlingCancel, 226 GestureEventListener onGestureFlingCancel,
226 GestureEventListener onGestureFlingStart, 227 GestureEventListener onGestureFlingStart,
227 GestureEventListener onGestureScrollStart, 228 GestureEventListener onGestureScrollStart,
228 GestureEventListener onGestureScrollUpdate, 229 GestureEventListener onGestureScrollUpdate,
229 GestureEventListener onGestureTap, 230 GestureEventListener onGestureTap,
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 751
751 void dispatchEvent(sky.Event event, HitTestResult result) { 752 void dispatchEvent(sky.Event event, HitTestResult result) {
752 assert(_appView == this); 753 assert(_appView == this);
753 super.dispatchEvent(event, result); 754 super.dispatchEvent(event, result);
754 for (HitTestEntry entry in result.path.reversed) { 755 for (HitTestEntry entry in result.path.reversed) {
755 Widget target = RenderObjectWrapper._getMounted(entry.target); 756 Widget target = RenderObjectWrapper._getMounted(entry.target);
756 if (target == null) 757 if (target == null)
757 continue; 758 continue;
758 RenderObject targetRoot = target.root; 759 RenderObject targetRoot = target.root;
759 while (target != null && target.root == targetRoot) { 760 while (target != null && target.root == targetRoot) {
760 if (target is EventListenerNode) 761 if (target is EventListener)
761 target._handleEvent(event); 762 target._handleEvent(event);
762 target = target._parent; 763 target = target._parent;
763 } 764 }
764 } 765 }
765 } 766 }
766 767
767 } 768 }
768 769
769 abstract class AbstractWidgetRoot extends Component { 770 abstract class AbstractWidgetRoot extends Component {
770 771
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 if (root.parent == null) { 840 if (root.parent == null) {
840 // we haven't attached it yet 841 // we haven't attached it yet
841 assert(_container.child == null); 842 assert(_container.child == null);
842 _container.child = root; 843 _container.child = root;
843 } 844 }
844 assert(root.parent == _container); 845 assert(root.parent == _container);
845 } 846 }
846 847
847 Widget build() => builder(); 848 Widget build() => builder();
848 } 849 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/toggleable.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698