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

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

Issue 2948173004: Fix end of line announcements (Closed)
Patch Set: Remove comment. 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
index 7142a0e773bb4b22448e356ac01491c95241af20..1f3f614f456956e3267a7211d83ff11298e7050f 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors.js
@@ -445,9 +445,14 @@ cursors.Cursor.prototype = {
var target = newNode.firstChild;
var length = 0;
while (target && length < newIndex) {
- if (length <= newIndex && newIndex < (length + target.name.length))
+ var newLength = length + target.name.length;
+
+ // Either |newIndex| falls between target's text or |newIndex| is the
+ // total length of all sibling text content.
+ if ((length <= newIndex && newIndex < newLength) ||
+ (newIndex == newLength && !target.nextSibling))
break;
- length += target.name.length;
+ length = newLength;
target = target.nextSibling;
}
if (target) {
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/cvox2/background/cursors_test.extjs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698