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

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

Issue 779103002: Revert of Various changes required to support ChromeVox Next to read Views and Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
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 23 matching lines...) Expand all
34 * For example, $value $role $enabled 34 * For example, $value $role $enabled
35 * @ prefix: used to substitute a message. Note the ability to specify params to 35 * @ prefix: used to substitute a message. Note the ability to specify params to
36 * the message. For example, '@tag_html' '@selected_index($text_sel_start, 36 * the message. For example, '@tag_html' '@selected_index($text_sel_start,
37 * $text_sel_end'). 37 * $text_sel_end').
38 * = suffix: used to specify substitution only if not previously appended. 38 * = suffix: used to specify substitution only if not previously appended.
39 * For example, $name= would insert the name attribute only if no name 39 * For example, $name= would insert the name attribute only if no name
40 * attribute had been inserted previously. 40 * attribute had been inserted previously.
41 * @param {!cursors.Range} range 41 * @param {!cursors.Range} range
42 * @param {cursors.Range} prevRange 42 * @param {cursors.Range} prevRange
43 * @param {chrome.automation.EventType|Output.EventType} type 43 * @param {chrome.automation.EventType|Output.EventType} type
44 * @param {{braille: (boolean|undefined), speech: (boolean|undefined)}=}
45 * opt_options
46 * @constructor 44 * @constructor
47 */ 45 */
48 Output = function(range, prevRange, type, opt_options) { 46 Output = function(range, prevRange, type) {
49 opt_options = opt_options || {braille: true, speech: true};
50 // TODO(dtseng): Include braille specific rules. 47 // TODO(dtseng): Include braille specific rules.
51 /** @type {!cvox.Spannable} */ 48 /** @type {!cvox.Spannable} */
52 this.buffer_ = new cvox.Spannable(); 49 this.buffer_ = new cvox.Spannable();
53 /** @type {!cvox.Spannable} */ 50 /** @type {!cvox.Spannable} */
54 this.brailleBuffer_ = new cvox.Spannable(); 51 this.brailleBuffer_ = new cvox.Spannable();
55 /** @type {!Array.<Object>} */ 52 /** @type {!Array.<Object>} */
56 this.locations_ = []; 53 this.locations_ = [];
57 54
58 /** 55 /**
59 * Current global options. 56 * Current global options.
60 * @type {{speech: boolean, braille: boolean, location: boolean}} 57 * @type {{speech: boolean, braille: boolean, location: boolean}}
61 */ 58 */
62 this.formatOptions_ = {speech: true, braille: false, location: true}; 59 this.formatOptions_ = {speech: true, braille: false, location: true};
63 60
64 this.render_(range, prevRange, type); 61 this.render_(range, prevRange, type);
65 if (opt_options.speech) 62 this.handleSpeech();
66 this.handleSpeech(); 63 this.handleBraille();
67 if (opt_options.braille)
68 this.handleBraille();
69 this.handleDisplay(); 64 this.handleDisplay();
70 }; 65 };
71 66
72 /** 67 /**
73 * Delimiter to use between output values. 68 * Delimiter to use between output values.
74 * @type {string} 69 * @type {string}
75 */ 70 */
76 Output.SPACE = ' '; 71 Output.SPACE = ' ';
77 72
78 /** 73 /**
(...skipping 12 matching lines...) Expand all
91 button: { 86 button: {
92 speak: '$name $earcon(BUTTON, @tag_button)' 87 speak: '$name $earcon(BUTTON, @tag_button)'
93 }, 88 },
94 checkBox: { 89 checkBox: {
95 speak: '$or($checked, @describe_checkbox_checked($name), ' + 90 speak: '$or($checked, @describe_checkbox_checked($name), ' +
96 '@describe_checkbox_unchecked($name)) ' + 91 '@describe_checkbox_unchecked($name)) ' +
97 '$or($checked, ' + 92 '$or($checked, ' +
98 '$earcon(CHECK_ON, @input_type_checkbox), ' + 93 '$earcon(CHECK_ON, @input_type_checkbox), ' +
99 '$earcon(CHECK_OFF, @input_type_checkbox))' 94 '$earcon(CHECK_OFF, @input_type_checkbox))'
100 }, 95 },
101 dialog: {
102 enter: '$name $role'
103 },
104 heading: { 96 heading: {
105 enter: '@aria_role_heading', 97 enter: '@aria_role_heading',
106 speak: '@aria_role_heading $name=' 98 speak: '@aria_role_heading $name='
107 }, 99 },
108 inlineTextBox: { 100 inlineTextBox: {
109 speak: '$value=' 101 speak: '$value='
110 }, 102 },
111 link: { 103 link: {
112 enter: '$name= $visited $earcon(LINK, @tag_link)=', 104 enter: '$name= $visited $earcon(LINK, @tag_link)=',
113 stay: '$name= $visited @tag_link', 105 stay: '$name= $visited @tag_link',
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 }, 140 },
149 textBox: { 141 textBox: {
150 speak: '$name $value $earcon(EDITABLE_TEXT, @input_type_text)' 142 speak: '$name $value $earcon(EDITABLE_TEXT, @input_type_text)'
151 }, 143 },
152 tab: { 144 tab: {
153 speak: '@describe_tab($name)' 145 speak: '@describe_tab($name)'
154 }, 146 },
155 textField: { 147 textField: {
156 speak: '$name $value $earcon(EDITABLE_TEXT, @input_type_text)' 148 speak: '$name $value $earcon(EDITABLE_TEXT, @input_type_text)'
157 }, 149 },
158 toolbar: {
159 enter: '$name $role'
160 },
161 window: { 150 window: {
162 enter: '$name',
163 speak: '@describe_window($name) $earcon(OBJECT_OPEN)' 151 speak: '@describe_window($name) $earcon(OBJECT_OPEN)'
164 } 152 }
165 }, 153 },
166 menuStart: { 154 menuStart: {
167 'default': { 155 'default': {
168 speak: '@chrome_menu_opened($name) $role $earcon(OBJECT_OPEN)' 156 speak: '@chrome_menu_opened($name) $role $earcon(OBJECT_OPEN)'
169 } 157 }
170 }, 158 },
171 menuEnd: { 159 menuEnd: {
172 'default': { 160 'default': {
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 385
398 /** 386 /**
399 * @param {!cursors.Range} range 387 * @param {!cursors.Range} range
400 * @param {cursors.Range} prevRange 388 * @param {cursors.Range} prevRange
401 * @param {chrome.automation.EventType|string} type 389 * @param {chrome.automation.EventType|string} type
402 * @param {!cvox.Spannable} rangeBuff 390 * @param {!cvox.Spannable} rangeBuff
403 * @private 391 * @private
404 */ 392 */
405 range_: function(range, prevRange, type, rangeBuff) { 393 range_: function(range, prevRange, type, rangeBuff) {
406 if (!prevRange) 394 if (!prevRange)
407 prevRange = cursors.Range.fromNode(range.getStart().getNode().root); 395 prevRange = range;
408 396
409 var cursor = range.getStart(); 397 var cursor = range.getStart();
410 var prevNode = prevRange.getStart().getNode(); 398 var prevNode = prevRange.getStart().getNode();
411 399
412 var formatNodeAndAncestors = function(node, prevNode) { 400 var formatNodeAndAncestors = function(node, prevNode) {
413 var buff = new cvox.Spannable(); 401 var buff = new cvox.Spannable();
414 this.ancestry_(node, prevNode, type, buff); 402 this.ancestry_(node, prevNode, type, buff);
415 this.node_(node, prevNode, type, buff); 403 this.node_(node, prevNode, type, buff);
416 if (this.formatOptions_.location) 404 if (this.formatOptions_.location)
417 this.locations_.push(node.location); 405 this.locations_.push(node.location);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 561 }
574 562
575 if (currentNode != root) 563 if (currentNode != root)
576 throw 'Unbalanced parenthesis.'; 564 throw 'Unbalanced parenthesis.';
577 565
578 return root; 566 return root;
579 } 567 }
580 }; 568 };
581 569
582 }); // goog.scope 570 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698