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 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 pred = AutomationPredicate.visitedLink; | 307 pred = AutomationPredicate.visitedLink; |
308 predErrorMsg = 'no_next_visited_link'; | 308 predErrorMsg = 'no_next_visited_link'; |
309 break; | 309 break; |
310 case 'previousVisitedLink': | 310 case 'previousVisitedLink': |
311 dir = Dir.BACKWARD; | 311 dir = Dir.BACKWARD; |
312 pred = AutomationPredicate.visitedLink; | 312 pred = AutomationPredicate.visitedLink; |
313 predErrorMsg = 'no_previous_visited_link'; | 313 predErrorMsg = 'no_previous_visited_link'; |
314 break; | 314 break; |
315 case 'right': | 315 case 'right': |
316 case 'nextObject': | 316 case 'nextObject': |
317 current = current.move(cursors.Unit.DOM_NODE, Dir.FORWARD); | 317 current = current.move(cursors.Unit.NODE, Dir.FORWARD); |
318 break; | 318 break; |
319 case 'left': | 319 case 'left': |
320 case 'previousObject': | 320 case 'previousObject': |
321 current = current.move(cursors.Unit.DOM_NODE, Dir.BACKWARD); | 321 current = current.move(cursors.Unit.NODE, Dir.BACKWARD); |
322 break; | 322 break; |
323 case 'jumpToTop': | 323 case 'jumpToTop': |
324 var node = AutomationUtil.findNodePost( | 324 var node = AutomationUtil.findNodePost( |
325 current.start.node.root, Dir.FORWARD, AutomationPredicate.leaf); | 325 current.start.node.root, Dir.FORWARD, AutomationPredicate.leaf); |
326 if (node) | 326 if (node) |
327 current = cursors.Range.fromNode(node); | 327 current = cursors.Range.fromNode(node); |
328 break; | 328 break; |
329 case 'jumpToBottom': | 329 case 'jumpToBottom': |
330 var node = AutomationUtil.findNodePost( | 330 var node = AutomationUtil.findNodePost( |
331 current.start.node.root, Dir.BACKWARD, AutomationPredicate.leaf); | 331 current.start.node.root, Dir.BACKWARD, AutomationPredicate.leaf); |
(...skipping 13 matching lines...) Expand all Loading... |
345 case 'readFromHere': | 345 case 'readFromHere': |
346 ChromeVoxState.isReadingContinuously = true; | 346 ChromeVoxState.isReadingContinuously = true; |
347 var continueReading = function() { | 347 var continueReading = function() { |
348 if (!ChromeVoxState.isReadingContinuously || | 348 if (!ChromeVoxState.isReadingContinuously || |
349 !ChromeVoxState.instance.currentRange_) | 349 !ChromeVoxState.instance.currentRange_) |
350 return; | 350 return; |
351 | 351 |
352 var prevRange = ChromeVoxState.instance.currentRange_; | 352 var prevRange = ChromeVoxState.instance.currentRange_; |
353 var newRange = | 353 var newRange = |
354 ChromeVoxState.instance.currentRange_.move( | 354 ChromeVoxState.instance.currentRange_.move( |
355 cursors.Unit.DOM_NODE, Dir.FORWARD); | 355 cursors.Unit.NODE, Dir.FORWARD); |
356 | 356 |
357 // Stop if we've wrapped back to the document. | 357 // Stop if we've wrapped back to the document. |
358 var maybeDoc = newRange.start.node; | 358 var maybeDoc = newRange.start.node; |
359 if (maybeDoc.role == RoleType.rootWebArea && | 359 if (maybeDoc.role == RoleType.rootWebArea && |
360 maybeDoc.parent.root.role == RoleType.desktop) { | 360 maybeDoc.parent.root.role == RoleType.desktop) { |
361 ChromeVoxState.isReadingContinuously = false; | 361 ChromeVoxState.isReadingContinuously = false; |
362 return; | 362 return; |
363 } | 363 } |
364 | 364 |
365 ChromeVoxState.instance.setCurrentRange(newRange); | 365 ChromeVoxState.instance.setCurrentRange(newRange); |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 break; | 543 break; |
544 } | 544 } |
545 if (announcement) { | 545 if (announcement) { |
546 cvox.ChromeVox.tts.speak( | 546 cvox.ChromeVox.tts.speak( |
547 announcement, cvox.QueueMode.FLUSH, | 547 announcement, cvox.QueueMode.FLUSH, |
548 cvox.AbstractTts.PERSONALITY_ANNOTATION); | 548 cvox.AbstractTts.PERSONALITY_ANNOTATION); |
549 } | 549 } |
550 }; | 550 }; |
551 | 551 |
552 }); // goog.scope | 552 }); // goog.scope |
OLD | NEW |