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

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: Rebase. 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
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js ('k') | no next file » | 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 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;
},
« no previous file with comments | « chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698