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

Side by Side Diff: lib/dom/templates/html/dartium/impl_EventTarget.darttemplate

Issue 10456033: Remove now useless top level _wrap and _unwrap from dart:html. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 class _EventsImpl implements Events { 5 class _EventsImpl implements Events {
6 // TODO(podivilov): add type. 6 // TODO(podivilov): add type.
7 final _ptr; 7 final _ptr;
8 8
9 final Map<String, EventListenerList> _listenerMap; 9 final Map<String, EventListenerList> _listenerMap;
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 EventListenerList remove(EventListener listener, [bool useCapture = false]) { 45 EventListenerList remove(EventListener listener, [bool useCapture = false]) {
46 _remove(listener, useCapture); 46 _remove(listener, useCapture);
47 return this; 47 return this;
48 } 48 }
49 49
50 bool dispatch(Event evt) { 50 bool dispatch(Event evt) {
51 // TODO(jacobr): what is the correct behavior here. We could alternately 51 // TODO(jacobr): what is the correct behavior here. We could alternately
52 // force the event to have the expected type. 52 // force the event to have the expected type.
53 assert(evt.type == _type); 53 assert(evt.type == _type);
54 return _ptr.$dom_dispatchEvent(_unwrap(evt)); 54 return _ptr.$dom_dispatchEvent(evt);
55 } 55 }
56 56
57 void _add(EventListener listener, bool useCapture) { 57 void _add(EventListener listener, bool useCapture) {
58 _ptr.$dom_addEventListener(_type, 58 _ptr.$dom_addEventListener(_type,
59 _findOrAddWrapper(listener, useCapture), 59 _findOrAddWrapper(listener, useCapture),
60 useCapture); 60 useCapture);
61 } 61 }
62 62
63 void _remove(EventListener listener, bool useCapture) { 63 void _remove(EventListener listener, bool useCapture) {
64 Function wrapper = _removeWrapper(listener, useCapture); 64 Function wrapper = _removeWrapper(listener, useCapture);
(...skipping 25 matching lines...) Expand all
90 Function _findOrAddWrapper(EventListener listener, bool useCapture) { 90 Function _findOrAddWrapper(EventListener listener, bool useCapture) {
91 if (_wrappers === null) { 91 if (_wrappers === null) {
92 _wrappers = <_EventListenerWrapper>[]; 92 _wrappers = <_EventListenerWrapper>[];
93 } else { 93 } else {
94 for (_EventListenerWrapper wrapper in _wrappers) { 94 for (_EventListenerWrapper wrapper in _wrappers) {
95 if (wrapper.raw === listener && wrapper.useCapture == useCapture) { 95 if (wrapper.raw === listener && wrapper.useCapture == useCapture) {
96 return wrapper.wrapped; 96 return wrapper.wrapped;
97 } 97 }
98 } 98 }
99 } 99 }
100 final wrapped = (e) { listener(_wrap(e)); }; 100 final wrapped = (e) { listener(e); };
101 _wrappers.add(new _EventListenerWrapper(listener, wrapped, useCapture)); 101 _wrappers.add(new _EventListenerWrapper(listener, wrapped, useCapture));
102 return wrapped; 102 return wrapped;
103 } 103 }
104 } 104 }
105 105
106 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { 106 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
107 /* 107 /*
108 $!MEMBERS 108 $!MEMBERS
109 */ 109 */
110 } 110 }
OLDNEW
« no previous file with comments | « lib/dom/templates/html/dartium/html_dartium.darttemplate ('k') | lib/html/dartium/html_dartium.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698