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