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

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

Issue 2263513004: Add support for rich output inside of content editables. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@editable_nav
Patch Set: Test fixes. Created 4 years, 4 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 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;
},

Powered by Google App Engine
This is Rietveld 408576698