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

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

Issue 2507063007: Use aria range values for sliders (Closed)
Patch Set: Rebase Created 3 years, 11 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
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 }, 247 },
248 menuItemRadio: { 248 menuItemRadio: {
249 msgId: 'role_menuitemradio' 249 msgId: 'role_menuitemradio'
250 }, 250 },
251 menuListOption: { 251 menuListOption: {
252 msgId: 'role_menuitem' 252 msgId: 'role_menuitem'
253 }, 253 },
254 menuListPopup: { 254 menuListPopup: {
255 msgId: 'role_menu' 255 msgId: 'role_menu'
256 }, 256 },
257 meter: {
258 msgId: 'role_meter',
259 inherits: 'abstractRange'
260 },
257 navigation: { 261 navigation: {
258 msgId: 'role_navigation', 262 msgId: 'role_navigation',
259 inherits: 'abstractContainer' 263 inherits: 'abstractContainer'
260 }, 264 },
261 note: { 265 note: {
262 msgId: 'role_note', 266 msgId: 'role_note',
263 inherits: 'abstractContainer' 267 inherits: 'abstractContainer'
264 }, 268 },
269 progressIndicator: {
270 msgId: 'role_progress_indicator',
271 inherits: 'abstractRange'
272 },
265 popUpButton: { 273 popUpButton: {
266 msgId: 'role_button', 274 msgId: 'role_button',
267 earconId: 'POP_UP_BUTTON' 275 earconId: 'POP_UP_BUTTON'
268 }, 276 },
269 radioButton: { 277 radioButton: {
270 msgId: 'role_radio' 278 msgId: 'role_radio'
271 }, 279 },
272 radioGroup: { 280 radioGroup: {
273 msgId: 'role_radiogroup', 281 msgId: 'role_radiogroup',
274 }, 282 },
275 rootWebArea: { 283 rootWebArea: {
276 outputContextFirst: true 284 outputContextFirst: true
277 }, 285 },
278 row: { 286 row: {
279 msgId: 'role_row', 287 msgId: 'role_row',
280 inherits: 'abstractContainer' 288 inherits: 'abstractContainer'
281 }, 289 },
282 rowHeader: { 290 rowHeader: {
283 msgId: 'role_rowheader', 291 msgId: 'role_rowheader',
284 inherits: 'cell' 292 inherits: 'cell'
285 }, 293 },
286 scrollBar: { 294 scrollBar: {
287 msgId: 'role_scrollbar', 295 msgId: 'role_scrollbar',
296 inherits: 'abstractRange'
288 }, 297 },
289 search: { 298 search: {
290 msgId: 'role_search', 299 msgId: 'role_search',
291 inherits: 'abstractContainer' 300 inherits: 'abstractContainer'
292 }, 301 },
293 separator: { 302 separator: {
294 msgId: 'role_separator', 303 msgId: 'role_separator',
295 inherits: 'abstractContainer' 304 inherits: 'abstractContainer'
296 }, 305 },
306 slider: {
307 msgId: 'role_slider',
308 inherits: 'abstractRange',
309 earconId: 'SLIDER'
310 },
297 spinButton: { 311 spinButton: {
298 msgId: 'role_spinbutton', 312 msgId: 'role_spinbutton',
313 inherits: 'abstractRange',
299 earconId: 'LISTBOX' 314 earconId: 'LISTBOX'
300 }, 315 },
301 status: { 316 status: {
302 msgId: 'role_status' 317 msgId: 'role_status'
303 }, 318 },
304 tab: { 319 tab: {
305 msgId: 'role_tab' 320 msgId: 'role_tab'
306 }, 321 },
307 tabList: { 322 tabList: {
308 msgId: 'role_tablist' 323 msgId: 'role_tablist'
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 Output.RULES = { 404 Output.RULES = {
390 navigate: { 405 navigate: {
391 'default': { 406 'default': {
392 speak: '$name $value $state $role $description', 407 speak: '$name $value $state $role $description',
393 braille: '' 408 braille: ''
394 }, 409 },
395 abstractContainer: { 410 abstractContainer: {
396 enter: '$nameFromNode $role $state $description', 411 enter: '$nameFromNode $role $state $description',
397 leave: '@exited_container($role)' 412 leave: '@exited_container($role)'
398 }, 413 },
414 abstractRange: {
415 speak:
416 '$if($valueForRange, $valueForRange, $value) ' +
417 '$if($minValueForRange, @aria_value_min($minValueForRange)) ' +
418 '$if($maxValueForRange, @aria_value_max($maxValueForRange)) ' +
419 '$name $role $description $state'
420 },
399 alert: { 421 alert: {
400 enter: '$name $role $state', 422 enter: '$name $role $state',
401 speak: '$earcon(ALERT_NONMODAL) $role $nameOrTextContent $state' 423 speak: '$earcon(ALERT_NONMODAL) $role $nameOrTextContent $state'
402 }, 424 },
403 alertDialog: { 425 alertDialog: {
404 enter: '$earcon(ALERT_MODAL) $name $state', 426 enter: '$earcon(ALERT_MODAL) $name $state',
405 speak: '$earcon(ALERT_MODAL) $name $nameOrTextContent $state $role' 427 speak: '$earcon(ALERT_MODAL) $name $nameOrTextContent $state $role'
406 }, 428 },
407 cell: { 429 cell: {
408 enter: '@cell_summary($tableCellRowIndex, $tableCellColumnIndex) ' + 430 enter: '@cell_summary($tableCellRowIndex, $tableCellColumnIndex) ' +
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 }, 542 },
521 region: { 543 region: {
522 speak: '$nameOrTextContent' 544 speak: '$nameOrTextContent'
523 }, 545 },
524 row: { 546 row: {
525 enter: '$node(tableRowHeader)' 547 enter: '$node(tableRowHeader)'
526 }, 548 },
527 rowHeader: { 549 rowHeader: {
528 speak: '$nameOrTextContent $state' 550 speak: '$nameOrTextContent $state'
529 }, 551 },
530 slider: {
531 speak: '$earcon(SLIDER) @describe_slider($value, $name) $description ' +
532 '$state'
533 },
534 staticText: { 552 staticText: {
535 speak: '$name=' 553 speak: '$name='
536 }, 554 },
537 switch: { 555 switch: {
538 speak: '$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) ' + 556 speak: '$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) ' +
539 '$if($checked, @describe_switch_on($name), ' + 557 '$if($checked, @describe_switch_on($name), ' +
540 '@describe_switch_off($name)) $description $state' 558 '@describe_switch_off($name)) $description $state'
541 }, 559 },
542 tab: { 560 tab: {
543 speak: '@describe_tab($name) $state $description ' + 561 speak: '@describe_tab($name) $state $description ' +
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 this.append_(buff, selectedText, options); 1089 this.append_(buff, selectedText, options);
1072 this.append_(buff, Msgs.getMsg('selected')); 1090 this.append_(buff, Msgs.getMsg('selected'));
1073 } else { 1091 } else {
1074 this.append_(buff, text, options); 1092 this.append_(buff, text, options);
1075 } 1093 }
1076 } else if (token == 'name') { 1094 } else if (token == 'name') {
1077 options.annotation.push(token); 1095 options.annotation.push(token);
1078 var earcon = node ? this.findEarcon_(node, opt_prevNode) : null; 1096 var earcon = node ? this.findEarcon_(node, opt_prevNode) : null;
1079 if (earcon) 1097 if (earcon)
1080 options.annotation.push(earcon); 1098 options.annotation.push(earcon);
1081 this.append_(buff, node.name, options); 1099 this.append_(buff, node.name || '', options);
1100 } else if (token == 'description') {
1101 if (node.name == node.description)
1102 return;
1103
1104 options.annotation.push(token);
1105 this.append_(buff, node.description || '', options);
1082 } else if (token == 'urlFilename') { 1106 } else if (token == 'urlFilename') {
1083 options.annotation.push('name'); 1107 options.annotation.push('name');
1084 var url = node.url; 1108 var url = node.url;
1085 var filename = ''; 1109 var filename = '';
1086 if (url.substring(0, 4) != 'data') { 1110 if (url.substring(0, 4) != 'data') {
1087 filename = 1111 filename =
1088 url.substring(url.lastIndexOf('/') + 1, url.lastIndexOf('.')); 1112 url.substring(url.lastIndexOf('/') + 1, url.lastIndexOf('.'));
1089 1113
1090 // Hack to not speak the filename if it's ridiculously long. 1114 // Hack to not speak the filename if it's ridiculously long.
1091 if (filename.length >= 30) 1115 if (filename.length >= 30)
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 var msgId = 1290 var msgId =
1267 this.formatOptions_.braille ? resolvedInfo.msgId + '_brl' : 1291 this.formatOptions_.braille ? resolvedInfo.msgId + '_brl' :
1268 resolvedInfo.msgId; 1292 resolvedInfo.msgId;
1269 var msg = Msgs.getMsg(msgId); 1293 var msg = Msgs.getMsg(msgId);
1270 this.append_(buff, msg, options); 1294 this.append_(buff, msg, options);
1271 } else if (tree.firstChild) { 1295 } else if (tree.firstChild) {
1272 // Custom functions. 1296 // Custom functions.
1273 if (token == 'if') { 1297 if (token == 'if') {
1274 var cond = tree.firstChild; 1298 var cond = tree.firstChild;
1275 var attrib = cond.value.slice(1); 1299 var attrib = cond.value.slice(1);
1276 if (node[attrib] || node.state[attrib]) 1300 if (node[attrib] !== undefined || node.state[attrib])
1277 this.format_(node, cond.nextSibling, buff); 1301 this.format_(node, cond.nextSibling, buff);
1278 else 1302 else
1279 this.format_(node, cond.nextSibling.nextSibling, buff); 1303 this.format_(node, cond.nextSibling.nextSibling, buff);
1280 } else if (token == 'earcon') { 1304 } else if (token == 'earcon') {
1281 // Ignore unless we're generating speech output. 1305 // Ignore unless we're generating speech output.
1282 if (!this.formatOptions_.speech) 1306 if (!this.formatOptions_.speech)
1283 return; 1307 return;
1284 1308
1285 options.annotation.push( 1309 options.annotation.push(
1286 new Output.EarconAction(tree.firstChild.value, node.location)); 1310 new Output.EarconAction(tree.firstChild.value, node.location));
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 /** 1871 /**
1848 * Gets the output buffer for braille. 1872 * Gets the output buffer for braille.
1849 * @return {!Spannable} 1873 * @return {!Spannable}
1850 */ 1874 */
1851 get brailleOutputForTest() { 1875 get brailleOutputForTest() {
1852 return this.mergeBraille_(this.brailleBuffer_); 1876 return this.mergeBraille_(this.brailleBuffer_);
1853 } 1877 }
1854 }; 1878 };
1855 1879
1856 }); // goog.scope 1880 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698