Commit b23fa286 authored by Jose Dapena Paz's avatar Jose Dapena Paz Committed by Commit Bot

A11y: rely on AuraLinux AXPlatformNodeDelegate for getting parent index.

AXPlatformNodeAuraLinux was returning always 0 for GetIndexInParent, and
adding an ATK specific implementation of get_index_in_parent. As a result,
AX API would not return the right value, even if ATK would.

This fix makes get_index_in_parent rely on GetIndexInParent, and
GetIndexInParent use the delegate to obtain the value.

Bug: None.
Change-Id: Ic8d79da9f481c2cf92f28eefeb6b2030cce5e657
Reviewed-on: https://chromium-review.googlesource.com/806037
Commit-Queue: José Dapena Paz <jose.dapena@lge.com>
Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#521720}
parent abbd21da
......@@ -104,20 +104,9 @@ static gint ax_platform_node_auralinux_get_index_in_parent(
ui::AXPlatformNodeAuraLinux* obj =
AtkObjectToAXPlatformNodeAuraLinux(atk_object);
if (!obj || !obj->GetParent())
if (!obj)
return -1;
AtkObject* obj_parent = obj->GetParent();
unsigned child_count = atk_object_get_n_accessible_children(obj_parent);
for (unsigned index = 0; index < child_count; index++) {
AtkObject* child = atk_object_ref_accessible_child(obj_parent, index);
bool atk_object_found = child == atk_object;
g_object_unref(child);
if (atk_object_found)
return index;
}
return obj->GetIndexInParent();
}
......@@ -1086,7 +1075,10 @@ void AXPlatformNodeAuraLinux::NotifyAccessibilityEvent(ui::AXEvent event_type) {
}
int AXPlatformNodeAuraLinux::GetIndexInParent() {
return 0;
if (!GetParent())
return -1;
return delegate_->GetIndexInParent();
}
void AXPlatformNodeAuraLinux::SetExtentsRelativeToAtkCoordinateType(
......
......@@ -167,7 +167,7 @@ AXPlatformNode* TestAXNodeWrapper::GetFromNodeID(int32_t id) {
}
int TestAXNodeWrapper::GetIndexInParent() const {
return -1;
return node_ ? node_->index_in_parent() : -1;
}
gfx::AcceleratedWidget
......
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