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

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

Issue 1011913002: Add a role info dictionary to output.js to resolve role msgs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
index fd65f4b02db4563eadb8ac6bce258614c390a01f..5dfe204b4bbfe523b7971f165f32999ca491ae98 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -77,6 +77,55 @@ Output = function() {
Output.SPACE = ' ';
/**
+ * Metadata about supported automation roles.
+ * @const {Object<string, {msgId: string, earcon: string}>}
+ */
+Output.ROLE_INFO = {
+ alert: {
+ msgId: 'aria_role_alert',
+ earcon: 'ALERT_NONMODAL',
+ },
+ button: {
+ msgId: 'tag_button',
+ earcon: 'BUTTON'
+ },
+ checkbox: {
+ msgId: 'input_type_checkbox'
+ },
+ heading: {
+ msgId: 'aria_role_heading',
+ },
+ link: {
+ msgId: 'tag_link',
+ earcon: 'LINK'
+ },
+ list: {
+ msgId: 'LIST_WITH_ITEMS'
Peter Lundblad 2015/03/17 10:34:09 This message takes one parameter, how is that hand
Peter Lundblad 2015/03/17 10:34:09 nit: lower case.
+ },
+ listItem: {
+ msgId: 'ARIA_ROLE_LISTITEM',
+ earcon: 'list_item'
+ },
+ menuListOption: {
+ msgId: 'aria_role_menuitem'
+ },
+ popUpButton: {
+ msgId: 'tag_button'
+ },
+ radioButton: {
+ msgId: 'input_type_radio'
+ },
+ textBox: {
+ msgId: 'input_type_text',
+ earcon: 'EDITABLE_TEXT'
+ },
+ textField: {
+ msgId: 'input_type_text',
+ earcon: 'EDITABLE_TEXT'
+ }
+};
+
+/**
* Rules specifying format of AutomationNodes for output.
* @type {!Object<string, Object<string, Object<string, string>>>}
*/
@@ -90,9 +139,6 @@ Output.RULES = {
speak: '!doNotInterrupt ' +
'@aria_role_alert $name $earcon(ALERT_NONMODAL) $descendants'
},
- button: {
- speak: '$name $earcon(BUTTON, @tag_button)'
- },
checkBox: {
speak: '$if($checked, @describe_checkbox_checked($name), ' +
'@describe_checkbox_unchecked($name)) ' +
@@ -150,15 +196,9 @@ Output.RULES = {
staticText: {
speak: '$value'
},
- textBox: {
- speak: '$name $value $earcon(EDITABLE_TEXT, @input_type_text)'
- },
tab: {
speak: '@describe_tab($name)'
},
- textField: {
- speak: '$name $value $earcon(EDITABLE_TEXT, @input_type_text) $protected'
- },
toolbar: {
enter: '$name $role'
},
@@ -427,10 +467,7 @@ Output.prototype = {
// All possible tokens based on prefix.
if (prefix == '$') {
options.annotation = token;
- if (token == 'role') {
- // Non-localized role and state obtained by default.
- this.addToSpannable_(buff, node.role, options);
- } else if (token == 'value') {
+ if (token == 'value') {
var text = node.attributes.value;
if (text) {
var offset = buff.getLength();
@@ -480,6 +517,22 @@ Output.prototype = {
new cursors.Cursor(leftmost, 0),
new cursors.Cursor(rightmost, 0));
this.range_(subrange, null, 'navigate', buff);
+ } else if (token == 'role') {
+ var msgId = node.role;
Peter Lundblad 2015/03/17 10:34:09 If we want this, then the msgIds should be qualifi
+ var earconId = null;
+ var info = Output.ROLE_INFO[node.role];
+ if (info) {
+ msgId = info.msgId;
+ earconId = info.earcon;
+ }
+ if (earconId) {
+ options.annotation = new Output.Action(function() {
+ cvox.ChromeVox.earcons.playEarcon(
+ cvox.AbstractEarcons[earconId]);
+ });
+ }
+ this.addToSpannable_(
Peter Lundblad 2015/03/17 10:34:09 Should the msgId be suffixed by _brl if such a mes
+ buff, cvox.ChromeVox.msgs.getMsg(msgId), options);
} else if (node.attributes[token]) {
this.addToSpannable_(buff, node.attributes[token], options);
} else if (node.state[token]) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698