Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/command_handler.js

Issue 2385343002: Make ChromeVox use child-index based offsets again for selection. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 output.withString(target.name || ''); 502 output.withString(target.name || '');
503 } 503 }
504 output.go(); 504 output.go();
505 return false; 505 return false;
506 case 'readCurrentURL': 506 case 'readCurrentURL':
507 var output = new Output(); 507 var output = new Output();
508 var target = ChromeVoxState.instance.currentRange_.start.node.root; 508 var target = ChromeVoxState.instance.currentRange_.start.node.root;
509 output.withString(target.docUrl || '').go(); 509 output.withString(target.docUrl || '').go();
510 return false; 510 return false;
511 case 'copy': 511 case 'copy':
512 var textarea = document.createElement('textarea'); 512 window.setTimeout(function() {
dmazzoni 2016/10/05 18:25:33 Have you looked into this API, would it work? htt
David Tseng 2016/10/10 20:03:21 This didn't work for me when I first tried it a wh
513 document.body.appendChild(textarea); 513 var textarea = document.createElement('textarea');
514 textarea.focus(); 514 document.body.appendChild(textarea);
515 document.execCommand('paste'); 515 textarea.focus();
516 var clipboardContent = textarea.value; 516 document.execCommand('paste');
517 textarea.remove(); 517 var clipboardContent = textarea.value;
518 cvox.ChromeVox.tts.speak( 518 textarea.remove();
519 Msgs.getMsg('copy', [clipboardContent]), cvox.QueueMode.FLUSH); 519 cvox.ChromeVox.tts.speak(
520 ChromeVoxState.instance.pageSel_ = null; 520 Msgs.getMsg('copy', [clipboardContent]), cvox.QueueMode.FLUSH);
521 ChromeVoxState.instance.pageSel_ = null;
522 }, 20);
521 return true; 523 return true;
522 case 'toggleSelection': 524 case 'toggleSelection':
523 if (!ChromeVoxState.instance.pageSel_) { 525 if (!ChromeVoxState.instance.pageSel_) {
524 ChromeVoxState.instance.pageSel_ = ChromeVoxState.instance.currentRange; 526 ChromeVoxState.instance.pageSel_ = ChromeVoxState.instance.currentRange;
525 } else { 527 } else {
526 var root = ChromeVoxState.instance.currentRange_.start.node.root; 528 var root = ChromeVoxState.instance.currentRange_.start.node.root;
527 if (root && root.anchorObject && root.focusObject) { 529 if (root && root.anchorObject && root.focusObject) {
528 var sel = new cursors.Range( 530 var sel = new cursors.Range(
529 new cursors.Cursor(root.anchorObject, root.anchorOffset), 531 new cursors.Cursor(root.anchorObject, root.anchorOffset),
530 new cursors.Cursor(root.focusObject, root.focusOffset)); 532 new cursors.Cursor(root.focusObject, root.focusOffset));
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 break; 712 break;
711 } 713 }
712 if (announcement) { 714 if (announcement) {
713 cvox.ChromeVox.tts.speak( 715 cvox.ChromeVox.tts.speak(
714 announcement, cvox.QueueMode.FLUSH, 716 announcement, cvox.QueueMode.FLUSH,
715 cvox.AbstractTts.PERSONALITY_ANNOTATION); 717 cvox.AbstractTts.PERSONALITY_ANNOTATION);
716 } 718 }
717 }; 719 };
718 720
719 }); // goog.scope 721 }); // goog.scope
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698