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

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

Issue 2016003002: Collapse description into either value or name, and value into name if duplicated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@read_window_chain
Patch Set: More test fixes. Created 4 years, 6 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 ed676e49536b0a4ac1d5f4e9ace6d6661d30f78d..fd3aa625acfd9fc837618fdac42e4f60e78a01bc 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
@@ -995,6 +995,8 @@ Output.prototype = {
if (prefix == '$') {
if (token == 'value') {
var text = node.value;
+ if (!node.state.editable && node.name == text)
+ return;
if (text !== undefined) {
if (node.textSelStart !== undefined) {
options.annotation.push(new Output.SelectionSpan(
@@ -1023,6 +1025,11 @@ Output.prototype = {
this.append_(buff, node.name, options);
else
this.format_(node, '$descendants', buff);
+ } else if (token == 'description') {
+ if (node.name == node.description || node.value == node.description)
+ return;
+ options.annotation.push(token);
+ this.append_(buff, node.description, options);
} else if (token == 'indexInParent') {
options.annotation.push(token);
this.append_(buff, String(node.indexInParent + 1));
@@ -1434,8 +1441,13 @@ Output.prototype = {
append_: function(buff, value, opt_options) {
opt_options = opt_options || {isUnique: false, annotation: []};
- // Reject empty values without annotations.
- if ((!value || value.length == 0) && opt_options.annotation.length == 0)
+ // Reject empty values without meaningful annotations.
+ if ((!value || value.length == 0) && opt_options.annotation.every(
+ function(a) {
+ return !(a instanceof Output.Action) &&
+ !(a instanceof Output.SelectionSpan);
+
+ }))
return;
var spannableToAdd = new Spannable(value);

Powered by Google App Engine
This is Rietveld 408576698