| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 ChromeVox commands. | 6 * @fileoverview ChromeVox commands. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 goog.provide('CommandHandler'); | 9 goog.provide('CommandHandler'); |
| 10 | 10 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 current = current.move(cursors.Unit.CHARACTER, Dir.BACKWARD); | 220 current = current.move(cursors.Unit.CHARACTER, Dir.BACKWARD); |
| 221 break; | 221 break; |
| 222 case 'nextWord': | 222 case 'nextWord': |
| 223 current = current.move(cursors.Unit.WORD, Dir.FORWARD); | 223 current = current.move(cursors.Unit.WORD, Dir.FORWARD); |
| 224 break; | 224 break; |
| 225 case 'previousWord': | 225 case 'previousWord': |
| 226 current = current.move(cursors.Unit.WORD, Dir.BACKWARD); | 226 current = current.move(cursors.Unit.WORD, Dir.BACKWARD); |
| 227 break; | 227 break; |
| 228 case 'forward': | 228 case 'forward': |
| 229 case 'nextLine': | 229 case 'nextLine': |
| 230 chrome.metricsPrivate.recordUserAction('ChromeVox.Navigate'); |
| 230 current = current.move(cursors.Unit.LINE, Dir.FORWARD); | 231 current = current.move(cursors.Unit.LINE, Dir.FORWARD); |
| 231 break; | 232 break; |
| 232 case 'backward': | 233 case 'backward': |
| 233 case 'previousLine': | 234 case 'previousLine': |
| 235 chrome.metricsPrivate.recordUserAction('ChromeVox.Navigate'); |
| 234 current = current.move(cursors.Unit.LINE, Dir.BACKWARD); | 236 current = current.move(cursors.Unit.LINE, Dir.BACKWARD); |
| 235 break; | 237 break; |
| 236 case 'nextButton': | 238 case 'nextButton': |
| 237 dir = Dir.FORWARD; | 239 dir = Dir.FORWARD; |
| 238 pred = AutomationPredicate.button; | 240 pred = AutomationPredicate.button; |
| 239 predErrorMsg = 'no_next_button'; | 241 predErrorMsg = 'no_next_button'; |
| 240 break; | 242 break; |
| 241 case 'previousButton': | 243 case 'previousButton': |
| 242 dir = Dir.BACKWARD; | 244 dir = Dir.BACKWARD; |
| 243 pred = AutomationPredicate.button; | 245 pred = AutomationPredicate.button; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 command == 'goToLastCell' ? Dir.BACKWARD : Dir.FORWARD, | 659 command == 'goToLastCell' ? Dir.BACKWARD : Dir.FORWARD, |
| 658 AutomationPredicate.leaf); | 660 AutomationPredicate.leaf); |
| 659 if (end) | 661 if (end) |
| 660 current = cursors.Range.fromNode(end); | 662 current = cursors.Range.fromNode(end); |
| 661 break; | 663 break; |
| 662 default: | 664 default: |
| 663 return true; | 665 return true; |
| 664 } | 666 } |
| 665 | 667 |
| 666 if (pred) { | 668 if (pred) { |
| 669 chrome.metricsPrivate.recordUserAction('ChromeVox.Jump'); |
| 670 |
| 667 var bound = current.getBound(dir).node; | 671 var bound = current.getBound(dir).node; |
| 668 if (bound) { | 672 if (bound) { |
| 669 var node = AutomationUtil.findNextNode( | 673 var node = AutomationUtil.findNextNode( |
| 670 bound, dir, pred, {skipInitialAncestry: true}); | 674 bound, dir, pred, {skipInitialAncestry: true}); |
| 671 | 675 |
| 672 if (node && !skipSync) { | 676 if (node && !skipSync) { |
| 673 node = AutomationUtil.findNodePre( | 677 node = AutomationUtil.findNodePre( |
| 674 node, Dir.FORWARD, AutomationPredicate.object) || | 678 node, Dir.FORWARD, AutomationPredicate.object) || |
| 675 node; | 679 node; |
| 676 } | 680 } |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 754 break; | 758 break; |
| 755 } | 759 } |
| 756 if (announcement) { | 760 if (announcement) { |
| 757 cvox.ChromeVox.tts.speak( | 761 cvox.ChromeVox.tts.speak( |
| 758 announcement, cvox.QueueMode.FLUSH, | 762 announcement, cvox.QueueMode.FLUSH, |
| 759 cvox.AbstractTts.PERSONALITY_ANNOTATION); | 763 cvox.AbstractTts.PERSONALITY_ANNOTATION); |
| 760 } | 764 } |
| 761 }; | 765 }; |
| 762 | 766 |
| 763 }); // goog.scope | 767 }); // goog.scope |
| OLD | NEW |