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 c06e675f98796771bc6195b91d34b06a4b22a42a..f54134a7f5a3e7de1bd56d6f9d21b62dafd4aceb 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js |
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js |
@@ -1060,6 +1060,23 @@ Output.prototype = { |
var earcon = node ? this.findEarcon_(node, opt_prevNode) : null; |
if (earcon) |
options.annotation.push(earcon); |
+ |
+ // Reflect the selection here except when we're dealing with a node |
+ // that has a value. |
+ var selStart, selEnd; |
+ if (node == node.root.anchorObject && node == node.root.focusObject) { |
+ selStart = node.root.anchorOffset; |
+ selEnd = node.root.focusOffset; |
+ } else if (node == node.root.anchorObject) { |
+ selStart = node.root.anchorOffset; |
+ selEnd = selStart; |
+ } else if (node == node.root.focusObject) { |
+ selStart = node.root.focusOffset; |
+ selEnd = selStart; |
+ } |
+ if (!node.value && goog.isDef(selStart) && goog.isDef(selEnd)) |
+ options.annotation.push(new Output.SelectionSpan(selStart, selEnd)); |
+ |
this.append_(buff, node.name, options); |
} else if (token == 'nameFromNode') { |
if (chrome.automation.NameFromType[node.nameFrom] == |
@@ -1657,7 +1674,12 @@ Output.prototype = { |
elem.end); |
}); |
spansToRemove.forEach(result.removeSpan.bind(result)); |
- separator = Output.SPACE; |
+ |
+ // No separator needed if the previous result did end with our separator. |
+ if (cur.toString()[cur.length - 1] == Output.SPACE || result.length == 0) |
+ separator = ''; |
+ else |
+ separator = Output.SPACE; |
}); |
return result; |
}, |