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

Side by Side Diff: sky/specs/events.md

Issue 987403003: Specs: make parentNode abstract in EventTarget (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 Sky Event Model 1 Sky Event Model
2 =============== 2 ===============
3 3
4 ```dart 4 ```dart
5 import 'dart:collection'; 5 import 'dart:collection';
6 import 'dart:async'; 6 import 'dart:async';
7 7
8 class ExceptionAndStackTrace<T> { 8 class ExceptionAndStackTrace<T> {
9 const ExceptionAndStackTrace(this.exception, this.stackTrace); 9 const ExceptionAndStackTrace(this.exception, this.stackTrace);
10 final T exception; 10 final T exception;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // TODO(ianh): do events get retargetted, e.g. focus when leaving a custom ele ment? 138 // TODO(ianh): do events get retargetted, e.g. focus when leaving a custom ele ment?
139 // e.g. sent from inside a shadow tree, when exiting the shadow tree, focus ev ent should: 139 // e.g. sent from inside a shadow tree, when exiting the shadow tree, focus ev ent should:
140 // - disappear if we're moving from one to another element 140 // - disappear if we're moving from one to another element
141 // - be targetted if it's going to another node in a different scope 141 // - be targetted if it's going to another node in a different scope
142 } 142 }
143 143
144 class EventTarget { 144 class EventTarget {
145 EventTarget() : _eventsController = new DispatcherController<Event>(); 145 EventTarget() : _eventsController = new DispatcherController<Event>();
146 146
147 Dispatcher get events => _eventsController.dispatcher; 147 Dispatcher get events => _eventsController.dispatcher;
148 EventTarget parentNode; 148 EventTarget get parentNode;
149 149
150 List<EventTarget> getEventDispatchChain() { 150 List<EventTarget> getEventDispatchChain() {
151 if (this.parentNode == null) { 151 if (this.parentNode == null) {
152 return [this]; 152 return [this];
153 } else { 153 } else {
154 var result = this.parentNode.getEventDispatchChain(); 154 var result = this.parentNode.getEventDispatchChain();
155 result.insert(0, this); 155 result.insert(0, this);
156 return result; 156 return result;
157 } 157 }
158 } 158 }
(...skipping 24 matching lines...) Expand all
183 throw exceptions; 183 throw exceptions;
184 return event.result; 184 return event.result;
185 } 185 }
186 186
187 void _dispatchEventLocally(Event event) { 187 void _dispatchEventLocally(Event event) {
188 event._currentTarget = this; 188 event._currentTarget = this;
189 _eventsController.add(event); 189 _eventsController.add(event);
190 } 190 }
191 } 191 }
192 ``` 192 ```
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