| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 return ATK_ROLE_SECTION; | 454 return ATK_ROLE_SECTION; |
| 455 #endif | 455 #endif |
| 456 case ui::AX_ROLE_WINDOW: | 456 case ui::AX_ROLE_WINDOW: |
| 457 return ATK_ROLE_WINDOW; | 457 return ATK_ROLE_WINDOW; |
| 458 default: | 458 default: |
| 459 return ATK_ROLE_UNKNOWN; | 459 return ATK_ROLE_UNKNOWN; |
| 460 } | 460 } |
| 461 } | 461 } |
| 462 | 462 |
| 463 void AXPlatformNodeAuraLinux::GetAtkState(AtkStateSet* atk_state_set) { | 463 void AXPlatformNodeAuraLinux::GetAtkState(AtkStateSet* atk_state_set) { |
| 464 uint32_t state = GetData().state; | 464 const uint32_t state = GetData().state; |
| 465 | 465 |
| 466 if (state & (1 << ui::AX_STATE_CHECKED)) | |
| 467 atk_state_set_add_state(atk_state_set, ATK_STATE_CHECKED); | |
| 468 if (state & (1 << ui::AX_STATE_DEFAULT)) | 466 if (state & (1 << ui::AX_STATE_DEFAULT)) |
| 469 atk_state_set_add_state(atk_state_set, ATK_STATE_DEFAULT); | 467 atk_state_set_add_state(atk_state_set, ATK_STATE_DEFAULT); |
| 470 if (state & (1 << ui::AX_STATE_EDITABLE)) | 468 if (state & (1 << ui::AX_STATE_EDITABLE)) |
| 471 atk_state_set_add_state(atk_state_set, ATK_STATE_EDITABLE); | 469 atk_state_set_add_state(atk_state_set, ATK_STATE_EDITABLE); |
| 472 if (!(state & (1 << ui::AX_STATE_DISABLED))) | 470 if (!(state & (1 << ui::AX_STATE_DISABLED))) |
| 473 atk_state_set_add_state(atk_state_set, ATK_STATE_ENABLED); | 471 atk_state_set_add_state(atk_state_set, ATK_STATE_ENABLED); |
| 474 if (state & (1 << ui::AX_STATE_EXPANDED)) | 472 if (state & (1 << ui::AX_STATE_EXPANDED)) |
| 475 atk_state_set_add_state(atk_state_set, ATK_STATE_EXPANDED); | 473 atk_state_set_add_state(atk_state_set, ATK_STATE_EXPANDED); |
| 476 if (state & (1 << ui::AX_STATE_FOCUSABLE)) | 474 if (state & (1 << ui::AX_STATE_FOCUSABLE)) |
| 477 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSABLE); | 475 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSABLE); |
| 478 if (state & (1 << ui::AX_STATE_PRESSED)) | 476 if (state & (1 << ui::AX_STATE_PRESSED)) |
| 479 atk_state_set_add_state(atk_state_set, ATK_STATE_PRESSED); | 477 atk_state_set_add_state(atk_state_set, ATK_STATE_PRESSED); |
| 480 if (state & (1 << ui::AX_STATE_SELECTABLE)) | 478 if (state & (1 << ui::AX_STATE_SELECTABLE)) |
| 481 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTABLE); | 479 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTABLE); |
| 482 if (state & (1 << ui::AX_STATE_SELECTED)) | 480 if (state & (1 << ui::AX_STATE_SELECTED)) |
| 483 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTED); | 481 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTED); |
| 484 | 482 |
| 483 // Checked state |
| 484 const auto checked_state = static_cast<ui::AXCheckedState>( |
| 485 GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); |
| 486 switch (checked_state) { |
| 487 case ui::AX_CHECKED_STATE_MIXED: |
| 488 atk_state_set_add_state(atk_state_set, ATK_STATE_INDETERMINATE); |
| 489 break; |
| 490 case ui::AX_CHECKED_STATE_TRUE: |
| 491 atk_state_set_add_state(atk_state_set, ATK_STATE_CHECKED); |
| 492 break; |
| 493 default: |
| 494 break; |
| 495 } |
| 496 |
| 485 if (delegate_->GetFocus() == GetNativeViewAccessible()) | 497 if (delegate_->GetFocus() == GetNativeViewAccessible()) |
| 486 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSED); | 498 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSED); |
| 487 } | 499 } |
| 488 | 500 |
| 489 void AXPlatformNodeAuraLinux::GetAtkRelations(AtkRelationSet* atk_relation_set) | 501 void AXPlatformNodeAuraLinux::GetAtkRelations(AtkRelationSet* atk_relation_set) |
| 490 { | 502 { |
| 491 } | 503 } |
| 492 | 504 |
| 493 AXPlatformNodeAuraLinux::AXPlatformNodeAuraLinux() | 505 AXPlatformNodeAuraLinux::AXPlatformNodeAuraLinux() |
| 494 : atk_object_(nullptr) { | 506 : atk_object_(nullptr) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 | 568 |
| 557 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { | 569 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { |
| 558 gfx::Rect rect_size = gfx::ToEnclosingRect(GetData().location); | 570 gfx::Rect rect_size = gfx::ToEnclosingRect(GetData().location); |
| 559 if (width) | 571 if (width) |
| 560 *width = rect_size.width(); | 572 *width = rect_size.width(); |
| 561 if (height) | 573 if (height) |
| 562 *height = rect_size.height(); | 574 *height = rect_size.height(); |
| 563 } | 575 } |
| 564 | 576 |
| 565 } // namespace ui | 577 } // namespace ui |
| OLD | NEW |