| 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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 if (data.HasState(ui::AX_STATE_DEFAULT)) | 469 if (data.HasState(ui::AX_STATE_DEFAULT)) |
| 470 atk_state_set_add_state(atk_state_set, ATK_STATE_DEFAULT); | 470 atk_state_set_add_state(atk_state_set, ATK_STATE_DEFAULT); |
| 471 if (data.HasState(ui::AX_STATE_EDITABLE)) | 471 if (data.HasState(ui::AX_STATE_EDITABLE)) |
| 472 atk_state_set_add_state(atk_state_set, ATK_STATE_EDITABLE); | 472 atk_state_set_add_state(atk_state_set, ATK_STATE_EDITABLE); |
| 473 if (!data.HasState(ui::AX_STATE_DISABLED)) | 473 if (!data.HasState(ui::AX_STATE_DISABLED)) |
| 474 atk_state_set_add_state(atk_state_set, ATK_STATE_ENABLED); | 474 atk_state_set_add_state(atk_state_set, ATK_STATE_ENABLED); |
| 475 if (data.HasState(ui::AX_STATE_EXPANDED)) | 475 if (data.HasState(ui::AX_STATE_EXPANDED)) |
| 476 atk_state_set_add_state(atk_state_set, ATK_STATE_EXPANDED); | 476 atk_state_set_add_state(atk_state_set, ATK_STATE_EXPANDED); |
| 477 if (data.HasState(ui::AX_STATE_FOCUSABLE)) | 477 if (data.HasState(ui::AX_STATE_FOCUSABLE)) |
| 478 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSABLE); | 478 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSABLE); |
| 479 if (data.HasState(ui::AX_STATE_PRESSED)) | |
| 480 atk_state_set_add_state(atk_state_set, ATK_STATE_PRESSED); | |
| 481 if (data.HasState(ui::AX_STATE_SELECTABLE)) | 479 if (data.HasState(ui::AX_STATE_SELECTABLE)) |
| 482 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTABLE); | 480 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTABLE); |
| 483 if (data.HasState(ui::AX_STATE_SELECTED)) | 481 if (data.HasState(ui::AX_STATE_SELECTED)) |
| 484 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTED); | 482 atk_state_set_add_state(atk_state_set, ATK_STATE_SELECTED); |
| 485 | 483 |
| 486 // Checked state | 484 // Checked state |
| 487 const auto checked_state = static_cast<ui::AXCheckedState>( | 485 const auto checked_state = static_cast<ui::AXButtonState>( |
| 488 GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); | 486 GetIntAttribute(ui::AX_ATTR_CHECKED_STATE)); |
| 489 switch (checked_state) { | 487 switch (checked_state) { |
| 490 case ui::AX_CHECKED_STATE_MIXED: | 488 case ui::AX_BUTTON_STATE_MIXED: |
| 491 atk_state_set_add_state(atk_state_set, ATK_STATE_INDETERMINATE); | 489 atk_state_set_add_state(atk_state_set, ATK_STATE_INDETERMINATE); |
| 492 break; | 490 break; |
| 493 case ui::AX_CHECKED_STATE_TRUE: | 491 case ui::AX_BUTTON_STATE_TRUE: |
| 494 atk_state_set_add_state(atk_state_set, ATK_STATE_CHECKED); | 492 atk_state_set_add_state(atk_state_set, ATK_STATE_CHECKED); |
| 495 break; | 493 break; |
| 496 default: | 494 default: |
| 497 break; | 495 break; |
| 498 } | 496 } |
| 499 | 497 |
| 498 // Checked state |
| 499 const auto pressed_state = static_cast<ui::AXButtonState>( |
| 500 GetIntAttribute(ui::AX_ATTR_PRESSED_STATE)); |
| 501 switch (pressed_state) { |
| 502 case ui::AX_BUTTON_STATE_MIXED: |
| 503 atk_state_set_add_state(atk_state_set, ATK_STATE_INDETERMINATE); |
| 504 break; |
| 505 case ui::AX_BUTTON_STATE_TRUE: |
| 506 atk_state_set_add_state(atk_state_set, ATK_STATE_PRESSED); |
| 507 break; |
| 508 default: |
| 509 break; |
| 510 } |
| 500 if (delegate_->GetFocus() == GetNativeViewAccessible()) | 511 if (delegate_->GetFocus() == GetNativeViewAccessible()) |
| 501 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSED); | 512 atk_state_set_add_state(atk_state_set, ATK_STATE_FOCUSED); |
| 502 } | 513 } |
| 503 | 514 |
| 504 void AXPlatformNodeAuraLinux::GetAtkRelations(AtkRelationSet* atk_relation_set) | 515 void AXPlatformNodeAuraLinux::GetAtkRelations(AtkRelationSet* atk_relation_set) |
| 505 { | 516 { |
| 506 } | 517 } |
| 507 | 518 |
| 508 AXPlatformNodeAuraLinux::AXPlatformNodeAuraLinux() | 519 AXPlatformNodeAuraLinux::AXPlatformNodeAuraLinux() |
| 509 : atk_object_(nullptr) { | 520 : atk_object_(nullptr) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 | 582 |
| 572 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { | 583 void AXPlatformNodeAuraLinux::GetSize(gint* width, gint* height) { |
| 573 gfx::Rect rect_size = gfx::ToEnclosingRect(GetData().location); | 584 gfx::Rect rect_size = gfx::ToEnclosingRect(GetData().location); |
| 574 if (width) | 585 if (width) |
| 575 *width = rect_size.width(); | 586 *width = rect_size.width(); |
| 576 if (height) | 587 if (height) |
| 577 *height = rect_size.height(); | 588 *height = rect_size.height(); |
| 578 } | 589 } |
| 579 | 590 |
| 580 } // namespace ui | 591 } // namespace ui |
| OLD | NEW |