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

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

Issue 2931893002: More precise use of multiline state (Closed)
Patch Set: Fix test Created 3 years, 6 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/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 3b501d41f4da694a721af70f61887582eba29eea..1beef549b8cfb4576b2529b311023847f4fd2bf0 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
@@ -120,8 +120,6 @@ function AutomationEditableText(node) {
this.multiline = node.state[StateType.MULTILINE] || false;
/** @type {!AutomationNode} @private */
this.node_ = node;
- /** @type {Array<number>} @private */
- this.lineBreaks_ = [];
}
AutomationEditableText.prototype = {
@@ -133,9 +131,6 @@ AutomationEditableText.prototype = {
onUpdate: function() {
var newValue = this.node_.value || '';
- if (this.value != newValue)
- this.lineBreaks_ = [];
-
var textChangeEvent = new cvox.TextChangeEvent(
newValue, this.node_.textSelStart || 0, this.node_.textSelEnd || 0,
true /* triggered by user */);
@@ -159,6 +154,8 @@ AutomationEditableText.prototype = {
if (!this.multiline || lineIndex == 0)
return 0;
var breaks = this.getLineBreaks_();
+ if (breaks.length < 1)
David Tseng 2017/07/01 01:17:40 Thanks for the cleanup, but this entire class is p
+ return 0;
return breaks[lineIndex - 1] || this.node_.value.length;
},

Powered by Google App Engine
This is Rietveld 408576698