Commit e8b38db0 authored by Kevin Babbitt's avatar Kevin Babbitt Committed by Commit Bot

Rename AXPosition leaf position methods

Follow-up to address comment at
http://crrev.com/c/17374393/ui/accessibility/ax_position.h#851

Rename:
CreateNextTextAnchorPosition -> CreateNextLeafTextPosition
CreatePreviousTextAnchorPosition -> CreatePreviousLeafTextPosition

Also re-implement renames that were lost in a rebase of
http://crrev.com/c/1735524:
CreateNextTreeAnchorPosition -> CreateNextLeafTreePosition
CreatePreviousTreeAnchorPosition -> CreatePreviousLeafTreePosition

Bug: 928948
Change-Id: I77b81f51ee7160395440e401318dd633365d96dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1742949
Commit-Queue: Nektarios Paisios <nektar@chromium.org>
Reviewed-by: default avatarNektarios Paisios <nektar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#685172}
parent 06e0dedf
...@@ -360,7 +360,7 @@ class AXPosition { ...@@ -360,7 +360,7 @@ class AXPosition {
// The current anchor might be followed by a soft line break. // The current anchor might be followed by a soft line break.
if (text_position->AtEndOfAnchor()) if (text_position->AtEndOfAnchor())
return text_position->CreateNextTextAnchorPosition()->AtEndOfLine(); return text_position->CreateNextLeafTextPosition()->AtEndOfLine();
} }
return false; return false;
} }
...@@ -695,8 +695,8 @@ class AXPosition { ...@@ -695,8 +695,8 @@ class AXPosition {
bool was_tree_position = IsTreePosition(); bool was_tree_position = IsTreePosition();
AXPositionInstance initial_endpoint = AsLeafTextPosition(); AXPositionInstance initial_endpoint = AsLeafTextPosition();
AXPositionInstance current_endpoint = AXPositionInstance current_endpoint =
forwards ? initial_endpoint->CreateNextTextAnchorPosition() forwards ? initial_endpoint->CreateNextLeafTextPosition()
: initial_endpoint->CreatePreviousTextAnchorPosition(); : initial_endpoint->CreatePreviousLeafTextPosition();
// Start or end of document // Start or end of document
if (current_endpoint->IsNullPosition()) { if (current_endpoint->IsNullPosition()) {
...@@ -741,9 +741,9 @@ class AXPosition { ...@@ -741,9 +741,9 @@ class AXPosition {
auto next_endpoint = current_endpoint->Clone(); auto next_endpoint = current_endpoint->Clone();
do { do {
if (forwards) if (forwards)
next_endpoint = next_endpoint->CreateNextTextAnchorPosition(); next_endpoint = next_endpoint->CreateNextLeafTextPosition();
else else
next_endpoint = next_endpoint->CreatePreviousTextAnchorPosition(); next_endpoint = next_endpoint->CreatePreviousLeafTextPosition();
if (next_endpoint->IsNullPosition() || if (next_endpoint->IsNullPosition() ||
next_endpoint->GetTextStyles() != initial_styles) next_endpoint->GetTextStyles() != initial_styles)
...@@ -754,7 +754,7 @@ class AXPosition { ...@@ -754,7 +754,7 @@ class AXPosition {
// Moving forwards should leave the position at the end of an anchor. // Moving forwards should leave the position at the end of an anchor.
// Backwards moves are already at the start of the anchor from // Backwards moves are already at the start of the anchor from
// CreatePreviousTextAnchorPosition, so there's no need to move again. // CreatePreviousLeafTextPosition, so there's no need to move again.
if (forwards) if (forwards)
current_endpoint = current_endpoint->CreatePositionAtEndOfAnchor(); current_endpoint = current_endpoint->CreatePositionAtEndOfAnchor();
else else
...@@ -904,7 +904,7 @@ class AXPosition { ...@@ -904,7 +904,7 @@ class AXPosition {
// Creates a tree position using the next text-only node as its anchor. // Creates a tree position using the next text-only node as its anchor.
// Assumes that text-only nodes are leaf nodes. // Assumes that text-only nodes are leaf nodes.
AXPositionInstance CreateNextTreeAnchorPosition() const { AXPositionInstance CreateNextLeafTreePosition() const {
AXPositionInstance next_leaf = AsTreePosition()->CreateNextAnchorPosition(); AXPositionInstance next_leaf = AsTreePosition()->CreateNextAnchorPosition();
while (!next_leaf->IsNullPosition() && next_leaf->AnchorChildCount()) { while (!next_leaf->IsNullPosition() && next_leaf->AnchorChildCount()) {
next_leaf = next_leaf->CreateNextAnchorPosition(); next_leaf = next_leaf->CreateNextAnchorPosition();
...@@ -916,7 +916,7 @@ class AXPosition { ...@@ -916,7 +916,7 @@ class AXPosition {
// Creates a tree position using the previous text-only node as its anchor. // Creates a tree position using the previous text-only node as its anchor.
// Assumes that text-only nodes are leaf nodes. // Assumes that text-only nodes are leaf nodes.
AXPositionInstance CreatePreviousTreeAnchorPosition() const { AXPositionInstance CreatePreviousLeafTreePosition() const {
AXPositionInstance previous_leaf = AXPositionInstance previous_leaf =
AsTreePosition()->CreatePreviousAnchorPosition(); AsTreePosition()->CreatePreviousAnchorPosition();
while (!previous_leaf->IsNullPosition() && while (!previous_leaf->IsNullPosition() &&
...@@ -930,14 +930,14 @@ class AXPosition { ...@@ -930,14 +930,14 @@ class AXPosition {
// Creates a text position using the next text-only node as its anchor. // Creates a text position using the next text-only node as its anchor.
// Assumes that text-only nodes are leaf nodes. // Assumes that text-only nodes are leaf nodes.
AXPositionInstance CreateNextTextAnchorPosition() const { AXPositionInstance CreateNextLeafTextPosition() const {
return CreateNextTextAnchorPosition( return CreateNextTextAnchorPosition(
base::BindRepeating(&DefaultAbortMovePredicate)); base::BindRepeating(&DefaultAbortMovePredicate));
} }
// Creates a text position using the previous text-only node as its anchor. // Creates a text position using the previous text-only node as its anchor.
// Assumes that text-only nodes are leaf nodes. // Assumes that text-only nodes are leaf nodes.
AXPositionInstance CreatePreviousTextAnchorPosition() const { AXPositionInstance CreatePreviousLeafTextPosition() const {
return CreatePreviousTextAnchorPosition( return CreatePreviousTextAnchorPosition(
base::BindRepeating(&DefaultAbortMovePredicate)); base::BindRepeating(&DefaultAbortMovePredicate));
} }
...@@ -963,7 +963,7 @@ class AXPosition { ...@@ -963,7 +963,7 @@ class AXPosition {
AXPositionInstance AsPositionBeforeCharacter() const { AXPositionInstance AsPositionBeforeCharacter() const {
AXPositionInstance text_position = AsTextPosition(); AXPositionInstance text_position = AsTextPosition();
while (text_position->AtEndOfAnchor()) while (text_position->AtEndOfAnchor())
text_position = text_position->CreateNextTextAnchorPosition(); text_position = text_position->CreateNextLeafTextPosition();
return text_position; return text_position;
} }
...@@ -973,7 +973,7 @@ class AXPosition { ...@@ -973,7 +973,7 @@ class AXPosition {
AXPositionInstance AsPositionAfterCharacter() const { AXPositionInstance AsPositionAfterCharacter() const {
AXPositionInstance text_position = AsTextPosition(); AXPositionInstance text_position = AsTextPosition();
while (text_position->AtStartOfAnchor()) { while (text_position->AtStartOfAnchor()) {
text_position = text_position->CreatePreviousTextAnchorPosition(); text_position = text_position->CreatePreviousLeafTextPosition();
text_position = text_position->CreatePositionAtEndOfAnchor(); text_position = text_position->CreatePositionAtEndOfAnchor();
} }
return text_position; return text_position;
...@@ -1050,7 +1050,7 @@ class AXPosition { ...@@ -1050,7 +1050,7 @@ class AXPosition {
if (iterator == word_starts.end()) { if (iterator == word_starts.end()) {
// Ignore any nodes with no text or no word boundaries. // Ignore any nodes with no text or no word boundaries.
do { do {
text_position = text_position->CreateNextTextAnchorPosition(); text_position = text_position->CreateNextLeafTextPosition();
if (text_position->IsNullPosition()) { if (text_position->IsNullPosition()) {
if (AtEndOfAnchor() && if (AtEndOfAnchor() &&
boundary_behavior == AXBoundaryBehavior::CrossBoundary) boundary_behavior == AXBoundaryBehavior::CrossBoundary)
...@@ -1112,7 +1112,7 @@ class AXPosition { ...@@ -1112,7 +1112,7 @@ class AXPosition {
if (word_starts.empty() || iterator == word_starts.begin()) { if (word_starts.empty() || iterator == word_starts.begin()) {
// Ignore any nodes with no text or no word boundaries. // Ignore any nodes with no text or no word boundaries.
do { do {
text_position = text_position->CreatePreviousTextAnchorPosition() text_position = text_position->CreatePreviousLeafTextPosition()
->CreatePositionAtEndOfAnchor(); ->CreatePositionAtEndOfAnchor();
if (text_position->IsNullPosition()) { if (text_position->IsNullPosition()) {
if (boundary_behavior == AXBoundaryBehavior::StopAtAnchorBoundary) if (boundary_behavior == AXBoundaryBehavior::StopAtAnchorBoundary)
...@@ -1182,7 +1182,7 @@ class AXPosition { ...@@ -1182,7 +1182,7 @@ class AXPosition {
if (iterator == word_ends.end()) { if (iterator == word_ends.end()) {
// Ignore any nodes with no text or no word boundaries. // Ignore any nodes with no text or no word boundaries.
do { do {
text_position = text_position->CreateNextTextAnchorPosition(); text_position = text_position->CreateNextLeafTextPosition();
if (text_position->IsNullPosition()) { if (text_position->IsNullPosition()) {
if (boundary_behavior == AXBoundaryBehavior::StopAtAnchorBoundary) if (boundary_behavior == AXBoundaryBehavior::StopAtAnchorBoundary)
return CreatePositionAtEndOfAnchor(); return CreatePositionAtEndOfAnchor();
...@@ -1250,7 +1250,7 @@ class AXPosition { ...@@ -1250,7 +1250,7 @@ class AXPosition {
if (word_ends.empty() || iterator == word_ends.begin()) { if (word_ends.empty() || iterator == word_ends.begin()) {
// Ignore any nodes with no text or no word boundaries. // Ignore any nodes with no text or no word boundaries.
do { do {
text_position = text_position->CreatePreviousTextAnchorPosition() text_position = text_position->CreatePreviousLeafTextPosition()
->CreatePositionAtEndOfAnchor(); ->CreatePositionAtEndOfAnchor();
if (text_position->IsNullPosition()) { if (text_position->IsNullPosition()) {
if (AtStartOfAnchor() && if (AtStartOfAnchor() &&
...@@ -1308,7 +1308,7 @@ class AXPosition { ...@@ -1308,7 +1308,7 @@ class AXPosition {
} }
do { do {
text_position = text_position->CreateNextTextAnchorPosition(); text_position = text_position->CreateNextLeafTextPosition();
if (text_position->IsNullPosition()) { if (text_position->IsNullPosition()) {
if (AtEndOfAnchor() && if (AtEndOfAnchor() &&
boundary_behavior == AXBoundaryBehavior::CrossBoundary) boundary_behavior == AXBoundaryBehavior::CrossBoundary)
...@@ -1353,7 +1353,7 @@ class AXPosition { ...@@ -1353,7 +1353,7 @@ class AXPosition {
do { do {
if (text_position->AtStartOfAnchor()) { if (text_position->AtStartOfAnchor()) {
text_position = text_position->CreatePreviousTextAnchorPosition(); text_position = text_position->CreatePreviousLeafTextPosition();
} else { } else {
text_position = text_position->CreatePositionAtStartOfAnchor(); text_position = text_position->CreatePositionAtStartOfAnchor();
} }
...@@ -1409,7 +1409,7 @@ class AXPosition { ...@@ -1409,7 +1409,7 @@ class AXPosition {
do { do {
if (text_position->AtEndOfAnchor()) { if (text_position->AtEndOfAnchor()) {
text_position = text_position->CreateNextTextAnchorPosition() text_position = text_position->CreateNextLeafTextPosition()
->CreatePositionAtEndOfAnchor(); ->CreatePositionAtEndOfAnchor();
} else { } else {
text_position = text_position->CreatePositionAtEndOfAnchor(); text_position = text_position->CreatePositionAtEndOfAnchor();
...@@ -1467,7 +1467,7 @@ class AXPosition { ...@@ -1467,7 +1467,7 @@ class AXPosition {
} }
do { do {
text_position = text_position->CreatePreviousTextAnchorPosition() text_position = text_position->CreatePreviousLeafTextPosition()
->CreatePositionAtEndOfAnchor(); ->CreatePositionAtEndOfAnchor();
if (text_position->IsNullPosition()) { if (text_position->IsNullPosition()) {
if (AtStartOfAnchor() && if (AtStartOfAnchor() &&
...@@ -1572,7 +1572,7 @@ class AXPosition { ...@@ -1572,7 +1572,7 @@ class AXPosition {
} }
do { do {
text_position = text_position->CreateNextTextAnchorPosition(); text_position = text_position->CreateNextLeafTextPosition();
if (text_position->IsNullPosition()) { if (text_position->IsNullPosition()) {
if (boundary_behavior == AXBoundaryBehavior::StopAtAnchorBoundary) if (boundary_behavior == AXBoundaryBehavior::StopAtAnchorBoundary)
return CreatePositionAtEndOfAnchor(); return CreatePositionAtEndOfAnchor();
...@@ -1618,7 +1618,7 @@ class AXPosition { ...@@ -1618,7 +1618,7 @@ class AXPosition {
do { do {
if (text_position->AtStartOfAnchor()) { if (text_position->AtStartOfAnchor()) {
text_position = text_position->CreatePreviousTextAnchorPosition(); text_position = text_position->CreatePreviousLeafTextPosition();
} else { } else {
text_position = text_position->CreatePositionAtStartOfAnchor(); text_position = text_position->CreatePositionAtStartOfAnchor();
} }
...@@ -1674,7 +1674,7 @@ class AXPosition { ...@@ -1674,7 +1674,7 @@ class AXPosition {
do { do {
if (text_position->AtEndOfAnchor()) { if (text_position->AtEndOfAnchor()) {
text_position = text_position->CreateNextTextAnchorPosition() text_position = text_position->CreateNextLeafTextPosition()
->CreatePositionAtEndOfAnchor(); ->CreatePositionAtEndOfAnchor();
} else { } else {
text_position = text_position->CreatePositionAtEndOfAnchor(); text_position = text_position->CreatePositionAtEndOfAnchor();
...@@ -1732,7 +1732,7 @@ class AXPosition { ...@@ -1732,7 +1732,7 @@ class AXPosition {
} }
do { do {
text_position = text_position->CreatePreviousTextAnchorPosition() text_position = text_position->CreatePreviousLeafTextPosition()
->CreatePositionAtEndOfAnchor(); ->CreatePositionAtEndOfAnchor();
if (text_position->IsNullPosition()) { if (text_position->IsNullPosition()) {
if (boundary_behavior == AXBoundaryBehavior::StopAtAnchorBoundary) if (boundary_behavior == AXBoundaryBehavior::StopAtAnchorBoundary)
......
...@@ -182,7 +182,7 @@ class AXRange { ...@@ -182,7 +182,7 @@ class AXRange {
if (current_start_->GetAnchor() == iterator_end_->GetAnchor()) { if (current_start_->GetAnchor() == iterator_end_->GetAnchor()) {
current_start_ = AXPositionType::CreateNullPosition(); current_start_ = AXPositionType::CreateNullPosition();
} else { } else {
current_start_ = current_start_->CreateNextTreeAnchorPosition(); current_start_ = current_start_->CreateNextLeafTreePosition();
DCHECK_LE(*current_start_, *iterator_end_); DCHECK_LE(*current_start_, *iterator_end_);
} }
return *this; return *this;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment