Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/accessibility/platform/ax_platform_node_auralinux.h" | 5 #include "ui/accessibility/platform/ax_platform_node_auralinux.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
| 9 #include "ui/accessibility/ax_node_data.h" | 9 #include "ui/accessibility/ax_node_data.h" |
| 10 #include "ui/accessibility/platform/atk_util_auralinux.h" | 10 #include "ui/accessibility/platform/atk_util_auralinux.h" |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 385 return atk_object_; | 385 return atk_object_; |
| 386 } | 386 } |
| 387 | 387 |
| 388 void AXPlatformNodeAuraLinux::NotifyAccessibilityEvent(ui::AXEvent event_type) { | 388 void AXPlatformNodeAuraLinux::NotifyAccessibilityEvent(ui::AXEvent event_type) { |
| 389 } | 389 } |
| 390 | 390 |
| 391 int AXPlatformNodeAuraLinux::GetIndexInParent() { | 391 int AXPlatformNodeAuraLinux::GetIndexInParent() { |
| 392 return 0; | 392 return 0; |
| 393 } | 393 } |
| 394 | 394 |
| 395 // | |
| 396 // ax_platform_node_auralinux AtkComponent interface implementation. | |
| 397 // | |
| 398 | |
| 399 static void ax_component_interface_get_extents(AtkComponent* atk_component, | |
| 400 gint* x, gint* y, | |
| 401 gint* width, gint* height, | |
| 402 AtkCoordType coord_type) { | |
| 403 *x = *y = *width = *height = 0; | |
| 404 AtkObject* atk_object = ATK_OBJECT(atk_component); | |
| 405 ui::AXPlatformNodeAuraLinux* obj = | |
| 406 AtkObjectToAXPlatformNodeAuraLinux(atk_object); | |
| 407 if (!obj) | |
| 408 return; | |
| 409 | |
| 410 obj->GetExtents(x, y, width, height, coord_type); | |
| 411 } | |
| 412 | |
| 413 static void ax_component_interface_get_position(AtkComponent* atk_component, | |
| 414 gint* x, gint* y, | |
| 415 AtkCoordType coord_type) { | |
| 416 *x = *y = 0; | |
| 417 AtkObject* atk_object = ATK_OBJECT(atk_component); | |
| 418 ui::AXPlatformNodeAuraLinux* obj = | |
| 419 AtkObjectToAXPlatformNodeAuraLinux(atk_object); | |
| 420 if (!obj) | |
| 421 return; | |
| 422 | |
| 423 obj->GetPosition(x, y, coord_type); | |
| 424 } | |
| 425 | |
| 426 static void ax_component_interface_get_size(AtkComponent* atk_component, | |
| 427 gint* width, gint* height) { | |
| 428 *width = *height = 0; | |
| 429 AtkObject* atk_object = ATK_OBJECT(atk_component); | |
| 430 ui::AXPlatformNodeAuraLinux* obj = | |
| 431 AtkObjectToAXPlatformNodeAuraLinux(atk_object); | |
| 432 if (!obj) | |
| 433 return; | |
| 434 | |
| 435 obj->GetSize(width, height); | |
| 436 } | |
| 437 | |
| 438 void ax_component_interface_base_init(AtkComponentIface* iface) { | |
| 439 iface->get_extents = ax_component_interface_get_extents; | |
| 440 iface->get_position = ax_component_interface_get_position; | |
| 441 iface->get_size = ax_component_interface_get_size; | |
| 442 } | |
| 443 | |
| 444 GType ax_component_auralinux_get_type() { | |
| 445 static volatile gsize type_volatile = 0; | |
| 446 | |
| 447 if (g_once_init_enter(&type_volatile)) { | |
| 448 static const GTypeInfo tinfo = { | |
| 449 sizeof(AtkComponentIface), | |
| 450 (GBaseInitFunc) ax_component_interface_base_init, | |
| 451 (GBaseFinalizeFunc) 0, | |
| 452 }; | |
| 453 | |
| 454 GType type = g_type_register_static( | |
| 455 ATK_TYPE_COMPONENT, "AtkComponent", &tinfo, GTypeFlags(0)); | |
| 456 g_once_init_leave(&type_volatile, type); | |
| 457 } | |
| 458 | |
| 459 return type_volatile; | |
| 460 } | |
| 461 | |
| 462 void AXPlatformNodeAuraLinux::GetExtents(gint* x, gint* y, | |
| 463 gint* width, gint* height, | |
| 464 AtkCoordType coord_type) { | |
| 465 gfx::Rect extents = GetBoundsInScreen(); | |
| 466 | |
| 467 if (coord_type == ATK_XY_WINDOW) { | |
| 468 // 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
| |
| 469 } | |
| 470 | |
| 471 *x = extents.x(); | |
| 472 *y = extents.y(); | |
| 473 *width = extents.width(); | |
| 474 *height = extents.height(); | |
| 475 } | |
| 476 | |
| 477 void AXPlatformNodeAuraLinux::GetPosition(gint* x, gint* y, | |
| 478 AtkCoordType coord_type) { | |
| 479 gfx::Rect rect_pos = GetBoundsInScreen(); | |
| 480 | |
| 481 if (coord_type == ATK_XY_WINDOW) { | |
| 482 // Not able to find any api to get screen coords for window | |
| 483 } | |
| 484 | |
| 485 *x = rect_pos.x(); | |
| 486 *y = rect_pos.y(); | |
| 487 } | |
| 488 | |
| 489 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { | |
| 490 gfx::Rect rect_size = GetData().location; | |
| 491 *width = rect_size.width(); | |
| 492 *height = rect_size.height(); | |
| 493 } | |
| 494 | |
| 395 } // namespace ui | 495 } // namespace ui |
| OLD | NEW |