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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 return ATK_ROLE_SECTION; | 448 return ATK_ROLE_SECTION; |
449 #endif | 449 #endif |
450 case ui::AX_ROLE_WINDOW: | 450 case ui::AX_ROLE_WINDOW: |
451 return ATK_ROLE_WINDOW; | 451 return ATK_ROLE_WINDOW; |
452 default: | 452 default: |
453 return ATK_ROLE_UNKNOWN; | 453 return ATK_ROLE_UNKNOWN; |
454 } | 454 } |
455 } | 455 } |
456 | 456 |
457 void AXPlatformNodeAuraLinux::GetAtkState(AtkStateSet* atk_state_set) { | 457 void AXPlatformNodeAuraLinux::GetAtkState(AtkStateSet* atk_state_set) { |
458 uint32_t state = GetData().state; | 458 const uint32_t state = GetData().state; |
459 | 459 |
460 if (state & (1 << ui::AX_STATE_CHECKED)) | |
461 atk_state_set_add_state(atk_state_set, ATK_STATE_CHECKED); | |
462 if (state & (1 << ui::AX_STATE_DEFAULT)) | 460 if (state & (1 << ui::AX_STATE_DEFAULT)) |
463 atk_state_set_add_state(atk_state_set, ATK_STATE_DEFAULT); | 461 atk_state_set_add_state(atk_state_set, ATK_STATE_DEFAULT); |
464 if (state & (1 << ui::AX_STATE_EDITABLE)) | 462 if (state & (1 << ui::AX_STATE_EDITABLE)) |
465 atk_state_set_add_state(atk_state_set, ATK_STATE_EDITABLE); | 463 atk_state_set_add_state(atk_state_set, ATK_STATE_EDITABLE); |
466 if (!(state & (1 << ui::AX_STATE_DISABLED))) | 464 if (!(state & (1 << ui::AX_STATE_DISABLED))) |
467 atk_state_set_add_state(atk_state_set, ATK_STATE_ENABLED); | 465 atk_state_set_add_state(atk_state_set, ATK_STATE_ENABLED); |
468 if (state & (1 << ui::AX_STATE_EXPANDED)) | 466 if (state & (1 << ui::AX_STATE_EXPANDED)) |
469 atk_state_set_add_state(atk_state_set, ATK_STATE_EXPANDED); | 467 atk_state_set_add_state(atk_state_set, ATK_STATE_EXPANDED); |
470 if (state & (1 << ui::AX_STATE_FOCUSABLE)) | 468 if (state & (1 << ui::AX_STATE_FOCUSABLE)) |
471 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSABLE); | 469 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSABLE); |
472 if (state & (1 << ui::AX_STATE_PRESSED)) | 470 if (state & (1 << ui::AX_STATE_PRESSED)) |
473 atk_state_set_add_state(atk_state_set, ATK_STATE_PRESSED); | 471 atk_state_set_add_state(atk_state_set, ATK_STATE_PRESSED); |
474 if (state & (1 << ui::AX_STATE_SELECTABLE)) | 472 if (state & (1 << ui::AX_STATE_SELECTABLE)) |
475 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTABLE); | 473 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTABLE); |
476 if (state & (1 << ui::AX_STATE_SELECTED)) | 474 if (state & (1 << ui::AX_STATE_SELECTED)) |
477 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTED); | 475 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTED); |
478 | 476 |
| 477 // Checked state |
| 478 const int checked = GetIntAttribute(ui::AX_ATTR_CHECKED_STATE); |
| 479 switch (checked) { |
| 480 case ui::AX_CHECKED_STATE_MIXED: |
| 481 atk_state_set_add_state(atk_state_set, ATK_STATE_INDETERMINATE); |
| 482 break; |
| 483 case ui::AX_CHECKED_STATE_TRUE: |
| 484 atk_state_set_add_state(atk_state_set, ATK_STATE_CHECKED); |
| 485 break; |
| 486 default: |
| 487 break; |
| 488 } |
| 489 |
479 if (delegate_->GetFocus() == GetNativeViewAccessible()) | 490 if (delegate_->GetFocus() == GetNativeViewAccessible()) |
480 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSED); | 491 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSED); |
481 } | 492 } |
482 | 493 |
483 void AXPlatformNodeAuraLinux::GetAtkRelations(AtkRelationSet* atk_relation_set) | 494 void AXPlatformNodeAuraLinux::GetAtkRelations(AtkRelationSet* atk_relation_set) |
484 { | 495 { |
485 } | 496 } |
486 | 497 |
487 AXPlatformNodeAuraLinux::AXPlatformNodeAuraLinux() | 498 AXPlatformNodeAuraLinux::AXPlatformNodeAuraLinux() |
488 : atk_object_(nullptr) { | 499 : atk_object_(nullptr) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 | 561 |
551 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { | 562 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { |
552 gfx::Rect rect_size = gfx::ToEnclosingRect(GetData().location); | 563 gfx::Rect rect_size = gfx::ToEnclosingRect(GetData().location); |
553 if (width) | 564 if (width) |
554 *width = rect_size.width(); | 565 *width = rect_size.width(); |
555 if (height) | 566 if (height) |
556 *height = rect_size.height(); | 567 *height = rect_size.height(); |
557 } | 568 } |
558 | 569 |
559 } // namespace ui | 570 } // namespace ui |
OLD | NEW |