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

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

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

Powered by Google App Engine
This is Rietveld 408576698