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 85382004c3c9a5e300fc492e0204625296409d1e..bebbf9274e2f94cd4fc3accb1c75c3dccf03521d 100644 |
--- a/ui/accessibility/platform/ax_platform_node_auralinux.cc |
+++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc |
@@ -291,6 +291,7 @@ void AXPlatformNodeAuraLinux::SetApplication(AXPlatformNode* application) { |
} |
AtkRole AXPlatformNodeAuraLinux::GetAtkRole() { |
+ GetWindowCoords(); |
dmazzoni
2015/03/27 19:09:14
I don't think you need to call it here.
shreeramk
2015/03/28 16:59:48
Sorry, by mistake I wrote this. :(
|
switch (GetData().role) { |
case ui::AX_ROLE_ALERT: |
return ATK_ROLE_ALERT; |
@@ -392,4 +393,124 @@ int AXPlatformNodeAuraLinux::GetIndexInParent() { |
return 0; |
} |
+// |
+// ax_platform_node_auralinux AtkComponent interface implementation. |
dmazzoni
2015/03/27 19:09:14
This belongs up above, just before the comment "Th
|
+// |
+ |
+static void ax_component_interface_get_extents(AtkComponent* atk_component, |
dmazzoni
2015/03/27 19:09:14
This should be named ax_platform_node_auralinux_ge
|
+ gint* x, gint* y, |
+ gint* width, gint* height, |
+ AtkCoordType coord_type) { |
+ *x = *y = *width = *height = 0; |
+ AtkObject* atk_object = ATK_OBJECT(atk_component); |
+ ui::AXPlatformNodeAuraLinux* obj = |
+ AtkObjectToAXPlatformNodeAuraLinux(atk_object); |
+ if (!obj) |
+ return; |
+ |
+ obj->GetExtents(x, y, width, height, coord_type); |
+} |
+ |
+static void ax_component_interface_get_position(AtkComponent* atk_component, |
+ gint* x, gint* y, |
+ AtkCoordType coord_type) { |
+ *x = *y = 0; |
+ AtkObject* atk_object = ATK_OBJECT(atk_component); |
+ ui::AXPlatformNodeAuraLinux* obj = |
+ AtkObjectToAXPlatformNodeAuraLinux(atk_object); |
+ if (!obj) |
+ return; |
+ |
+ obj->GetPosition(x, y, coord_type); |
+} |
+ |
+static void ax_component_interface_get_size(AtkComponent* atk_component, |
+ gint* width, gint* height) { |
+ *width = *height = 0; |
+ AtkObject* atk_object = ATK_OBJECT(atk_component); |
+ ui::AXPlatformNodeAuraLinux* obj = |
+ AtkObjectToAXPlatformNodeAuraLinux(atk_object); |
+ if (!obj) |
+ return; |
+ |
+ obj->GetSize(width, height); |
+} |
+ |
+void ax_component_interface_base_init(AtkComponentIface* iface) { |
+ iface->get_extents = ax_component_interface_get_extents; |
dmazzoni
2015/03/27 19:09:14
nit: only indent 2 chars
|
+ iface->get_position = ax_component_interface_get_position; |
+ iface->get_size = ax_component_interface_get_size; |
+} |
+ |
+GType ax_component_auralinux_get_type() { |
dmazzoni
2015/03/27 19:09:14
Where is this called? I don't think we want a sepa
shreeramk
2015/03/28 16:59:48
Actually I don't know/understand like from where i
dmazzoni
2015/03/30 16:21:22
This is what you do when you define a new type. Wh
|
+ static volatile gsize type_volatile = 0; |
+ |
+ if (g_once_init_enter(&type_volatile)) { |
+ static const GTypeInfo tinfo = { |
+ sizeof(AtkComponentIface), |
+ (GBaseInitFunc) ax_component_interface_base_init, |
+ (GBaseFinalizeFunc) 0, |
+ }; |
+ |
+ GType type = g_type_register_static( |
+ ATK_TYPE_COMPONENT, "AtkComponent", &tinfo, GTypeFlags(0)); |
+ g_once_init_leave(&type_volatile, type); |
+ } |
+ |
+ return type_volatile; |
+} |
+ |
+void AXPlatformNodeAuraLinux::GetExtents(gint* x, gint* y, |
+ gint* width, gint* height, |
+ AtkCoordType coord_type) { |
+ gfx::Rect extents = GetBoundsInScreen(); |
+ |
+ *x = extents.x(); |
+ *y = extents.y(); |
+ *width = extents.width(); |
+ *height = extents.height(); |
+ |
+ if (coord_type == ATK_XY_WINDOW) { |
+ gfx::Rect window_coords = GetWindowCoords(); |
+ *x -= window_coords.x(); |
+ *y -= window_coords.y(); |
+ *width -= window_coords.width(); |
+ *height -= window_coords.height(); |
shreeramk
2015/03/27 16:09:13
This calculation is is not required for width n he
|
+ } |
+} |
+ |
+void AXPlatformNodeAuraLinux::GetPosition(gint* x, gint* y, |
+ AtkCoordType coord_type) { |
+ gfx::Rect rect_pos = GetBoundsInScreen(); |
+ |
+ *x = rect_pos.x(); |
+ *y = rect_pos.y(); |
+ |
+ if (coord_type == ATK_XY_WINDOW) { |
+ gfx::Rect window_coords = GetWindowCoords(); |
+ *x -= window_coords.x(); |
+ *y -= window_coords.y(); |
+ } |
+} |
+ |
+void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { |
+ gfx::Rect rect_size = GetData().location; |
+ *width = rect_size.width(); |
+ *height = rect_size.height(); |
+} |
+ |
+gfx::Rect AXPlatformNodeAuraLinux::GetWindowCoords() { |
+ AtkObject* parent = GetParent(); |
+ |
+ ui::AXPlatformNodeAuraLinux* obj = |
+ AtkObjectToAXPlatformNodeAuraLinux(parent); |
dmazzoni
2015/03/27 19:09:14
You need to test this. It's possible that the pare
shreeramk
2015/04/01 11:50:14
Already a check is made in AtkObjectToAXPlatformNo
dmazzoni
2015/04/01 15:31:16
I think that's checking whether |this| is an AXPla
|
+ |
+ if (atk_object_get_role(parent) == ATK_ROLE_WINDOW) { |
+ gfx::Rect window_coords = obj->GetData().location; |
dmazzoni
2015/03/27 19:09:14
Do this using its AtkComponent interface
|
+ return window_coords; |
+ } |
+ |
+ return obj->GetWindowCoords(); |
+} |
+ |
} // namespace ui |