| 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 collection of JavaScript utilities used to simplify working | 6 * @fileoverview A collection of JavaScript utilities used to simplify working |
| 7 * with keyboard events. | 7 * with keyboard events. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 | 10 |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 } else { | 111 } else { |
| 112 util.sequencing = false; | 112 util.sequencing = false; |
| 113 } | 113 } |
| 114 | 114 |
| 115 // Repeated keys pressed. | 115 // Repeated keys pressed. |
| 116 var currTime = new Date().getTime(); | 116 var currTime = new Date().getTime(); |
| 117 if (cvox.KeyUtil.isDoubleTapKey(keySequence) && | 117 if (cvox.KeyUtil.isDoubleTapKey(keySequence) && |
| 118 util.prevKeySequence && | 118 util.prevKeySequence && |
| 119 keySequence.equals(util.prevKeySequence)) { | 119 keySequence.equals(util.prevKeySequence)) { |
| 120 var prevTime = util.modeKeyPressTime; | 120 var prevTime = util.modeKeyPressTime; |
| 121 if (prevTime > 0 && currTime - prevTime < 300) { // Double tap | 121 var delta = currTime - prevTime; |
| 122 if (prevTime > 0 && delta > 100 && delta < 300) { // Double tap |
| 122 keySequence = util.prevKeySequence; | 123 keySequence = util.prevKeySequence; |
| 123 keySequence.doubleTap = true; | 124 keySequence.doubleTap = true; |
| 124 util.prevKeySequence = null; | 125 util.prevKeySequence = null; |
| 125 util.sequencing = false; | 126 util.sequencing = false; |
| 126 // Resets the search key state tracked for ChromeOS because in OOBE, | 127 // Resets the search key state tracked for ChromeOS because in OOBE, |
| 127 // we never get a key up for the key down (keyCode 91). | 128 // we never get a key up for the key down (keyCode 91). |
| 128 if (cvox.ChromeVox.isChromeOS && | 129 if (cvox.ChromeVox.isChromeOS && |
| 129 keyEvent.keyCode == cvox.KeyUtil.getStickyKeyCode()) { | 130 keyEvent.keyCode == cvox.KeyUtil.getStickyKeyCode()) { |
| 130 cvox.ChromeVox.searchKeyHeld = false; | 131 cvox.ChromeVox.searchKeyHeld = false; |
| 131 } | 132 } |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 key.doubleTap = true; | 496 key.doubleTap = true; |
| 496 for (var i = 0, keySeq; keySeq = cvox.KeySequence.doubleTapCache[i]; i++) { | 497 for (var i = 0, keySeq; keySeq = cvox.KeySequence.doubleTapCache[i]; i++) { |
| 497 if (keySeq.equals(key)) { | 498 if (keySeq.equals(key)) { |
| 498 isSet = true; | 499 isSet = true; |
| 499 break; | 500 break; |
| 500 } | 501 } |
| 501 } | 502 } |
| 502 key.doubleTap = originalState; | 503 key.doubleTap = originalState; |
| 503 return isSet; | 504 return isSet; |
| 504 }; | 505 }; |
| OLD | NEW |