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

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

Issue 2441033002: Reland: Further refine div output when a div receives focus (Closed)
Patch Set: Created 4 years, 2 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 | chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs » ('j') | 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 f049a6d8fe2610f0392fbf6622a45668bdebad79..b2dbd612750de40d84b80df6fe3d2bbdb3289214 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -9,6 +9,7 @@
goog.provide('Output');
goog.provide('Output.EventType');
+goog.require('AutomationTreeWalker');
goog.require('EarconEngine');
goog.require('Spannable');
goog.require('Stubs');
@@ -447,7 +448,7 @@ Output.RULES = {
},
div: {
enter: '$nameFromNode',
- speak: '$name $description $descendants'
+ speak: '$nameOrTextContent $description'
},
embeddedObject: {
speak: '$name'
@@ -537,7 +538,7 @@ Output.RULES = {
speak: '$if($name, $name, $docUrl)'
},
region: {
- speak: '$descendants'
+ speak: '$nameOrTextContent'
},
row: {
enter: '$node(tableRowHeader)'
@@ -1199,6 +1200,20 @@ Output.prototype = {
return;
var related = node[tree.firstChild.value];
this.node_(related, related, Output.EventType.NAVIGATE, buff);
+ } else if (token == 'nameOrTextContent') {
+ if (node.name) {
+ this.format_(node, '$name', buff);
+ } else {
+ var walker = new AutomationTreeWalker(node,
+ Dir.FORWARD,
+ {visit: AutomationPredicate.leafOrStaticText,
+ leaf: AutomationPredicate.leafOrStaticText});
+ while (walker.next().node &&
+ walker.phase == AutomationTreeWalkerPhase.DESCENDANT) {
+ if (walker.node.name)
+ this.append_(buff, walker.node.name, options);
+ }
+ }
} else if (node[token] !== undefined) {
options.annotation.push(token);
var value = node[token];
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/output_test.extjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698