Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider more ax::mojom::Roles as text #38645

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions third_party/accessibility/ax/ax_node_position_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ void AXPositionTest::SetUp() {
true);
text_field_.AddState(ax::mojom::State::kEditable);
text_field_.SetValue(TEXT_VALUE);
text_field_.SetName(TEXT_VALUE);
text_field_.AddIntListAttribute(
ax::mojom::IntListAttribute::kCachedLineStarts,
std::vector<int32_t>{0, 7});
Expand Down Expand Up @@ -1078,7 +1079,7 @@ TEST_F(AXPositionTest, GetMaxTextOffsetAndGetTextWithGeneratedContent) {
root_1.role = ax::mojom::Role::kRootWebArea;
root_1.child_ids = {text_field_2.id};

text_field_2.role = ax::mojom::Role::kTextField;
text_field_2.role = ax::mojom::Role::kGroup;
text_field_2.SetValue("3.14");
text_field_2.child_ids = {static_text_3.id, static_text_5.id};

Expand Down Expand Up @@ -1573,7 +1574,7 @@ TEST_F(AXPositionTest, AtStartAndEndOfLineInsideTextField) {

AXNodeData text_field_data_1;
text_field_data_1.id = 2;
text_field_data_1.role = ax::mojom::Role::kTextField;
text_field_data_1.role = ax::mojom::Role::kGroup;
// "kIsLineBreakingObject" and the "kEditable" state are not strictly
// necessary but are added for completeness.
text_field_data_1.AddBoolAttribute(
Expand Down Expand Up @@ -1613,7 +1614,7 @@ TEST_F(AXPositionTest, AtStartAndEndOfLineInsideTextField) {

AXNodeData text_field_data_2;
text_field_data_2.id = 7;
text_field_data_2.role = ax::mojom::Role::kTextField;
text_field_data_2.role = ax::mojom::Role::kGroup;
// "kIsLineBreakingObject" and the "kEditable" state are not strictly
// necessary but are added for completeness.
text_field_data_2.AddBoolAttribute(
Expand Down Expand Up @@ -7567,7 +7568,7 @@ TEST_F(AXPositionTest, EmptyObjectReplacedByCharacterTextNavigation) {
inline_box_3.AddIntListAttribute(ax::mojom::IntListAttribute::kWordEnds,
std::vector<int32_t>{6});

text_field_4.role = ax::mojom::Role::kTextField;
text_field_4.role = ax::mojom::Role::kGroup;
text_field_4.child_ids = {generic_container_5.id};

generic_container_5.role = ax::mojom::Role::kGenericContainer;
Expand Down
2 changes: 1 addition & 1 deletion third_party/accessibility/ax/ax_range_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ void AXRangeTest::SetUp() {
check_box2_.AddIntAttribute(ax::mojom::IntAttribute::kPreviousOnLineId,
check_box1_.id);

text_field_.role = ax::mojom::Role::kTextField;
text_field_.role = ax::mojom::Role::kGroup;
text_field_.AddState(ax::mojom::State::kEditable);
text_field_.SetValue(TEXT_FIELD);
text_field_.AddIntListAttribute(
Expand Down
3 changes: 3 additions & 0 deletions third_party/accessibility/ax/ax_role_properties.cc
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,9 @@ bool IsText(ax::mojom::Role role) {
case ax::mojom::Role::kInlineTextBox:
case ax::mojom::Role::kLineBreak:
case ax::mojom::Role::kStaticText:
case ax::mojom::Role::kTextField:
case ax::mojom::Role::kTextFieldWithComboBox:
case ax::mojom::Role::kLabelText:
return true;
default:
return false;
Expand Down