OLD | NEW |
1 /** | 1 /** |
2 * A custom KeyboardEvent that attempts to eliminate cross-browser | 2 * A custom KeyboardEvent that attempts to eliminate cross-browser |
3 * inconsistencies, and also provide both keyCode and charCode information | 3 * inconsistencies, and also provide both keyCode and charCode information |
4 * for all key events (when such information can be determined). | 4 * for all key events (when such information can be determined). |
5 * | 5 * |
6 * KeyEvent tries to provide a higher level, more polished keyboard event | 6 * KeyEvent tries to provide a higher level, more polished keyboard event |
7 * information on top of the "raw" [KeyboardEvent]. | 7 * information on top of the "raw" [KeyboardEvent]. |
8 * | 8 * |
9 * The mechanics of using KeyEvents is a little different from the underlying | 9 * The mechanics of using KeyEvents is a little different from the underlying |
10 * [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add | 10 * [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 /** Accessor to the underlying charCode value is the parent event. */ | 57 /** Accessor to the underlying charCode value is the parent event. */ |
58 int get _realCharCode => JS('int', '#.charCode', _parent); | 58 int get _realCharCode => JS('int', '#.charCode', _parent); |
59 | 59 |
60 /** Accessor to the underlying altKey value is the parent event. */ | 60 /** Accessor to the underlying altKey value is the parent event. */ |
61 bool get _realAltKey => JS('bool', '#.altKey', _parent); | 61 bool get _realAltKey => JS('bool', '#.altKey', _parent); |
62 | 62 |
63 /** Shadows on top of the parent's currentTarget. */ | 63 /** Shadows on top of the parent's currentTarget. */ |
64 EventTarget _currentTarget; | 64 EventTarget _currentTarget; |
65 | 65 |
| 66 final InputDeviceCapabilities sourceCapabilities; |
| 67 |
66 /** | 68 /** |
67 * The value we want to use for this object's dispatch. Created here so it is | 69 * The value we want to use for this object's dispatch. Created here so it is |
68 * only invoked once. | 70 * only invoked once. |
69 */ | 71 */ |
70 static final _keyboardEventDispatchRecord = _makeRecord(); | 72 static final _keyboardEventDispatchRecord = _makeRecord(); |
71 | 73 |
72 /** Helper to statically create the dispatch record. */ | 74 /** Helper to statically create the dispatch record. */ |
73 static _makeRecord() { | 75 static _makeRecord() { |
74 var interceptor = JS_INTERCEPTOR_CONSTANT(KeyboardEvent); | 76 var interceptor = JS_INTERCEPTOR_CONSTANT(KeyboardEvent); |
75 return makeLeafDispatchRecord(interceptor); | 77 return makeLeafDispatchRecord(interceptor); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 /** | 211 /** |
210 * Accessor to the part of the keyboard that the key was pressed from (one of | 212 * Accessor to the part of the keyboard that the key was pressed from (one of |
211 * KeyLocation.STANDARD, KeyLocation.RIGHT, KeyLocation.LEFT, | 213 * KeyLocation.STANDARD, KeyLocation.RIGHT, KeyLocation.LEFT, |
212 * KeyLocation.NUMPAD, KeyLocation.MOBILE, KeyLocation.JOYSTICK). | 214 * KeyLocation.NUMPAD, KeyLocation.MOBILE, KeyLocation.JOYSTICK). |
213 */ | 215 */ |
214 int get keyLocation => _parent.keyLocation; | 216 int get keyLocation => _parent.keyLocation; |
215 /** True if the Meta (or Mac command) key is pressed during this event. */ | 217 /** True if the Meta (or Mac command) key is pressed during this event. */ |
216 bool get metaKey => _parent.metaKey; | 218 bool get metaKey => _parent.metaKey; |
217 /** True if the shift key was pressed during this event. */ | 219 /** True if the shift key was pressed during this event. */ |
218 bool get shiftKey => _parent.shiftKey; | 220 bool get shiftKey => _parent.shiftKey; |
219 InputDevice get sourceDevice => _parent.sourceDevice; | |
220 Window get view => _parent.view; | 221 Window get view => _parent.view; |
221 void _initUIEvent( | 222 void _initUIEvent( |
222 String type, bool canBubble, bool cancelable, Window view, int detail) { | 223 String type, bool canBubble, bool cancelable, Window view, int detail) { |
223 throw new UnsupportedError("Cannot initialize a UI Event from a KeyEvent."); | 224 throw new UnsupportedError("Cannot initialize a UI Event from a KeyEvent."); |
224 } | 225 } |
225 | 226 |
226 String get _shadowKeyIdentifier => JS('String', '#.keyIdentifier', _parent); | 227 String get _shadowKeyIdentifier => JS('String', '#.keyIdentifier', _parent); |
227 | 228 |
228 int get _charCode => charCode; | 229 int get _charCode => charCode; |
229 int get _keyCode => keyCode; | 230 int get _keyCode => keyCode; |
(...skipping 19 matching lines...) Expand all Loading... |
249 } | 250 } |
250 | 251 |
251 @Experimental() // untriaged | 252 @Experimental() // untriaged |
252 bool getModifierState(String keyArgument) => throw new UnimplementedError(); | 253 bool getModifierState(String keyArgument) => throw new UnimplementedError(); |
253 @Experimental() // untriaged | 254 @Experimental() // untriaged |
254 int get location => throw new UnimplementedError(); | 255 int get location => throw new UnimplementedError(); |
255 @Experimental() // untriaged | 256 @Experimental() // untriaged |
256 bool get repeat => throw new UnimplementedError(); | 257 bool get repeat => throw new UnimplementedError(); |
257 dynamic get _get_view => throw new UnimplementedError(); | 258 dynamic get _get_view => throw new UnimplementedError(); |
258 } | 259 } |
OLD | NEW |