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

Unified Diff: ui/accessibility/ax_position.h

Issue 2565833002: Uses |AXPosition| to enable navigation by character, word and line in content editables on the Mac. (Closed)
Patch Set: Fixed some boundary errors. Created 4 years 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 | « ui/accessibility/ax_node_position_unittest.cc ('k') | ui/accessibility/ax_range.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/accessibility/ax_position.h
diff --git a/ui/accessibility/ax_position.h b/ui/accessibility/ax_position.h
index fab1002f353d0dd206fa39f545ffb7aaaa3ba74b..5186c73d5fa2bf7779a76b86194a3e9d830b47ed 100644
--- a/ui/accessibility/ax_position.h
+++ b/ui/accessibility/ax_position.h
@@ -150,7 +150,8 @@ class AXPosition {
return str;
std::string text = base::UTF16ToUTF8(GetInnerText());
- DCHECK(!text.empty());
+ DCHECK_GE(text_offset_, 0);
+ DCHECK_LE(text_offset_, static_cast<int>(text.length()));
std::string annotated_text;
if (text_offset() == MaxTextOffset()) {
annotated_text = text + "<>";
@@ -268,11 +269,10 @@ class AXPosition {
// If the anchor node has no text inside it then the child index should be
// set to |BEFORE_TEXT|, hence the check for the text's length.
if (copy->MaxTextOffset() > 0 &&
- copy->text_offset_ == copy->MaxTextOffset()) {
+ copy->text_offset_ >= copy->MaxTextOffset()) {
copy->child_index_ = copy->AnchorChildCount();
} else {
DCHECK_GE(copy->text_offset_, 0);
- DCHECK_LT(copy->text_offset_, copy->MaxTextOffset());
copy->child_index_ = BEFORE_TEXT;
int current_offset = 0;
« no previous file with comments | « ui/accessibility/ax_node_position_unittest.cc ('k') | ui/accessibility/ax_range.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698