| 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 "base/task_runner.h" | 9 #include "base/task_runner.h" |
| 10 #include "ui/accessibility/ax_node_data.h" | 10 #include "ui/accessibility/ax_node_data.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 atk_object = atk_object_get_parent(atk_object); | 198 atk_object = atk_object_get_parent(atk_object); |
| 199 | 199 |
| 200 return FindAtkObjectParentCoords(atk_object); | 200 return FindAtkObjectParentCoords(atk_object); |
| 201 } | 201 } |
| 202 | 202 |
| 203 static void ax_platform_node_auralinux_get_extents(AtkComponent* atk_component, | 203 static void ax_platform_node_auralinux_get_extents(AtkComponent* atk_component, |
| 204 gint* x, gint* y, | 204 gint* x, gint* y, |
| 205 gint* width, gint* height, | 205 gint* width, gint* height, |
| 206 AtkCoordType coord_type) { | 206 AtkCoordType coord_type) { |
| 207 *x = *y = *width = *height = 0; | 207 g_return_if_fail(ATK_IS_COMPONENT(atk_component)); |
| 208 |
| 209 if (x) |
| 210 *x = 0; |
| 211 if (y) |
| 212 *y = 0; |
| 213 if (width) |
| 214 *width = 0; |
| 215 if (height) |
| 216 *height = 0; |
| 217 |
| 208 AtkObject* atk_object = ATK_OBJECT(atk_component); | 218 AtkObject* atk_object = ATK_OBJECT(atk_component); |
| 209 ui::AXPlatformNodeAuraLinux* obj = | 219 ui::AXPlatformNodeAuraLinux* obj = |
| 210 AtkObjectToAXPlatformNodeAuraLinux(atk_object); | 220 AtkObjectToAXPlatformNodeAuraLinux(atk_object); |
| 211 if (!obj) | 221 if (!obj) |
| 212 return; | 222 return; |
| 213 | 223 |
| 214 obj->GetExtents(x, y, width, height, coord_type); | 224 obj->GetExtents(x, y, width, height, coord_type); |
| 215 } | 225 } |
| 216 | 226 |
| 217 static void ax_platform_node_auralinux_get_position(AtkComponent* atk_component, | 227 static void ax_platform_node_auralinux_get_position(AtkComponent* atk_component, |
| 218 gint* x, gint* y, | 228 gint* x, gint* y, |
| 219 AtkCoordType coord_type) { | 229 AtkCoordType coord_type) { |
| 220 *x = *y = 0; | 230 g_return_if_fail(ATK_IS_COMPONENT(atk_component)); |
| 231 |
| 232 if (x) |
| 233 *x = 0; |
| 234 if (y) |
| 235 *y = 0; |
| 236 |
| 221 AtkObject* atk_object = ATK_OBJECT(atk_component); | 237 AtkObject* atk_object = ATK_OBJECT(atk_component); |
| 222 ui::AXPlatformNodeAuraLinux* obj = | 238 ui::AXPlatformNodeAuraLinux* obj = |
| 223 AtkObjectToAXPlatformNodeAuraLinux(atk_object); | 239 AtkObjectToAXPlatformNodeAuraLinux(atk_object); |
| 224 if (!obj) | 240 if (!obj) |
| 225 return; | 241 return; |
| 226 | 242 |
| 227 obj->GetPosition(x, y, coord_type); | 243 obj->GetPosition(x, y, coord_type); |
| 228 } | 244 } |
| 229 | 245 |
| 230 static void ax_platform_node_auralinux_get_size(AtkComponent* atk_component, | 246 static void ax_platform_node_auralinux_get_size(AtkComponent* atk_component, |
| 231 gint* width, gint* height) { | 247 gint* width, gint* height) { |
| 232 *width = *height = 0; | 248 g_return_if_fail(ATK_IS_COMPONENT(atk_component)); |
| 249 |
| 250 if (width) |
| 251 *width = 0; |
| 252 if (height) |
| 253 *height = 0; |
| 254 |
| 233 AtkObject* atk_object = ATK_OBJECT(atk_component); | 255 AtkObject* atk_object = ATK_OBJECT(atk_component); |
| 234 ui::AXPlatformNodeAuraLinux* obj = | 256 ui::AXPlatformNodeAuraLinux* obj = |
| 235 AtkObjectToAXPlatformNodeAuraLinux(atk_object); | 257 AtkObjectToAXPlatformNodeAuraLinux(atk_object); |
| 236 if (!obj) | 258 if (!obj) |
| 237 return; | 259 return; |
| 238 | 260 |
| 239 obj->GetSize(width, height); | 261 obj->GetSize(width, height); |
| 240 } | 262 } |
| 241 | 263 |
| 242 void ax_component_interface_base_init(AtkComponentIface* iface) { | 264 void ax_component_interface_base_init(AtkComponentIface* iface) { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 return atk_object_; | 480 return atk_object_; |
| 459 } | 481 } |
| 460 | 482 |
| 461 void AXPlatformNodeAuraLinux::NotifyAccessibilityEvent(ui::AXEvent event_type) { | 483 void AXPlatformNodeAuraLinux::NotifyAccessibilityEvent(ui::AXEvent event_type) { |
| 462 } | 484 } |
| 463 | 485 |
| 464 int AXPlatformNodeAuraLinux::GetIndexInParent() { | 486 int AXPlatformNodeAuraLinux::GetIndexInParent() { |
| 465 return 0; | 487 return 0; |
| 466 } | 488 } |
| 467 | 489 |
| 490 void AXPlatformNodeAuraLinux::SetExtentsRelativeToAtkCoordinateType( |
| 491 gint* x, gint* y, gint* width, gint* height, AtkCoordType coord_type) { |
| 492 gfx::Rect extents = GetBoundsInScreen(); |
| 493 |
| 494 if (x) |
| 495 *x = extents.x(); |
| 496 if (y) |
| 497 *y = extents.y(); |
| 498 if (width) |
| 499 *width = extents.width(); |
| 500 if (height) |
| 501 *height = extents.height(); |
| 502 |
| 503 if (coord_type == ATK_XY_WINDOW) { |
| 504 AtkObject* atk_object = GetParent(); |
| 505 gfx::Point window_coords = FindAtkObjectParentCoords(atk_object); |
| 506 if (x) |
| 507 *x -= window_coords.x(); |
| 508 if (y) |
| 509 *y -= window_coords.y(); |
| 510 } |
| 511 } |
| 512 |
| 468 void AXPlatformNodeAuraLinux::GetExtents(gint* x, gint* y, | 513 void AXPlatformNodeAuraLinux::GetExtents(gint* x, gint* y, |
| 469 gint* width, gint* height, | 514 gint* width, gint* height, |
| 470 AtkCoordType coord_type) { | 515 AtkCoordType coord_type) { |
| 471 gfx::Rect extents = GetBoundsInScreen(); | 516 SetExtentsRelativeToAtkCoordinateType(x, y, |
| 472 | 517 width, height, |
| 473 *x = extents.x(); | 518 coord_type); |
| 474 *y = extents.y(); | |
| 475 *width = extents.width(); | |
| 476 *height = extents.height(); | |
| 477 | |
| 478 if (coord_type == ATK_XY_WINDOW) { | |
| 479 AtkObject* atk_object = GetParent(); | |
| 480 gfx::Point window_coords = FindAtkObjectParentCoords(atk_object); | |
| 481 *x -= window_coords.x(); | |
| 482 *y -= window_coords.y(); | |
| 483 } | |
| 484 } | 519 } |
| 485 | 520 |
| 486 void AXPlatformNodeAuraLinux::GetPosition(gint* x, gint* y, | 521 void AXPlatformNodeAuraLinux::GetPosition(gint* x, gint* y, |
| 487 AtkCoordType coord_type) { | 522 AtkCoordType coord_type) { |
| 488 gfx::Rect rect_pos = GetBoundsInScreen(); | 523 SetExtentsRelativeToAtkCoordinateType(x, y, |
| 489 | 524 nullptr,nullptr, |
| 490 *x = rect_pos.x(); | 525 coord_type); |
| 491 *y = rect_pos.y(); | |
| 492 | |
| 493 if (coord_type == ATK_XY_WINDOW) { | |
| 494 AtkObject* atk_object = GetParent(); | |
| 495 gfx::Point window_coords = FindAtkObjectParentCoords(atk_object); | |
| 496 *x -= window_coords.x(); | |
| 497 *y -= window_coords.y(); | |
| 498 } | |
| 499 } | 526 } |
| 500 | 527 |
| 501 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { | 528 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { |
| 502 gfx::Rect rect_size = GetData().location; | 529 gfx::Rect rect_size = GetData().location; |
| 503 *width = rect_size.width(); | 530 if (width) |
| 504 *height = rect_size.height(); | 531 *width = rect_size.width(); |
| 532 if (height) |
| 533 *height = rect_size.height(); |
| 505 } | 534 } |
| 506 | 535 |
| 507 } // namespace ui | 536 } // namespace ui |
| OLD | NEW |