| 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 'url': 'input_type_url', | 370 'url': 'input_type_url', |
| 371 }; | 371 }; |
| 372 | 372 |
| 373 /** | 373 /** |
| 374 * Rules specifying format of AutomationNodes for output. | 374 * Rules specifying format of AutomationNodes for output. |
| 375 * @type {!Object<Object<Object<string>>>} | 375 * @type {!Object<Object<Object<string>>>} |
| 376 */ | 376 */ |
| 377 Output.RULES = { | 377 Output.RULES = { |
| 378 navigate: { | 378 navigate: { |
| 379 'default': { | 379 'default': { |
| 380 speak: '$name $value $help $role', | 380 speak: '$name $value $role $description', |
| 381 braille: '' | 381 braille: '' |
| 382 }, | 382 }, |
| 383 abstractContainer: { | 383 abstractContainer: { |
| 384 enter: '$name $role', | 384 enter: '$name $role $description', |
| 385 leave: '@exited_container($role)' | 385 leave: '@exited_container($role)' |
| 386 }, | 386 }, |
| 387 alert: { | 387 alert: { |
| 388 speak: '!doNotInterrupt $role $descendants' | 388 speak: '!doNotInterrupt $role $descendants' |
| 389 }, | 389 }, |
| 390 alertDialog: { | 390 alertDialog: { |
| 391 enter: '$name $role $descendants' | 391 enter: '$name $role $description $descendants' |
| 392 }, | 392 }, |
| 393 cell: { | 393 cell: { |
| 394 enter: '@column_granularity $tableCellColumnIndex' | 394 enter: '@column_granularity $tableCellColumnIndex' |
| 395 }, | 395 }, |
| 396 checkBox: { | 396 checkBox: { |
| 397 speak: '$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) ' + | 397 speak: '$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) ' + |
| 398 '$name $role $checked' | 398 '$name $role $checked $description' |
| 399 }, | 399 }, |
| 400 dialog: { | 400 dialog: { |
| 401 enter: '$name $role' | 401 enter: '$name $role $description' |
| 402 }, | 402 }, |
| 403 div: { | 403 div: { |
| 404 enter: '$name', | 404 enter: '$name', |
| 405 speak: '$name' | 405 speak: '$name $description' |
| 406 }, | 406 }, |
| 407 grid: { | 407 grid: { |
| 408 enter: '$name $role' | 408 enter: '$name $role $description' |
| 409 }, | 409 }, |
| 410 heading: { | 410 heading: { |
| 411 enter: '@tag_h+$hierarchicalLevel', | 411 enter: '@tag_h+$hierarchicalLevel', |
| 412 speak: '@tag_h+$hierarchicalLevel $nameOrDescendants=' | 412 speak: '@tag_h+$hierarchicalLevel $nameOrDescendants=' |
| 413 }, | 413 }, |
| 414 inlineTextBox: { | 414 inlineTextBox: { |
| 415 speak: '$value=' | 415 speak: '$name=' |
| 416 }, | 416 }, |
| 417 link: { | 417 link: { |
| 418 enter: '$name $if($visited, @visited_link, $role)', | 418 enter: '$name $if($visited, @visited_link, $role)', |
| 419 stay: '$name= $if($visited, @visited_link, $role)', | 419 stay: '$name= $if($visited, @visited_link, $role)', |
| 420 speak: '$name= $if($visited, @visited_link, $role)' | 420 speak: '$name= $if($visited, @visited_link, $role) $description' |
| 421 }, | 421 }, |
| 422 list: { | 422 list: { |
| 423 enter: '$role @@list_with_items($countChildren(listItem))' | 423 enter: '$role @@list_with_items($countChildren(listItem))' |
| 424 }, | 424 }, |
| 425 listBox: { | 425 listBox: { |
| 426 enter: '$name $role @@list_with_items($countChildren(listBoxOption))' | 426 enter: '$name $role @@list_with_items($countChildren(listBoxOption)) ' + |
| 427 '$description' |
| 427 }, | 428 }, |
| 428 listBoxOption: { | 429 listBoxOption: { |
| 429 speak: '$name $role @describe_index($indexInParent, $parentChildCount)' | 430 speak: '$name $role @describe_index($indexInParent, $parentChildCount) ' + |
| 431 '$description' |
| 430 }, | 432 }, |
| 431 listItem: { | 433 listItem: { |
| 432 enter: '$role' | 434 enter: '$role' |
| 433 }, | 435 }, |
| 434 menu: { | 436 menu: { |
| 435 enter: '$name $role @@list_with_items($countChildren(menuItem))' | 437 enter: '$name $role @@list_with_items($countChildren(menuItem)) ' + |
| 438 '$description' |
| 436 }, | 439 }, |
| 437 menuItem: { | 440 menuItem: { |
| 438 speak: '$name $role $if($haspopup, @has_submenu) ' + | 441 speak: '$name $role $if($haspopup, @has_submenu) ' + |
| 439 '@describe_index($indexInParent, $parentChildCount)' | 442 '@describe_index($indexInParent, $parentChildCount) ' + |
| 443 '$description' |
| 440 }, | 444 }, |
| 441 menuListOption: { | 445 menuListOption: { |
| 442 speak: '$name $value @role_menuitem ' + | 446 speak: '$name @role_menuitem ' + |
| 443 '@describe_index($indexInParent, $parentChildCount)' | 447 '@describe_index($indexInParent, $parentChildCount) $description' |
| 444 }, | 448 }, |
| 445 paragraph: { | 449 paragraph: { |
| 446 speak: '$descendants' | 450 speak: '$descendants' |
| 447 }, | 451 }, |
| 448 popUpButton: { | 452 popUpButton: { |
| 449 speak: '$earcon(POP_UP_BUTTON) $value $name $role @aria_has_popup ' + | 453 speak: '$earcon(POP_UP_BUTTON) $value $name $role @aria_has_popup ' + |
| 450 '$if($collapsed, @aria_expanded_false, @aria_expanded_true)' | 454 '$if($collapsed, @aria_expanded_false, @aria_expanded_true) ' + |
| 455 '$description' |
| 451 }, | 456 }, |
| 452 radioButton: { | 457 radioButton: { |
| 453 speak: '$if($checked, @describe_radio_selected($name), ' + | 458 speak: '$if($checked, @describe_radio_selected($name), ' + |
| 454 '@describe_radio_unselected($name))' | 459 '@describe_radio_unselected($name)) $description' |
| 455 }, | 460 }, |
| 456 radioGroup: { | 461 radioGroup: { |
| 457 enter: '$name $role' | 462 enter: '$name $role $description' |
| 458 }, | 463 }, |
| 459 rootWebArea: { | 464 rootWebArea: { |
| 460 enter: '$name' | 465 enter: '$name' |
| 461 }, | 466 }, |
| 462 row: { | 467 row: { |
| 463 enter: '@row_granularity $tableRowIndex' | 468 enter: '@row_granularity $tableRowIndex' |
| 464 }, | 469 }, |
| 465 slider: { | 470 slider: { |
| 466 speak: '$earcon(SLIDER) @describe_slider($value, $name) $help' | 471 speak: '$earcon(SLIDER) @describe_slider($value, $name) $description' |
| 467 }, | 472 }, |
| 468 staticText: { | 473 staticText: { |
| 469 speak: '$value=' | 474 speak: '$name=' |
| 470 }, | 475 }, |
| 471 tab: { | 476 tab: { |
| 472 speak: '@describe_tab($name)' | 477 speak: '@describe_tab($name)' |
| 473 }, | 478 }, |
| 474 textField: { | 479 textField: { |
| 475 speak: '$name $value $if(' + | 480 speak: '$name $value $if(' + |
| 476 '$inputType, $inputType, $role)', | 481 '$inputType, $inputType, $role) $description', |
| 477 braille: '' | 482 braille: '' |
| 478 }, | 483 }, |
| 479 toolbar: { | 484 toolbar: { |
| 480 enter: '$name $role' | 485 enter: '$name $role $description' |
| 481 }, | 486 }, |
| 482 tree: { | 487 tree: { |
| 483 enter: '$name $role @@list_with_items($countChildren(treeItem))' | 488 enter: '$name $role @@list_with_items($countChildren(treeItem))' |
| 484 }, | 489 }, |
| 485 treeItem: { | 490 treeItem: { |
| 486 enter: '$role $expanded $collapsed ' + | 491 enter: '$role $expanded $collapsed ' + |
| 487 '@describe_index($indexInParent, $parentChildCount) ' + | 492 '@describe_index($indexInParent, $parentChildCount) ' + |
| 488 '@describe_depth($hierarchicalLevel)' | 493 '@describe_depth($hierarchicalLevel)' |
| 489 }, | 494 }, |
| 490 window: { | 495 window: { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 505 menuListValueChanged: { | 510 menuListValueChanged: { |
| 506 'default': { | 511 'default': { |
| 507 speak: '$value $name ' + | 512 speak: '$value $name ' + |
| 508 '$find({"state": {"selected": true, "invisible": false}}, ' + | 513 '$find({"state": {"selected": true, "invisible": false}}, ' + |
| 509 '@describe_index($indexInParent, $parentChildCount)) ' | 514 '@describe_index($indexInParent, $parentChildCount)) ' |
| 510 } | 515 } |
| 511 }, | 516 }, |
| 512 alert: { | 517 alert: { |
| 513 default: { | 518 default: { |
| 514 speak: '!doNotInterrupt ' + | 519 speak: '!doNotInterrupt ' + |
| 515 '@role_alert $name $earcon(ALERT_NONMODAL) $descendants' | 520 '@role_alert $name $earcon(ALERT_NONMODAL) $description $descendants' |
| 516 } | 521 } |
| 517 } | 522 } |
| 518 }; | 523 }; |
| 519 | 524 |
| 520 /** | 525 /** |
| 521 * Custom actions performed while rendering an output string. | 526 * Custom actions performed while rendering an output string. |
| 522 * @constructor | 527 * @constructor |
| 523 */ | 528 */ |
| 524 Output.Action = function() { | 529 Output.Action = function() { |
| 525 }; | 530 }; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 835 while (earconFinder) { | 840 while (earconFinder) { |
| 836 var info = Output.ROLE_INFO_[earconFinder.role]; | 841 var info = Output.ROLE_INFO_[earconFinder.role]; |
| 837 if (info && info.earconId) { | 842 if (info && info.earconId) { |
| 838 options.annotation.push( | 843 options.annotation.push( |
| 839 new Output.EarconAction(info.earconId)); | 844 new Output.EarconAction(info.earconId)); |
| 840 break; | 845 break; |
| 841 } | 846 } |
| 842 earconFinder = earconFinder.parent; | 847 earconFinder = earconFinder.parent; |
| 843 } | 848 } |
| 844 } | 849 } |
| 845 | 850 this.append_(buff, node.name, options); |
| 846 // Pending finalization of name calculation; we must use the | |
| 847 // description property to access aria-label. See crbug.com/473220. | |
| 848 var resolvedName = node.description || node.name; | |
| 849 this.append_(buff, resolvedName, options); | |
| 850 } else if (token == 'nameOrDescendants') { | 851 } else if (token == 'nameOrDescendants') { |
| 851 options.annotation.push(token); | 852 options.annotation.push(token); |
| 852 if (node.name) | 853 if (node.name) |
| 853 this.append_(buff, node.name, options); | 854 this.append_(buff, node.name, options); |
| 854 else | 855 else |
| 855 this.format_(node, '$descendants', buff); | 856 this.format_(node, '$descendants', buff); |
| 856 } else if (token == 'indexInParent') { | 857 } else if (token == 'indexInParent') { |
| 857 options.annotation.push(token); | 858 options.annotation.push(token); |
| 858 this.append_(buff, String(node.indexInParent + 1)); | 859 this.append_(buff, String(node.indexInParent + 1)); |
| 859 } else if (token == 'parentChildCount') { | 860 } else if (token == 'parentChildCount') { |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1321 elem.end); | 1322 elem.end); |
| 1322 }); | 1323 }); |
| 1323 spansToRemove.forEach(result.removeSpan.bind(result)); | 1324 spansToRemove.forEach(result.removeSpan.bind(result)); |
| 1324 separator = Output.SPACE; | 1325 separator = Output.SPACE; |
| 1325 }); | 1326 }); |
| 1326 return result; | 1327 return result; |
| 1327 } | 1328 } |
| 1328 }; | 1329 }; |
| 1329 | 1330 |
| 1330 }); // goog.scope | 1331 }); // goog.scope |
| OLD | NEW |