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

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

Issue 2450093002: Read the selected text explicitly when focusing a texdt field (Closed)
Patch Set: Created 4 years, 1 month 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 | « chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 Provides output services for ChromeVox. 6 * @fileoverview Provides output services for ChromeVox.
7 */ 7 */
8 8
9 goog.provide('Output'); 9 goog.provide('Output');
10 goog.provide('Output.EventType'); 10 goog.provide('Output.EventType');
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 // Process token based on prefix. 1061 // Process token based on prefix.
1062 var prefix = token[0]; 1062 var prefix = token[0];
1063 token = token.slice(1); 1063 token = token.slice(1);
1064 1064
1065 // All possible tokens based on prefix. 1065 // All possible tokens based on prefix.
1066 if (prefix == '$') { 1066 if (prefix == '$') {
1067 if (token == 'value') { 1067 if (token == 'value') {
1068 var text = node.value; 1068 var text = node.value;
1069 if (!node.state.editable && node.name == text) 1069 if (!node.state.editable && node.name == text)
1070 return; 1070 return;
1071
1072 var selectedText = '';
1071 if (text !== undefined) { 1073 if (text !== undefined) {
1072 if (node.textSelStart !== undefined) { 1074 if (node.textSelStart !== undefined) {
1073 options.annotation.push(new Output.SelectionSpan( 1075 options.annotation.push(new Output.SelectionSpan(
1074 node.textSelStart, 1076 node.textSelStart,
1075 node.textSelEnd)); 1077 node.textSelEnd));
1078
1079 selectedText =
1080 node.value.substring(node.textSelStart, node.textSelEnd);
1076 } 1081 }
1077 } 1082 }
1078 options.annotation.push(token); 1083 options.annotation.push(token);
1079 this.append_(buff, text, options); 1084 if (selectedText) {
1085 this.append_(buff, selectedText, options);
1086 this.append_(buff, Msgs.getMsg('selected'), options);
1087 } else {
1088 this.append_(buff, text, options);
1089 }
1080 } else if (token == 'name') { 1090 } else if (token == 'name') {
1081 options.annotation.push(token); 1091 options.annotation.push(token);
1082 var earcon = node ? this.findEarcon_(node, opt_prevNode) : null; 1092 var earcon = node ? this.findEarcon_(node, opt_prevNode) : null;
1083 if (earcon) 1093 if (earcon)
1084 options.annotation.push(earcon); 1094 options.annotation.push(earcon);
1085 this.append_(buff, node.name, options); 1095 this.append_(buff, node.name, options);
1086 } else if (token == 'nameFromNode') { 1096 } else if (token == 'nameFromNode') {
1087 if (chrome.automation.NameFromType[node.nameFrom] == 1097 if (chrome.automation.NameFromType[node.nameFrom] ==
1088 'contents') 1098 'contents')
1089 return; 1099 return;
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1771 /** 1781 /**
1772 * Gets the output buffer for braille. 1782 * Gets the output buffer for braille.
1773 * @return {!Spannable} 1783 * @return {!Spannable}
1774 */ 1784 */
1775 get brailleOutputForTest() { 1785 get brailleOutputForTest() {
1776 return this.createBrailleOutput_(); 1786 return this.createBrailleOutput_();
1777 } 1787 }
1778 }; 1788 };
1779 1789
1780 }); // goog.scope 1790 }); // goog.scope
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698