| 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 goog.provide('cvox.ChromeVoxKbHandler'); | 5 goog.provide('cvox.ChromeVoxKbHandler'); |
| 6 | 6 |
| 7 goog.require('cvox.ChromeVox'); | 7 goog.require('cvox.ChromeVox'); |
| 8 goog.require('cvox.KeyMap'); | 8 goog.require('cvox.KeyMap'); |
| 9 goog.require('cvox.KeySequence'); | 9 goog.require('cvox.KeySequence'); |
| 10 goog.require('cvox.KeyUtil'); | 10 goog.require('cvox.KeyUtil'); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 function compareKeyStr(a, b) { | 66 function compareKeyStr(a, b) { |
| 67 // Compare the lengths of the key bindings. | 67 // Compare the lengths of the key bindings. |
| 68 if (a[0].length < b[0].length) { | 68 if (a[0].length < b[0].length) { |
| 69 return -1; | 69 return -1; |
| 70 } else if (b[0].length < a[0].length) { | 70 } else if (b[0].length < a[0].length) { |
| 71 return 1; | 71 return 1; |
| 72 } else { | 72 } else { |
| 73 // The keys are the same length. Sort lexicographically. | 73 // The keys are the same length. Sort lexicographically. |
| 74 return a[0].localeCompare(b[0]); | 74 return a[0].localeCompare(b[0]); |
| 75 } | 75 } |
| 76 }; | 76 } |
| 77 | 77 |
| 78 sortingArray.sort(compareKeyStr); | 78 sortingArray.sort(compareKeyStr); |
| 79 return sortingArray; | 79 return sortingArray; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 | 82 |
| 83 /** | 83 /** |
| 84 * Handles key down events. | 84 * Handles key down events. |
| 85 * | 85 * |
| 86 * @param {Event} evt The key down event to process. | 86 * @param {Event} evt The key down event to process. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 returnValue = false; | 122 returnValue = false; |
| 123 } | 123 } |
| 124 | 124 |
| 125 // If the whole document is hidden from screen readers, let the app | 125 // If the whole document is hidden from screen readers, let the app |
| 126 // catch keys as well. | 126 // catch keys as well. |
| 127 if (cvox.ChromeVox.entireDocumentIsHidden) { | 127 if (cvox.ChromeVox.entireDocumentIsHidden) { |
| 128 returnValue = true; | 128 returnValue = true; |
| 129 } | 129 } |
| 130 return returnValue; | 130 return returnValue; |
| 131 }; | 131 }; |
| OLD | NEW |