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

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

Issue 1866043004: Add a nameFromNode attrib to link output rule (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 4 years, 8 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
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 ed30ddea829facf1be1ab742cf1c0d75b3ed5878..173ff9b11354f0f168c066072eafbb7eb5204238 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -257,6 +257,7 @@ Output.ROLE_INFO_ = {
},
popUpButton: {
msgId: 'role_button',
+ earconId: 'POP_UP_BUTTON'
},
radioButton: {
msgId: 'role_radio'
@@ -396,14 +397,14 @@ Output.RULES = {
braille: ''
},
abstractContainer: {
- enter: '$name $role $description',
+ enter: '$nameFromNode $role $description',
leave: '@exited_container($role)'
},
alert: {
speak: '!doNotInterrupt $role $descendants'
},
alertDialog: {
- enter: '$name $role $description $descendants'
+ enter: '$nameFromNode $role $description $descendants'
},
cell: {
enter: '@column_granularity $tableCellColumnIndex'
@@ -413,14 +414,14 @@ Output.RULES = {
'$name $role $checked $description'
},
dialog: {
- enter: '$name $role $description'
+ enter: '$nameFromNode $role $description'
},
div: {
- enter: '$name',
+ enter: '$nameFromNode',
speak: '$name $description'
},
grid: {
- enter: '$name $role $description'
+ enter: '$nameFromNode $role $description'
},
heading: {
enter: '@tag_h+$hierarchicalLevel',
@@ -431,14 +432,15 @@ Output.RULES = {
speak: '$name='
},
link: {
- enter: '$name= $if($visited, @visited_link, $role)',
+ enter: '$nameFromNode $if($visited, @visited_link, $role)',
speak: '$name= $if($visited, @visited_link, $role) $description'
},
list: {
enter: '$role @@list_with_items($countChildren(listItem))'
},
listBox: {
- enter: '$name $role @@list_with_items($countChildren(listBoxOption)) ' +
+ enter: '$nameFromNode ' +
+ '$role @@list_with_items($countChildren(listBoxOption)) ' +
'$description'
},
listBoxOption: {
@@ -465,7 +467,7 @@ Output.RULES = {
speak: '$descendants'
},
popUpButton: {
- speak: '$earcon(POP_UP_BUTTON) $value $name $role @aria_has_popup ' +
+ speak: '$value $name $role @aria_has_popup ' +
'$if($collapsed, @aria_expanded_false, @aria_expanded_true) ' +
'$description'
},
@@ -923,9 +925,10 @@ Output.prototype = {
* @param {string|!Object} format The output format either specified as an
* output template string or a parsed output format tree.
* @param {!Array<Spannable>} buff Buffer to receive rendered output.
+ * @param {!AutomationNode=} opt_prevNode
* @private
*/
- format_: function(node, format, buff) {
+ format_: function(node, format, buff, opt_prevNode) {
var tokens = [];
var args = null;
@@ -984,10 +987,17 @@ Output.prototype = {
this.append_(buff, text, options);
} else if (token == 'name') {
options.annotation.push(token);
- var earcon = node ? this.findEarcon_(node) : null;
+ var earcon = node ? this.findEarcon_(node, opt_prevNode) : null;
if (earcon)
options.annotation.push(earcon);
this.append_(buff, node.name, options);
+ } else if (token == 'nameFromNode') {
+ if (chrome.automation.NameFromType[node.nameFrom] ==
+ 'nameFromContents')
+ return;
+
+ options.annotation.push(token);
+ this.append_(buff, node.name, options);
} else if (token == 'nameOrDescendants') {
options.annotation.push(token);
if (node.name)
@@ -1304,7 +1314,7 @@ Output.prototype = {
var roleBlock = getMergedRoleBlock(formatPrevNode.role);
if (roleBlock.leave && localStorage['useVerboseMode'] == 'true')
- this.format_(formatPrevNode, roleBlock.leave, buff);
+ this.format_(formatPrevNode, roleBlock.leave, buff, prevNode);
}
var enterOutputs = [];
@@ -1317,7 +1327,7 @@ Output.prototype = {
if (enterRole[formatNode.role])
continue;
enterRole[formatNode.role] = true;
- this.format_(formatNode, roleBlock.enter, buff);
+ this.format_(formatNode, roleBlock.enter, buff, prevNode);
}
if (formatNode.role == 'window')
break;
@@ -1341,7 +1351,7 @@ Output.prototype = {
parentRoleBlock.speak ||
eventBlock['default'].speak;
- this.format_(node, speakFormat, buff);
+ this.format_(node, speakFormat, buff, prevNode);
},
/**
@@ -1544,16 +1554,16 @@ Output.prototype = {
* @return {Output.Action}
*/
findEarcon_: function(node, opt_prevNode) {
+ if (node === opt_prevNode)
+ return null;
+
if (this.formatOptions_.speech) {
var earconFinder = node;
var ancestors;
- if (opt_prevNode) {
- // Don't include the node itself.
+ if (opt_prevNode)
ancestors = AutomationUtil.getUniqueAncestors(opt_prevNode, node);
- ancestors.pop();
- } else {
+ else
ancestors = AutomationUtil.getAncestors(node);
- }
while (earconFinder = ancestors.pop()) {
var info = Output.ROLE_INFO_[earconFinder.role];

Powered by Google App Engine
This is Rietveld 408576698