Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Unified Diff: ui/accessibility/platform/ax_platform_node_auralinux.cc

Issue 1029043002: Implementing ATK functions get_index_in_parent & ref_relation_set for Chrome UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/accessibility/platform/ax_platform_node_auralinux.cc
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.cc b/ui/accessibility/platform/ax_platform_node_auralinux.cc
index ad55defc5a2f43d11c4738eb4a2b8803eadbd29c..94ee140d36de5a9e1fd484c5d5a3428aa25afa03 100644
--- a/ui/accessibility/platform/ax_platform_node_auralinux.cc
+++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc
@@ -86,6 +86,29 @@ static const gchar* ax_platform_node_auralinux_get_description(
ui::AX_ATTR_DESCRIPTION).c_str();
}
+static gint ax_platform_node_auralinux_get_index_in_parent(
+ AtkObject* atk_object) {
+
dmazzoni 2015/03/23 22:19:57 nit: get rid of this blank line at the beginning o
+ ui::AXPlatformNodeAuraLinux* obj =
+ AtkObjectToAXPlatformNodeAuraLinux(atk_object);
+
+ if (!obj || !obj->GetParent())
+ 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)?true:false;
dmazzoni 2015/03/23 22:19:57 nit: git rid of "?true:false", it's not needed
+ g_object_unref(child);
dmazzoni 2015/03/23 22:19:57 in a separate changelist, could you look into the
+ if (atk_object_found)
+ return index;
+ }
+
+ return obj->GetIndexInParent();
+}
+
static AtkObject* ax_platform_node_auralinux_get_parent(AtkObject* atk_object) {
ui::AXPlatformNodeAuraLinux* obj =
AtkObjectToAXPlatformNodeAuraLinux(atk_object);
@@ -117,6 +140,21 @@ static AtkObject* ax_platform_node_auralinux_ref_child(
return result;
}
+static AtkRelationSet* ax_platform_node_auralinux_ref_relation_set(
+ AtkObject* atk_object) {
+ ui::AXPlatformNodeAuraLinux* obj =
+ AtkObjectToAXPlatformNodeAuraLinux(atk_object);
+ AtkRelationSet* atk_relation_set =
+ ATK_OBJECT_CLASS(ax_platform_node_auralinux_parent_class)->
+ ref_relation_set(atk_object);
+
+ if (!obj)
+ return atk_relation_set;
+
+ obj->GetAtkRelation(atk_relation_set);
+ return atk_relation_set;
+}
+
static AtkRole ax_platform_node_auralinux_get_role(AtkObject* atk_object) {
ui::AXPlatformNodeAuraLinux* obj =
AtkObjectToAXPlatformNodeAuraLinux(atk_object);
@@ -175,6 +213,8 @@ static void ax_platform_node_auralinux_class_init(AtkObjectClass* klass) {
klass->ref_child = ax_platform_node_auralinux_ref_child;
klass->get_role = ax_platform_node_auralinux_get_role;
klass->ref_state_set = ax_platform_node_auralinux_ref_state_set;
+ klass->get_index_in_parent = ax_platform_node_auralinux_get_index_in_parent;
+ klass->ref_relation_set = ax_platform_node_auralinux_ref_relation_set;
}
GType ax_platform_node_auralinux_get_type() {
@@ -315,6 +355,10 @@ void AXPlatformNodeAuraLinux::GetAtkState(AtkStateSet* state_set) {
atk_state_set_add_state(state_set, ATK_STATE_SELECTED);
}
+void AXPlatformNodeAuraLinux::GetAtkRelation(AtkRelationSet* atk_relation_set) {
+ return;
dmazzoni 2015/03/23 22:19:57 nit: no "return", just leave it blank.
+}
+
AXPlatformNodeAuraLinux::AXPlatformNodeAuraLinux()
: atk_object_(nullptr) {
}

Powered by Google App Engine
This is Rietveld 408576698