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(); |
} |