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

Unified Diff: ui/accessibility/ax_text_utils.cc

Issue 1111163002: Fixed word and line navigation in multi-line text fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed first bunch of comments. Created 5 years, 8 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: ui/accessibility/ax_text_utils.cc
diff --git a/ui/accessibility/ax_text_utils.cc b/ui/accessibility/ax_text_utils.cc
index cac5aee5a9ca2b2cc623a890164d273f75e3ab07..da336b6194ad3a5dc37be071315817cb1e870b49 100644
--- a/ui/accessibility/ax_text_utils.cc
+++ b/ui/accessibility/ax_text_utils.cc
@@ -9,13 +9,16 @@
namespace ui {
+// line_breaks is a Misnomer. Blink provides the start offsets of each line
+// not the line breaks.
+// TODO(nektar): Rename line_breaks a11y attribute and variable references.
size_t FindAccessibleTextBoundary(const base::string16& text,
const std::vector<int>& line_breaks,
TextBoundaryType boundary,
size_t start_offset,
TextBoundaryDirection direction) {
size_t text_size = text.size();
- DCHECK(start_offset <= text_size);
+ DCHECK_LE(start_offset, text_size);
if (boundary == CHAR_BOUNDARY) {
if (direction == FORWARDS_DIRECTION && start_offset < text_size)
@@ -33,7 +36,7 @@ size_t FindAccessibleTextBoundary(const base::string16& text,
} else {
for (size_t j = line_breaks.size(); j != 0; --j) {
size_t line_break = line_breaks[j - 1] >= 0 ? line_breaks[j - 1] : 0;
- if (line_break < start_offset)
+ if (line_break <= start_offset)
return line_break;
}
return 0;
« no previous file with comments | « content/browser/accessibility/browser_accessibility_win_unittest.cc ('k') | ui/accessibility/ax_text_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698