| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 navigate: { | 390 navigate: { |
| 391 'default': { | 391 'default': { |
| 392 speak: '$name $value $state $role $description', | 392 speak: '$name $value $state $role $description', |
| 393 braille: '' | 393 braille: '' |
| 394 }, | 394 }, |
| 395 abstractContainer: { | 395 abstractContainer: { |
| 396 enter: '$nameFromNode $role $state $description', | 396 enter: '$nameFromNode $role $state $description', |
| 397 leave: '@exited_container($role)' | 397 leave: '@exited_container($role)' |
| 398 }, | 398 }, |
| 399 alert: { | 399 alert: { |
| 400 speak: '$earcon(ALERT_NONMODAL) $role $descendants $state' | 400 enter: '$name $role $state', |
| 401 speak: '$earcon(ALERT_NONMODAL) $role $nameOrTextContent $state' |
| 401 }, | 402 }, |
| 402 alertDialog: { | 403 alertDialog: { |
| 403 enter: '$earcon(ALERT_MODAL) $name $state', | 404 enter: '$earcon(ALERT_MODAL) $name $state', |
| 404 speak: '$earcon(ALERT_MODAL) $name $descendants $state $role' | 405 speak: '$earcon(ALERT_MODAL) $name $nameOrTextContent $state $role' |
| 405 }, | 406 }, |
| 406 cell: { | 407 cell: { |
| 407 enter: '@cell_summary($tableCellRowIndex, $tableCellColumnIndex) ' + | 408 enter: '@cell_summary($tableCellRowIndex, $tableCellColumnIndex) ' + |
| 408 '$node(tableColumnHeader)', | 409 '$node(tableColumnHeader)', |
| 409 speak: '@cell_summary($tableCellRowIndex, $tableCellColumnIndex) ' + | 410 speak: '@cell_summary($tableCellRowIndex, $tableCellColumnIndex) ' + |
| 410 '$node(tableColumnHeader) $state' | 411 '$node(tableColumnHeader) $state' |
| 411 }, | 412 }, |
| 412 checkBox: { | 413 checkBox: { |
| 413 speak: '$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) ' + | 414 speak: '$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) ' + |
| 414 '$name $role $checked $description $state' | 415 '$name $role $checked $description $state' |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 enter: '$name', | 518 enter: '$name', |
| 518 speak: '$if($name, $name, $docUrl)' | 519 speak: '$if($name, $name, $docUrl)' |
| 519 }, | 520 }, |
| 520 region: { | 521 region: { |
| 521 speak: '$nameOrTextContent' | 522 speak: '$nameOrTextContent' |
| 522 }, | 523 }, |
| 523 row: { | 524 row: { |
| 524 enter: '$node(tableRowHeader)' | 525 enter: '$node(tableRowHeader)' |
| 525 }, | 526 }, |
| 526 rowHeader: { | 527 rowHeader: { |
| 527 speak: '$descendants $state' | 528 speak: '$nameOrTextContent $state' |
| 528 }, | 529 }, |
| 529 slider: { | 530 slider: { |
| 530 speak: '$earcon(SLIDER) @describe_slider($value, $name) $description ' + | 531 speak: '$earcon(SLIDER) @describe_slider($value, $name) $description ' + |
| 531 '$state' | 532 '$state' |
| 532 }, | 533 }, |
| 533 staticText: { | 534 staticText: { |
| 534 speak: '$name=' | 535 speak: '$name=' |
| 535 }, | 536 }, |
| 536 switch: { | 537 switch: { |
| 537 speak: '$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) ' + | 538 speak: '$if($checked, $earcon(CHECK_ON), $earcon(CHECK_OFF)) ' + |
| 538 '$if($checked, @describe_switch_on($name), ' + | 539 '$if($checked, @describe_switch_on($name), ' + |
| 539 '@describe_switch_off($name)) $description $state' | 540 '@describe_switch_off($name)) $description $state' |
| 540 }, | 541 }, |
| 541 tab: { | 542 tab: { |
| 542 speak: '@describe_tab($name) $state $description ' + | 543 speak: '@describe_tab($name) $state $description ' + |
| 543 '$if($setSize, @describe_index($posInSet, $setSize))', | 544 '$if($setSize, @describe_index($posInSet, $setSize))', |
| 544 }, | 545 }, |
| 545 table: { | 546 table: { |
| 546 enter: '@table_summary($name, $tableRowCount, $tableColumnCount) ' + | 547 enter: '@table_summary($name, $tableRowCount, $tableColumnCount) ' + |
| 547 '$node(tableHeader)' | 548 '$node(tableHeader)' |
| 548 }, | 549 }, |
| 549 tableHeaderContainer: { | 550 tableHeaderContainer: { |
| 550 speak: '$descendants $state $description' | 551 speak: '$nameOrTextContent $state $description' |
| 551 }, | 552 }, |
| 552 textField: { | 553 textField: { |
| 553 speak: '$name $value $if($multiline, @tag_textarea, $if(' + | 554 speak: '$name $value $if($multiline, @tag_textarea, $if(' + |
| 554 '$inputType, $inputType, $role)) $description $state', | 555 '$inputType, $inputType, $role)) $description $state', |
| 555 braille: '' | 556 braille: '' |
| 556 }, | 557 }, |
| 557 timer: { | 558 timer: { |
| 558 speak: '$nameFromNode $descendants $value $state $description' | 559 speak: '$nameFromNode $descendants $value $state $description' |
| 559 }, | 560 }, |
| 560 toggleButton: { | 561 toggleButton: { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 menuListValueChanged: { | 595 menuListValueChanged: { |
| 595 'default': { | 596 'default': { |
| 596 speak: '$value $name ' + | 597 speak: '$value $name ' + |
| 597 '$find({"state": {"selected": true, "invisible": false}}, ' + | 598 '$find({"state": {"selected": true, "invisible": false}}, ' + |
| 598 '@describe_index($indexInParent, $parentChildCount)) ' | 599 '@describe_index($indexInParent, $parentChildCount)) ' |
| 599 } | 600 } |
| 600 }, | 601 }, |
| 601 alert: { | 602 alert: { |
| 602 default: { | 603 default: { |
| 603 speak: '$earcon(ALERT_NONMODAL) @role_alert ' + | 604 speak: '$earcon(ALERT_NONMODAL) @role_alert ' + |
| 604 '$if($name, $name, $descendants) $description' | 605 '$nameOrTextContent $description' |
| 605 } | 606 } |
| 606 } | 607 } |
| 607 }; | 608 }; |
| 608 | 609 |
| 609 /** | 610 /** |
| 610 * Used to annotate utterances with speech properties. | 611 * Used to annotate utterances with speech properties. |
| 611 * @constructor | 612 * @constructor |
| 612 */ | 613 */ |
| 613 Output.SpeechProperties = function() {}; | 614 Output.SpeechProperties = function() {}; |
| 614 | 615 |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1229 var related = node[tree.firstChild.value]; | 1230 var related = node[tree.firstChild.value]; |
| 1230 this.node_(related, related, Output.EventType.NAVIGATE, buff); | 1231 this.node_(related, related, Output.EventType.NAVIGATE, buff); |
| 1231 } else if (token == 'nameOrTextContent') { | 1232 } else if (token == 'nameOrTextContent') { |
| 1232 if (node.name) { | 1233 if (node.name) { |
| 1233 this.format_(node, '$name', buff); | 1234 this.format_(node, '$name', buff); |
| 1234 } else { | 1235 } else { |
| 1235 var walker = new AutomationTreeWalker(node, | 1236 var walker = new AutomationTreeWalker(node, |
| 1236 Dir.FORWARD, | 1237 Dir.FORWARD, |
| 1237 {visit: AutomationPredicate.leafOrStaticText, | 1238 {visit: AutomationPredicate.leafOrStaticText, |
| 1238 leaf: AutomationPredicate.leafOrStaticText}); | 1239 leaf: AutomationPredicate.leafOrStaticText}); |
| 1240 var outputStrings = []; |
| 1239 while (walker.next().node && | 1241 while (walker.next().node && |
| 1240 walker.phase == AutomationTreeWalkerPhase.DESCENDANT) { | 1242 walker.phase == AutomationTreeWalkerPhase.DESCENDANT) { |
| 1241 if (walker.node.name) | 1243 if (walker.node.name) |
| 1242 this.append_(buff, walker.node.name, options); | 1244 outputStrings.push(walker.node.name); |
| 1243 } | 1245 } |
| 1246 var joinedOutput = outputStrings.join(' '); |
| 1247 this.append_(buff, joinedOutput, options); |
| 1244 } | 1248 } |
| 1245 } else if (node[token] !== undefined) { | 1249 } else if (node[token] !== undefined) { |
| 1246 options.annotation.push(token); | 1250 options.annotation.push(token); |
| 1247 var value = node[token]; | 1251 var value = node[token]; |
| 1248 if (typeof value == 'number') | 1252 if (typeof value == 'number') |
| 1249 value = String(value); | 1253 value = String(value); |
| 1250 this.append_(buff, value, options); | 1254 this.append_(buff, value, options); |
| 1251 } else if (Output.STATE_INFO_[token]) { | 1255 } else if (Output.STATE_INFO_[token]) { |
| 1252 options.annotation.push('state'); | 1256 options.annotation.push('state'); |
| 1253 var stateInfo = Output.STATE_INFO_[token]; | 1257 var stateInfo = Output.STATE_INFO_[token]; |
| (...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1843 /** | 1847 /** |
| 1844 * Gets the output buffer for braille. | 1848 * Gets the output buffer for braille. |
| 1845 * @return {!Spannable} | 1849 * @return {!Spannable} |
| 1846 */ | 1850 */ |
| 1847 get brailleOutputForTest() { | 1851 get brailleOutputForTest() { |
| 1848 return this.mergeBraille_(this.brailleBuffer_); | 1852 return this.mergeBraille_(this.brailleBuffer_); |
| 1849 } | 1853 } |
| 1850 }; | 1854 }; |
| 1851 | 1855 |
| 1852 }); // goog.scope | 1856 }); // goog.scope |
| OLD | NEW |