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