Chromium Code Reviews| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js |
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js |
| index e6f234cd0f05182c43750238295ea3f60a942d0e..99b1dc085ca8650667393f28c604402b9dc92f5b 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js |
| @@ -313,6 +313,11 @@ AutomationRichEditableText.prototype = { |
| new Range(cur.start_, cur.end_), |
| new Range(prev.start_, prev.end_), Output.EventType.NAVIGATE) |
| .go(); |
| + } else if (!cur.hasCollapsedSelection()) { |
| + // This is a selection. |
| + cvox.ChromeVox.tts.speak(cur.selectedText, cvox.QueueMode.CATEGORY_FLUSH); |
|
dmazzoni
2017/06/23 19:50:49
Do you want to do this if there's a lot of selecte
David Tseng
2017/06/23 20:06:09
I think this is ok since |cur| will be at most a l
|
| + cvox.ChromeVox.tts.speak(Msgs.getMsg('selected'), cvox.QueueMode.QUEUE); |
| + this.brailleCurrentRichLine_(); |
| } else { |
| // Describe the current line. This accounts for previous/current |
| // selections and picking the line edge boundary that changed (as computed |
| @@ -741,6 +746,16 @@ editing.EditableLine.prototype = { |
| return this.value_.toString(); |
| }, |
| + /** @return {string} */ |
| + get selectedText() { |
| + return this.value_.toString().substring(this.startOffset, this.endOffset); |
| + }, |
| + |
| + /** @return {boolean} */ |
| + hasCollapsedSelection: function() { |
| + return this.start_.equals(this.end_); |
| + }, |
| + |
| /** |
| * Returns true if |otherLine| surrounds the same line as |this|. Note that |
| * the contents of the line might be different. |