Chromium Code Reviews| 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..b9d99f0ee473a52a87613ebfae008c36ae3b3b67 100644 |
| --- a/ui/accessibility/platform/ax_platform_node_auralinux.cc |
| +++ b/ui/accessibility/platform/ax_platform_node_auralinux.cc |
| @@ -392,4 +392,104 @@ int AXPlatformNodeAuraLinux::GetIndexInParent() { |
| return 0; |
| } |
| +// |
| +// ax_platform_node_auralinux AtkComponent interface implementation. |
| +// |
| + |
| +static void ax_component_interface_get_extents(AtkComponent* atk_component, |
| + 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; |
| + iface->get_position = ax_component_interface_get_position; |
| + iface->get_size = ax_component_interface_get_size; |
| +} |
| + |
| +GType ax_component_auralinux_get_type() { |
| + 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(); |
| + |
| + if (coord_type == ATK_XY_WINDOW) { |
| + // Not able to find any api to get screen coords for window |
|
shreeramk
2015/03/26 05:25:15
Need some input here.
dmazzoni
2015/03/26 15:44:47
Keep taking the parent of this object until you re
|
| + } |
| + |
| + *x = extents.x(); |
| + *y = extents.y(); |
| + *width = extents.width(); |
| + *height = extents.height(); |
| +} |
| + |
| +void AXPlatformNodeAuraLinux::GetPosition(gint* x, gint* y, |
| + AtkCoordType coord_type) { |
| + gfx::Rect rect_pos = GetBoundsInScreen(); |
| + |
| + if (coord_type == ATK_XY_WINDOW) { |
| + // Not able to find any api to get screen coords for window |
| + } |
| + |
| + *x = rect_pos.x(); |
| + *y = rect_pos.y(); |
| +} |
| + |
| +void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { |
| + gfx::Rect rect_size = GetData().location; |
| + *width = rect_size.width(); |
| + *height = rect_size.height(); |
| +} |
| + |
| } // namespace ui |