OLD | NEW |
---|---|
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
155 */ | 155 */ |
156 Output.RULES = { | 156 Output.RULES = { |
157 navigate: { | 157 navigate: { |
158 'default': { | 158 'default': { |
159 speak: '$name $value $role', | 159 speak: '$name $value $role', |
160 braille: '' | 160 braille: '' |
161 }, | 161 }, |
162 alert: { | 162 alert: { |
163 speak: '!doNotInterrupt $role $descendants' | 163 speak: '!doNotInterrupt $role $descendants' |
164 }, | 164 }, |
165 button: { | |
166 speak: '$name $value $description $role', | |
dmazzoni
2015/04/24 13:41:08
As suggested in the other CL, how about:
$name $d
| |
167 }, | |
165 checkBox: { | 168 checkBox: { |
166 speak: '$name $role $checked' | 169 speak: '$name $role $checked' |
167 }, | 170 }, |
168 dialog: { | 171 dialog: { |
169 enter: '$name $role' | 172 enter: '$name $role' |
170 }, | 173 }, |
171 heading: { | 174 heading: { |
172 enter: '@tag_h+$hierarchicalLevel', | 175 enter: '@tag_h+$hierarchicalLevel', |
173 speak: '@tag_h+$hierarchicalLevel $name=' | 176 speak: '@tag_h+$hierarchicalLevel $name=' |
174 }, | 177 }, |
(...skipping 25 matching lines...) Expand all Loading... | |
200 }, | 203 }, |
201 popUpButton: { | 204 popUpButton: { |
202 speak: '$value $name $role @aria_has_popup ' + | 205 speak: '$value $name $role @aria_has_popup ' + |
203 '$if($collapsed, @aria_expanded_false, @aria_expanded_true)' | 206 '$if($collapsed, @aria_expanded_false, @aria_expanded_true)' |
204 }, | 207 }, |
205 radioButton: { | 208 radioButton: { |
206 speak: '$if($checked, @describe_radio_selected($name), ' + | 209 speak: '$if($checked, @describe_radio_selected($name), ' + |
207 '@describe_radio_unselected($name))' | 210 '@describe_radio_unselected($name))' |
208 }, | 211 }, |
209 slider: { | 212 slider: { |
210 speak: '@describe_slider($value, $name)' | 213 speak: '@describe_slider($value, $name) $help' |
211 }, | 214 }, |
212 staticText: { | 215 staticText: { |
213 speak: '$value $name' | 216 speak: '$value $name' |
214 }, | 217 }, |
215 tab: { | 218 tab: { |
216 speak: '@describe_tab($name)' | 219 speak: '@describe_tab($name)' |
217 }, | 220 }, |
218 toolbar: { | 221 toolbar: { |
219 enter: '$name $role' | 222 enter: '$name $role' |
220 }, | 223 }, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 * Possible events handled by ChromeVox internally. | 299 * Possible events handled by ChromeVox internally. |
297 * @enum {string} | 300 * @enum {string} |
298 */ | 301 */ |
299 Output.EventType = { | 302 Output.EventType = { |
300 NAVIGATE: 'navigate' | 303 NAVIGATE: 'navigate' |
301 }; | 304 }; |
302 | 305 |
303 Output.prototype = { | 306 Output.prototype = { |
304 /** | 307 /** |
305 * Gets the output buffer for speech. | 308 * Gets the output buffer for speech. |
309 * @param {string=} opt_separator Used to join components of the output. | |
306 * @return {!cvox.Spannable} | 310 * @return {!cvox.Spannable} |
307 */ | 311 */ |
308 toSpannable: function() { | 312 toSpannable: function(opt_separator) { |
313 opt_separator = opt_separator || ''; | |
309 return this.buffer_.reduce(function(prev, cur) { | 314 return this.buffer_.reduce(function(prev, cur) { |
315 if (prev === null) | |
316 return cur; | |
317 prev.append(opt_separator); | |
310 prev.append(cur); | 318 prev.append(cur); |
311 return prev; | 319 return prev; |
312 }, new cvox.Spannable()); | 320 }, null); |
313 }, | 321 }, |
314 | 322 |
315 /** | 323 /** |
324 * Gets the output buffer for speech with separator '|'. | |
325 * @return {!cvox.Spannable} | |
326 */ | |
327 toSpannableForTest: function() { | |
328 return this.toSpannable('|'); | |
329 }, | |
330 | |
331 /** | |
316 * Specify ranges for speech. | 332 * Specify ranges for speech. |
317 * @param {!cursors.Range} range | 333 * @param {!cursors.Range} range |
318 * @param {cursors.Range} prevRange | 334 * @param {cursors.Range} prevRange |
319 * @param {chrome.automation.EventType|Output.EventType} type | 335 * @param {chrome.automation.EventType|Output.EventType} type |
320 * @return {!Output} | 336 * @return {!Output} |
321 */ | 337 */ |
322 withSpeech: function(range, prevRange, type) { | 338 withSpeech: function(range, prevRange, type) { |
323 this.formatOptions_ = {speech: true, braille: false, location: true}; | 339 this.formatOptions_ = {speech: true, braille: false, location: true}; |
324 this.render_(range, prevRange, type, this.buffer_); | 340 this.render_(range, prevRange, type, this.buffer_); |
325 return this; | 341 return this; |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
867 } | 883 } |
868 | 884 |
869 if (currentNode != root) | 885 if (currentNode != root) |
870 throw 'Unbalanced parenthesis.'; | 886 throw 'Unbalanced parenthesis.'; |
871 | 887 |
872 return root; | 888 return root; |
873 } | 889 } |
874 }; | 890 }; |
875 | 891 |
876 }); // goog.scope | 892 }); // goog.scope |
OLD | NEW |