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

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

Issue 1010083006: Implement AtkComponent interface 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
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_auralinux.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_auralinux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698