summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorshreeram.k <shreeram.k@samsung.com>2015-03-23 20:42:12 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-24 03:42:52 +0000
commit7d5426fdb05ade9631fa3d9d0fe6135b272eb147 (patch)
treed71cc2ce23aa1efa11ffc7ca3a541eb1bd1c3b39 /ui
parentd19f5200062542283ffc6ab281ea961e481b5846 (diff)
downloadchromium_src-7d5426fdb05ade9631fa3d9d0fe6135b272eb147.zip
chromium_src-7d5426fdb05ade9631fa3d9d0fe6135b272eb147.tar.gz
chromium_src-7d5426fdb05ade9631fa3d9d0fe6135b272eb147.tar.bz2
Implementing ATK functions get_index_in_parent & ref_relation_set for Chrome UI
BUG=463671 Review URL: https://codereview.chromium.org/1029043002 Cr-Commit-Position: refs/heads/master@{#321929}
Diffstat (limited to 'ui')
-rw-r--r--ui/accessibility/platform/ax_platform_node_auralinux.cc43
-rw-r--r--ui/accessibility/platform/ax_platform_node_auralinux.h1
2 files changed, 44 insertions, 0 deletions
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.cc b/ui/accessibility/platform/ax_platform_node_auralinux.cc
index ad55def..3ecb4e4 100644
--- a/ui/accessibility/platform/ax_platform_node_auralinux.cc
+++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc
@@ -86,6 +86,28 @@ 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) {
+ 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;
+ g_object_unref(child);
+ 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 +139,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->GetAtkRelations(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 +212,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 +354,10 @@ void AXPlatformNodeAuraLinux::GetAtkState(AtkStateSet* state_set) {
atk_state_set_add_state(state_set, ATK_STATE_SELECTED);
}
+void AXPlatformNodeAuraLinux::GetAtkRelations(AtkRelationSet* atk_relation_set)
+{
+}
+
AXPlatformNodeAuraLinux::AXPlatformNodeAuraLinux()
: atk_object_(nullptr) {
}
diff --git a/ui/accessibility/platform/ax_platform_node_auralinux.h b/ui/accessibility/platform/ax_platform_node_auralinux.h
index 030a66a..8f86bc7 100644
--- a/ui/accessibility/platform/ax_platform_node_auralinux.h
+++ b/ui/accessibility/platform/ax_platform_node_auralinux.h
@@ -24,6 +24,7 @@ class AXPlatformNodeAuraLinux : public AXPlatformNodeBase {
AtkRole GetAtkRole();
void GetAtkState(AtkStateSet* state_set);
+ void GetAtkRelations(AtkRelationSet* atk_relation_set);
// AXPlatformNode overrides.
void Destroy() override;