OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
6 * @fileoverview A JavaScript class that represents a sequence of keys entered | 6 * @fileoverview A JavaScript class that represents a sequence of keys entered |
7 * by the user. | 7 * by the user. |
8 */ | 8 */ |
9 | 9 |
10 | 10 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 keyCode: [] | 89 keyCode: [] |
90 }; | 90 }; |
91 | 91 |
92 this.extractKey_(event); | 92 this.extractKey_(event); |
93 }; | 93 }; |
94 | 94 |
95 | 95 |
96 // TODO(dtseng): This is incomplete; pull once we have appropriate libs. | 96 // TODO(dtseng): This is incomplete; pull once we have appropriate libs. |
97 /** | 97 /** |
98 * Maps a keypress keycode to a keydown or keyup keycode. | 98 * Maps a keypress keycode to a keydown or keyup keycode. |
99 * @type {Object.<number, number>} | 99 * @type {Object<number, number>} |
100 */ | 100 */ |
101 cvox.KeySequence.KEY_PRESS_CODE = { | 101 cvox.KeySequence.KEY_PRESS_CODE = { |
102 39: 222, | 102 39: 222, |
103 44: 188, | 103 44: 188, |
104 45: 189, | 104 45: 189, |
105 46: 190, | 105 46: 190, |
106 47: 191, | 106 47: 191, |
107 59: 186, | 107 59: 186, |
108 91: 219, | 108 91: 219, |
109 92: 220, | 109 92: 220, |
110 93: 221 | 110 93: 221 |
111 }; | 111 }; |
112 | 112 |
113 /** | 113 /** |
114 * A cache of all key sequences that have been set as double-tappable. We need | 114 * A cache of all key sequences that have been set as double-tappable. We need |
115 * this cache because repeated key down computations causes ChromeVox to become | 115 * this cache because repeated key down computations causes ChromeVox to become |
116 * less responsive. This list is small so we currently use an array. | 116 * less responsive. This list is small so we currently use an array. |
117 * @type {!Array.<cvox.KeySequence>} | 117 * @type {!Array<cvox.KeySequence>} |
118 */ | 118 */ |
119 cvox.KeySequence.doubleTapCache = []; | 119 cvox.KeySequence.doubleTapCache = []; |
120 | 120 |
121 | 121 |
122 /** | 122 /** |
123 * Adds an additional key onto the original sequence, for use when the user | 123 * Adds an additional key onto the original sequence, for use when the user |
124 * is entering two shortcut keys. This happens when the user presses a key, | 124 * is entering two shortcut keys. This happens when the user presses a key, |
125 * releases it, and then presses a second key. Those two keys together are | 125 * releases it, and then presses a second key. Those two keys together are |
126 * considered part of the sequence. | 126 * considered part of the sequence. |
127 * @param {Event|Object} additionalKeyEvent The additional key to be added to | 127 * @param {Event|Object} additionalKeyEvent The additional key to be added to |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 break; | 620 break; |
621 case 122: // F11 | 621 case 122: // F11 |
622 evt['keyCode'] = 189; // Hyphen. | 622 evt['keyCode'] = 189; // Hyphen. |
623 break; | 623 break; |
624 case 123: // F12 | 624 case 123: // F12 |
625 evt['keyCode'] = 187; // Equals. | 625 evt['keyCode'] = 187; // Equals. |
626 break; | 626 break; |
627 } | 627 } |
628 return evt; | 628 return evt; |
629 }; | 629 }; |
OLD | NEW |