| OLD | NEW |
| 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 part of html; | 5 part of html; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Works with KeyboardEvent and KeyEvent to determine how to expose information | 8 * Works with KeyboardEvent and KeyEvent to determine how to expose information |
| 9 * about Key(board)Events. This class functions like an EventListenerList, and | 9 * about Key(board)Events. This class functions like an EventListenerList, and |
| 10 * provides a consistent interface for the Dart | 10 * provides a consistent interface for the Dart |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 /** The set of functions that wish to be notified when a KeyEvent happens. */ | 28 /** The set of functions that wish to be notified when a KeyEvent happens. */ |
| 29 List<Function> _callbacks; | 29 List<Function> _callbacks; |
| 30 | 30 |
| 31 /** The type of KeyEvent we are tracking (keyup, keydown, keypress). */ | 31 /** The type of KeyEvent we are tracking (keyup, keydown, keypress). */ |
| 32 String _type; | 32 String _type; |
| 33 | 33 |
| 34 /** The element we are watching for events to happen on. */ | 34 /** The element we are watching for events to happen on. */ |
| 35 EventTarget _target; | 35 EventTarget _target; |
| 36 | 36 |
| 37 // The distance to shift from upper case alphabet Roman letters to lower case. | 37 // The distance to shift from upper case alphabet Roman letters to lower case. |
| 38 int _ROMAN_ALPHABET_OFFSET = "a".charCodes[0] - "A".charCodes[0]; | 38 final int _ROMAN_ALPHABET_OFFSET = "a".charCodes[0] - "A".charCodes[0]; |
| 39 | 39 |
| 40 // Instance members referring to the internal event handlers because closures | 40 // Instance members referring to the internal event handlers because closures |
| 41 // are not hashable. | 41 // are not hashable. |
| 42 var _keyUp, _keyDown, _keyPress; | 42 var _keyUp, _keyDown, _keyPress; |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * An enumeration of key identifiers currently part of the W3C draft for DOM3 | 45 * An enumeration of key identifiers currently part of the W3C draft for DOM3 |
| 46 * and their mappings to keyCodes. | 46 * and their mappings to keyCodes. |
| 47 * http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set | 47 * http://www.w3.org/TR/DOM-Level-3-Events/keyset.html#KeySet-Set |
| 48 */ | 48 */ |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 _keyDownList = _keyDownList.filter((element) => element != toRemove); | 396 _keyDownList = _keyDownList.filter((element) => element != toRemove); |
| 397 } else if (_keyDownList.length > 0) { | 397 } else if (_keyDownList.length > 0) { |
| 398 // This happens when we've reached some international keyboard case we | 398 // This happens when we've reached some international keyboard case we |
| 399 // haven't accounted for or we haven't correctly eliminated all browser | 399 // haven't accounted for or we haven't correctly eliminated all browser |
| 400 // inconsistencies. Filing bugs on when this is reached is welcome! | 400 // inconsistencies. Filing bugs on when this is reached is welcome! |
| 401 _keyDownList.removeLast(); | 401 _keyDownList.removeLast(); |
| 402 } | 402 } |
| 403 _dispatch(e); | 403 _dispatch(e); |
| 404 } | 404 } |
| 405 } | 405 } |
| OLD | NEW |