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

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

Issue 2395293002: Work around bad line break offset calculation (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | 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/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 5f08eee38b33590a08e1ae424614ff611791f3cd..cb44417a5d6fa9772e31ba5bf59d0a1070ee00bb 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js
@@ -133,7 +133,7 @@ AutomationEditableText.prototype = {
getLineIndex: function(charIndex) {
if (!this.multiline)
return 0;
- var breaks = this.node_.lineStartOffsets || [];
+ var breaks = this.getLineBreaks_();
var index = 0;
while (index < breaks.length && breaks[index] <= charIndex)
++index;
@@ -168,7 +168,11 @@ AutomationEditableText.prototype = {
getLineBreaks_: function() {
// node.lineStartOffsets is undefined when the multiline field has no line
// breaks.
- return this.node_.lineStartOffsets || [];
+ // The line break calculation is fuzzy because the last offset doesn't
+ // correspond with the actual text selection data, so let's just ignore it
+ // here...
+ var breaks = this.node_.lineStartOffsets || [];
+ return breaks.slice(0, breaks.length - 1);
},
/** @private */
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698