Commit 7c83db4f authored by Lucas Radaelli's avatar Lucas Radaelli Committed by Commit Bot

[fuchsia][a11y] Fills scroll offsets in semantic nodes.

Nodes that are scrollable containers contain scroll offset data. This
change fills these offsets when converting to a Fuchsia node.

Test: AXTreeConverterTest.*
Bug: fuchsia:60263
Change-Id: Ie0a16e7f326cb0f37097fca9f22dfe11c24d27b2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2490250
Commit-Queue: Lucas Radaelli <lucasradaelli@google.com>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarSharon Yang <yangsharon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#821867}
parent 131b390f
...@@ -145,6 +145,14 @@ fuchsia::accessibility::semantics::States ConvertStates( ...@@ -145,6 +145,14 @@ fuchsia::accessibility::semantics::States ConvertStates(
node.GetFloatAttribute(ax::mojom::FloatAttribute::kValueForRange)); node.GetFloatAttribute(ax::mojom::FloatAttribute::kValueForRange));
} }
// The scroll offsets, if the element is a scrollable container.
const auto x_scroll_offset =
node.GetIntAttribute(ax::mojom::IntAttribute::kScrollX);
const auto y_scroll_offset =
node.GetIntAttribute(ax::mojom::IntAttribute::kScrollY);
if (x_scroll_offset || y_scroll_offset)
states.set_viewport_offset({x_scroll_offset, y_scroll_offset});
return states; return states;
} }
......
...@@ -91,7 +91,9 @@ std::pair<ui::AXNodeData, Node> CreateSemanticNodeAllFieldsSet() { ...@@ -91,7 +91,9 @@ std::pair<ui::AXNodeData, Node> CreateSemanticNodeAllFieldsSet() {
std::vector<int32_t>{kChildId1, kChildId2, kChildId3}, relative_bounds, std::vector<int32_t>{kChildId1, kChildId2, kChildId3}, relative_bounds,
kLabel1, kDescription1, ax::mojom::CheckedState::kMixed); kLabel1, kDescription1, ax::mojom::CheckedState::kMixed);
ax_node_data.AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, false); ax_node_data.AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, false);
ax_node_data.AddIntAttribute(ax::mojom::IntAttribute::kScrollX, 10);
ax_node_data.RemoveState(ax::mojom::State::kIgnored); ax_node_data.RemoveState(ax::mojom::State::kIgnored);
ax_node_data.AddIntAttribute(ax::mojom::IntAttribute::kScrollY, 20);
ax_node_data.id = kChildId1; ax_node_data.id = kChildId1;
Attributes attributes; Attributes attributes;
...@@ -107,6 +109,7 @@ std::pair<ui::AXNodeData, Node> CreateSemanticNodeAllFieldsSet() { ...@@ -107,6 +109,7 @@ std::pair<ui::AXNodeData, Node> CreateSemanticNodeAllFieldsSet() {
states.set_checked_state(CheckedState::MIXED); states.set_checked_state(CheckedState::MIXED);
states.set_hidden(false); states.set_hidden(false);
states.set_selected(false); states.set_selected(false);
states.set_viewport_offset({10, 20});
auto fuchsia_node = CreateSemanticNode( auto fuchsia_node = CreateSemanticNode(
ConvertToFuchsiaNodeId(ax_node_data.id, kRootId), Role::BUTTON, ConvertToFuchsiaNodeId(ax_node_data.id, kRootId), Role::BUTTON,
std::move(attributes), std::move(states), std::move(attributes), std::move(states),
......
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