| 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 const uint32_t state = GetData().state; | 464 AXNodeData data = GetData(); |
| 465 | 465 if (data.HasState(ui::AX_STATE_DEFAULT)) |
| 466 if (state & (1 << ui::AX_STATE_DEFAULT)) | |
| 467 atk_state_set_add_state(atk_state_set, ATK_STATE_DEFAULT); | 466 atk_state_set_add_state(atk_state_set, ATK_STATE_DEFAULT); |
| 468 if (state & (1 << ui::AX_STATE_EDITABLE)) | 467 if (data.HasState(ui::AX_STATE_EDITABLE)) |
| 469 atk_state_set_add_state(atk_state_set, ATK_STATE_EDITABLE); | 468 atk_state_set_add_state(atk_state_set, ATK_STATE_EDITABLE); |
| 470 if (!(state & (1 << ui::AX_STATE_DISABLED))) | 469 if (!data.HasState(ui::AX_STATE_DISABLED)) |
| 471 atk_state_set_add_state(atk_state_set, ATK_STATE_ENABLED); | 470 atk_state_set_add_state(atk_state_set, ATK_STATE_ENABLED); |
| 472 if (state & (1 << ui::AX_STATE_EXPANDED)) | 471 if (data.HasState(ui::AX_STATE_EXPANDED)) |
| 473 atk_state_set_add_state(atk_state_set, ATK_STATE_EXPANDED); | 472 atk_state_set_add_state(atk_state_set, ATK_STATE_EXPANDED); |
| 474 if (state & (1 << ui::AX_STATE_FOCUSABLE)) | 473 if (data.HasState(ui::AX_STATE_FOCUSABLE)) |
| 475 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSABLE); | 474 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSABLE); |
| 476 if (state & (1 << ui::AX_STATE_PRESSED)) | 475 if (data.HasState(ui::AX_STATE_PRESSED)) |
| 477 atk_state_set_add_state(atk_state_set, ATK_STATE_PRESSED); | 476 atk_state_set_add_state(atk_state_set, ATK_STATE_PRESSED); |
| 478 if (state & (1 << ui::AX_STATE_SELECTABLE)) | 477 if (data.HasState(ui::AX_STATE_SELECTABLE)) |
| 479 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTABLE); | 478 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTABLE); |
| 480 if (state & (1 << ui::AX_STATE_SELECTED)) | 479 if (data.HasState(ui::AX_STATE_SELECTED)) |
| 481 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTED); | 480 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTED); |
| 482 | 481 |
| 483 // Checked state | 482 // Checked state |
| 484 const auto checked_state = static_cast<ui::AXCheckedState>( | 483 const auto checked_state = static_cast<ui::AXCheckedState>( |
| 485 GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); | 484 GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); |
| 486 switch (checked_state) { | 485 switch (checked_state) { |
| 487 case ui::AX_CHECKED_STATE_MIXED: | 486 case ui::AX_CHECKED_STATE_MIXED: |
| 488 atk_state_set_add_state(atk_state_set, ATK_STATE_INDETERMINATE); | 487 atk_state_set_add_state(atk_state_set, ATK_STATE_INDETERMINATE); |
| 489 break; | 488 break; |
| 490 case ui::AX_CHECKED_STATE_TRUE: | 489 case ui::AX_CHECKED_STATE_TRUE: |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 567 |
| 569 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { | 568 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { |
| 570 gfx::Rect rect_size = gfx::ToEnclosingRect(GetData().location); | 569 gfx::Rect rect_size = gfx::ToEnclosingRect(GetData().location); |
| 571 if (width) | 570 if (width) |
| 572 *width = rect_size.width(); | 571 *width = rect_size.width(); |
| 573 if (height) | 572 if (height) |
| 574 *height = rect_size.height(); | 573 *height = rect_size.height(); |
| 575 } | 574 } |
| 576 | 575 |
| 577 } // namespace ui | 576 } // namespace ui |
| OLD | NEW |