| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 'url': 'input_type_url', | 397 'url': 'input_type_url', |
| 398 }; | 398 }; |
| 399 | 399 |
| 400 /** | 400 /** |
| 401 * Rules specifying format of AutomationNodes for output. | 401 * Rules specifying format of AutomationNodes for output. |
| 402 * @type {!Object<Object<Object<string>>>} | 402 * @type {!Object<Object<Object<string>>>} |
| 403 */ | 403 */ |
| 404 Output.RULES = { | 404 Output.RULES = { |
| 405 navigate: { | 405 navigate: { |
| 406 'default': { | 406 'default': { |
| 407 speak: '$name $value $role $description', | 407 speak: '$name $value $activeDescendant $role $description', |
| 408 braille: '' | 408 braille: '' |
| 409 }, | 409 }, |
| 410 abstractContainer: { | 410 abstractContainer: { |
| 411 enter: '$nameFromNode $role $description', | 411 enter: '$nameFromNode $role $description', |
| 412 leave: '@exited_container($role)' | 412 leave: '@exited_container($role)' |
| 413 }, | 413 }, |
| 414 alert: { | 414 alert: { |
| 415 speak: '!doNotInterrupt $role $descendants' | 415 speak: '!doNotInterrupt $role $descendants' |
| 416 }, | 416 }, |
| 417 alertDialog: { | 417 alertDialog: { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 }, | 457 }, |
| 458 listBoxOption: { | 458 listBoxOption: { |
| 459 speak: '$name $role @describe_index($indexInParent, $parentChildCount) ' + | 459 speak: '$name $role @describe_index($indexInParent, $parentChildCount) ' + |
| 460 '$description' | 460 '$description' |
| 461 }, | 461 }, |
| 462 listItem: { | 462 listItem: { |
| 463 enter: '$role' | 463 enter: '$role' |
| 464 }, | 464 }, |
| 465 menu: { | 465 menu: { |
| 466 enter: '$name $role', | 466 enter: '$name $role', |
| 467 speak: '$name $role @@list_with_items($countChildren(menuItem))' | 467 speak: '$name $activeDescendant ' + |
| 468 '$role @@list_with_items($countChildren(menuItem))' |
| 468 }, | 469 }, |
| 469 menuItem: { | 470 menuItem: { |
| 470 speak: '$name $role $if($haspopup, @has_submenu) ' + | 471 speak: '$name $role $if($haspopup, @has_submenu) ' + |
| 471 '@describe_index($indexInParent, $parentChildCount) ' + | 472 '@describe_index($indexInParent, $parentChildCount) ' + |
| 472 '$description' | 473 '$description' |
| 473 }, | 474 }, |
| 474 menuListOption: { | 475 menuListOption: { |
| 475 speak: '$name @role_menuitem ' + | 476 speak: '$name @role_menuitem ' + |
| 476 '@describe_index($indexInParent, $parentChildCount) $description' | 477 '@describe_index($indexInParent, $parentChildCount) $description' |
| 477 }, | 478 }, |
| 478 paragraph: { | 479 paragraph: { |
| 479 speak: '$descendants' | 480 speak: '$descendants' |
| 480 }, | 481 }, |
| 481 popUpButton: { | 482 popUpButton: { |
| 482 speak: '$value $name $role @aria_has_popup ' + | 483 speak: '$value $name $activeDescendant $role @aria_has_popup ' + |
| 483 '$if($collapsed, @aria_expanded_false, @aria_expanded_true) ' + | 484 '$if($collapsed, @aria_expanded_false, @aria_expanded_true) ' + |
| 484 '$description' | 485 '$description' |
| 485 }, | 486 }, |
| 486 radioButton: { | 487 radioButton: { |
| 487 speak: '$if($checked, @describe_radio_selected($name), ' + | 488 speak: '$if($checked, @describe_radio_selected($name), ' + |
| 488 '@describe_radio_unselected($name)) $description' | 489 '@describe_radio_unselected($name)) $description' |
| 489 }, | 490 }, |
| 490 radioGroup: { | 491 radioGroup: { |
| 491 enter: '$name $role $description' | 492 enter: '$name $role $description' |
| 492 }, | 493 }, |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 this.append_(buff, String(node.indexInParent + 1)); | 1036 this.append_(buff, String(node.indexInParent + 1)); |
| 1036 } else if (token == 'parentChildCount') { | 1037 } else if (token == 'parentChildCount') { |
| 1037 options.annotation.push(token); | 1038 options.annotation.push(token); |
| 1038 if (node.parent) | 1039 if (node.parent) |
| 1039 this.append_(buff, String(node.parent.children.length)); | 1040 this.append_(buff, String(node.parent.children.length)); |
| 1040 } else if (token == 'state') { | 1041 } else if (token == 'state') { |
| 1041 options.annotation.push(token); | 1042 options.annotation.push(token); |
| 1042 Object.getOwnPropertyNames(node.state).forEach(function(s) { | 1043 Object.getOwnPropertyNames(node.state).forEach(function(s) { |
| 1043 this.append_(buff, s, options); | 1044 this.append_(buff, s, options); |
| 1044 }.bind(this)); | 1045 }.bind(this)); |
| 1046 } else if (token == 'activeDescendant') { |
| 1047 if (node.activeDescendant) { |
| 1048 var prev = opt_prevNode || node.activeDescendant; |
| 1049 this.node_(node.activeDescendant, prev, |
| 1050 Output.EventType.NAVIGATE, buff); |
| 1051 } |
| 1045 } else if (token == 'find') { | 1052 } else if (token == 'find') { |
| 1046 // Find takes two arguments: JSON query string and format string. | 1053 // Find takes two arguments: JSON query string and format string. |
| 1047 if (tree.firstChild) { | 1054 if (tree.firstChild) { |
| 1048 var jsonQuery = tree.firstChild.value; | 1055 var jsonQuery = tree.firstChild.value; |
| 1049 node = node.find( | 1056 node = node.find( |
| 1050 /** @type {Object}*/(JSON.parse(jsonQuery))); | 1057 /** @type {Object}*/(JSON.parse(jsonQuery))); |
| 1051 var formatString = tree.firstChild.nextSibling; | 1058 var formatString = tree.firstChild.nextSibling; |
| 1052 if (node) | 1059 if (node) |
| 1053 this.format_(node, formatString, buff); | 1060 this.format_(node, formatString, buff); |
| 1054 } | 1061 } |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1609 break; | 1616 break; |
| 1610 } | 1617 } |
| 1611 earconFinder = earconFinder.parent; | 1618 earconFinder = earconFinder.parent; |
| 1612 } | 1619 } |
| 1613 } | 1620 } |
| 1614 return null; | 1621 return null; |
| 1615 } | 1622 } |
| 1616 }; | 1623 }; |
| 1617 | 1624 |
| 1618 }); // goog.scope | 1625 }); // goog.scope |
| OLD | NEW |