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_position.h

Issue 2897163002: Fixed bugs with finding line boundaries using IA2 get_textAtOffset and AXPosition::AtStartOfLine. (Closed)
Patch Set: Fixed bugs with finding line boundaries using IA2 get_textAtOffset. Created 3 years, 7 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 | « ui/accessibility/ax_node_position_unittest.cc ('k') | no next file » | 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 0938f0509e23253cd7f2fc4a883948d82ece8236..8886b1f833d15763cb975a0481fd0b485fab2afa 100644
--- a/ui/accessibility/ax_position.h
+++ b/ui/accessibility/ax_position.h
@@ -276,8 +276,15 @@ class AXPosition {
NOTREACHED();
return false;
case AXPositionKind::TEXT_POSITION:
- return !text_position->IsInLineBreak() &&
- GetPreviousOnLineID(text_position->anchor_id_) ==
+ // Special case, when the caret is right after a line break and the next
+ // position is not another line break. We should return |true| because
+ // visually the caret is at the beginning of a new line.
+ if (text_position->IsInLineBreak()) {
+ return text_position->AtEndOfAnchor() &&
+ !text_position->CreateNextTextAnchorPosition()
+ ->IsInLineBreak();
+ }
+ return GetPreviousOnLineID(text_position->anchor_id_) ==
INVALID_ANCHOR_ID &&
text_position->AtStartOfAnchor();
}
« no previous file with comments | « ui/accessibility/ax_node_position_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698