Chromium Code Reviews| 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..f24a7906c096848827f80f88de7f045fb96ea8bf 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js |
| @@ -1060,6 +1060,20 @@ Output.prototype = { |
| var earcon = node ? this.findEarcon_(node, opt_prevNode) : null; |
| if (earcon) |
| options.annotation.push(earcon); |
| + |
| + 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 (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 +1671,12 @@ Output.prototype = { |
| elem.end); |
| }); |
| spansToRemove.forEach(result.removeSpan.bind(result)); |
| - separator = Output.SPACE; |
| + |
| + // No separator needed if the previous result did end with whitespace. |
| + if (cur.toString()[cur.length - 1] == Output.SPACE) |
|
dmazzoni
2016/08/22 19:27:49
Do you want to test for other whitespace here? Or
|
| + separator = ''; |
| + else |
| + separator = Output.SPACE; |
| }); |
| return result; |
| }, |