| 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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 350 } |
| 351 }, | 351 }, |
| 352 visited: { | 352 visited: { |
| 353 on: { | 353 on: { |
| 354 msgId: 'visited_state' | 354 msgId: 'visited_state' |
| 355 } | 355 } |
| 356 } | 356 } |
| 357 }; | 357 }; |
| 358 | 358 |
| 359 /** | 359 /** |
| 360 * Maps input types to message IDs. |
| 361 * @const {Object<string>} |
| 362 * @private |
| 363 */ |
| 364 Output.INPUT_TYPE_MESSAGE_IDS_ = { |
| 365 'email': 'input_type_email', |
| 366 'file': 'input_type_file', |
| 367 'number': 'input_type_number', |
| 368 'password': 'input_type_password', |
| 369 'search': 'input_type_search', |
| 370 'tel': 'input_type_tel', |
| 371 'text': 'input_type_text', |
| 372 'url': 'input_type_url', |
| 373 }; |
| 374 |
| 375 /** |
| 360 * Rules specifying format of AutomationNodes for output. | 376 * Rules specifying format of AutomationNodes for output. |
| 361 * @type {!Object<Object<Object<string>>>} | 377 * @type {!Object<Object<Object<string>>>} |
| 362 */ | 378 */ |
| 363 Output.RULES = { | 379 Output.RULES = { |
| 364 navigate: { | 380 navigate: { |
| 365 'default': { | 381 'default': { |
| 366 speak: '$name $value $help $role', | 382 speak: '$name $value $help $role', |
| 367 braille: '' | 383 braille: '' |
| 368 }, | 384 }, |
| 369 abstractContainer: { | 385 abstractContainer: { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 speak: '@describe_slider($value, $name) $help' | 467 speak: '@describe_slider($value, $name) $help' |
| 452 }, | 468 }, |
| 453 staticText: { | 469 staticText: { |
| 454 speak: '$value=' | 470 speak: '$value=' |
| 455 }, | 471 }, |
| 456 tab: { | 472 tab: { |
| 457 speak: '@describe_tab($name)' | 473 speak: '@describe_tab($name)' |
| 458 }, | 474 }, |
| 459 textField: { | 475 textField: { |
| 460 speak: '$name $value $if(' + | 476 speak: '$name $value $if(' + |
| 461 '$inputType, @input_type_+$inputType, @input_type_text)', | 477 '$inputType, $inputType, $role)', |
| 462 braille: '' | 478 braille: '' |
| 463 }, | 479 }, |
| 464 toolbar: { | 480 toolbar: { |
| 465 enter: '$name $role' | 481 enter: '$name $role' |
| 466 }, | 482 }, |
| 467 tree: { | 483 tree: { |
| 468 enter: '$name $role @@list_with_items($countChildren(treeItem))' | 484 enter: '$name $role @@list_with_items($countChildren(treeItem))' |
| 469 }, | 485 }, |
| 470 treeItem: { | 486 treeItem: { |
| 471 enter: '$role $expanded $collapsed ' + | 487 enter: '$role $expanded $collapsed ' + |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 var info = Output.ROLE_INFO_[node.role]; | 895 var info = Output.ROLE_INFO_[node.role]; |
| 880 if (info) { | 896 if (info) { |
| 881 if (this.formatOptions_.braille) | 897 if (this.formatOptions_.braille) |
| 882 msg = cvox.ChromeVox.msgs.getMsg(info.msgId + '_brl'); | 898 msg = cvox.ChromeVox.msgs.getMsg(info.msgId + '_brl'); |
| 883 else | 899 else |
| 884 msg = cvox.ChromeVox.msgs.getMsg(info.msgId); | 900 msg = cvox.ChromeVox.msgs.getMsg(info.msgId); |
| 885 } else { | 901 } else { |
| 886 console.error('Missing role info for ' + node.role); | 902 console.error('Missing role info for ' + node.role); |
| 887 } | 903 } |
| 888 this.append_(buff, msg, options); | 904 this.append_(buff, msg, options); |
| 905 } else if (token == 'inputType') { |
| 906 if (!node.inputType) |
| 907 return; |
| 908 options.annotation.push(token); |
| 909 var msgId = Output.INPUT_TYPE_MESSAGE_IDS_[node.inputType] || |
| 910 'input_type_text'; |
| 911 if (this.formatOptions_.braille) |
| 912 msgId = msgId + '_brl'; |
| 913 this.append_(buff, cvox.ChromeVox.msgs.getMsg(msgId), options); |
| 889 } else if (token == 'tableRowIndex' || | 914 } else if (token == 'tableRowIndex' || |
| 890 token == 'tableCellColumnIndex') { | 915 token == 'tableCellColumnIndex') { |
| 891 var value = node[token]; | 916 var value = node[token]; |
| 892 if (!value) | 917 if (!value) |
| 893 return; | 918 return; |
| 894 value = String(value + 1); | 919 value = String(value + 1); |
| 895 options.annotation.push(token); | 920 options.annotation.push(token); |
| 896 this.append_(buff, value, options); | 921 this.append_(buff, value, options); |
| 897 } else if (node[token] !== undefined) { | 922 } else if (node[token] !== undefined) { |
| 898 options.annotation.push(token); | 923 options.annotation.push(token); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 elem.end); | 1321 elem.end); |
| 1297 }); | 1322 }); |
| 1298 spansToRemove.forEach(result.removeSpan.bind(result)); | 1323 spansToRemove.forEach(result.removeSpan.bind(result)); |
| 1299 separator = Output.SPACE; | 1324 separator = Output.SPACE; |
| 1300 }); | 1325 }); |
| 1301 return result; | 1326 return result; |
| 1302 } | 1327 } |
| 1303 }; | 1328 }; |
| 1304 | 1329 |
| 1305 }); // goog.scope | 1330 }); // goog.scope |
| OLD | NEW |