OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/accessibility/browser_accessibility_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_win.h" |
6 | 6 |
7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
9 | 9 |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 3513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3524 if (HasState(ui::AX_STATE_CHECKED)) | 3524 if (HasState(ui::AX_STATE_CHECKED)) |
3525 ia_state |= STATE_SYSTEM_CHECKED; | 3525 ia_state |= STATE_SYSTEM_CHECKED; |
3526 if (HasState(ui::AX_STATE_COLLAPSED)) | 3526 if (HasState(ui::AX_STATE_COLLAPSED)) |
3527 ia_state |= STATE_SYSTEM_COLLAPSED; | 3527 ia_state |= STATE_SYSTEM_COLLAPSED; |
3528 if (HasState(ui::AX_STATE_EXPANDED)) | 3528 if (HasState(ui::AX_STATE_EXPANDED)) |
3529 ia_state |= STATE_SYSTEM_EXPANDED; | 3529 ia_state |= STATE_SYSTEM_EXPANDED; |
3530 if (HasState(ui::AX_STATE_FOCUSABLE)) | 3530 if (HasState(ui::AX_STATE_FOCUSABLE)) |
3531 ia_state |= STATE_SYSTEM_FOCUSABLE; | 3531 ia_state |= STATE_SYSTEM_FOCUSABLE; |
3532 if (HasState(ui::AX_STATE_HASPOPUP)) | 3532 if (HasState(ui::AX_STATE_HASPOPUP)) |
3533 ia_state |= STATE_SYSTEM_HASPOPUP; | 3533 ia_state |= STATE_SYSTEM_HASPOPUP; |
3534 if (HasState(ui::AX_STATE_HOVERED)) | |
3535 ia_state |= STATE_SYSTEM_HOTTRACKED; | |
3536 if (HasState(ui::AX_STATE_INDETERMINATE)) | 3534 if (HasState(ui::AX_STATE_INDETERMINATE)) |
3537 ia_state |= STATE_SYSTEM_INDETERMINATE; | 3535 ia_state |= STATE_SYSTEM_INDETERMINATE; |
3538 if (HasIntAttribute(ui::AX_ATTR_INVALID_STATE) && | 3536 if (HasIntAttribute(ui::AX_ATTR_INVALID_STATE) && |
3539 GetIntAttribute(ui::AX_ATTR_INVALID_STATE) != ui::AX_INVALID_STATE_FALSE) | 3537 GetIntAttribute(ui::AX_ATTR_INVALID_STATE) != ui::AX_INVALID_STATE_FALSE) |
3540 ia2_state |= IA2_STATE_INVALID_ENTRY; | 3538 ia2_state |= IA2_STATE_INVALID_ENTRY; |
3541 if (HasState(ui::AX_STATE_INVISIBLE)) | 3539 if (HasState(ui::AX_STATE_INVISIBLE)) |
3542 ia_state |= STATE_SYSTEM_INVISIBLE; | 3540 ia_state |= STATE_SYSTEM_INVISIBLE; |
3543 if (HasState(ui::AX_STATE_LINKED)) | 3541 if (HasState(ui::AX_STATE_LINKED)) |
3544 ia_state |= STATE_SYSTEM_LINKED; | 3542 ia_state |= STATE_SYSTEM_LINKED; |
3545 if (HasState(ui::AX_STATE_MULTISELECTABLE)) { | 3543 if (HasState(ui::AX_STATE_MULTISELECTABLE)) { |
(...skipping 17 matching lines...) Expand all Loading... |
3563 ia_state |= STATE_SYSTEM_TRAVERSED; | 3561 ia_state |= STATE_SYSTEM_TRAVERSED; |
3564 if (!HasState(ui::AX_STATE_ENABLED)) | 3562 if (!HasState(ui::AX_STATE_ENABLED)) |
3565 ia_state |= STATE_SYSTEM_UNAVAILABLE; | 3563 ia_state |= STATE_SYSTEM_UNAVAILABLE; |
3566 if (HasState(ui::AX_STATE_VERTICAL)) | 3564 if (HasState(ui::AX_STATE_VERTICAL)) |
3567 ia2_state |= IA2_STATE_VERTICAL; | 3565 ia2_state |= IA2_STATE_VERTICAL; |
3568 if (HasState(ui::AX_STATE_HORIZONTAL)) | 3566 if (HasState(ui::AX_STATE_HORIZONTAL)) |
3569 ia2_state |= IA2_STATE_HORIZONTAL; | 3567 ia2_state |= IA2_STATE_HORIZONTAL; |
3570 if (HasState(ui::AX_STATE_VISITED)) | 3568 if (HasState(ui::AX_STATE_VISITED)) |
3571 ia_state |= STATE_SYSTEM_TRAVERSED; | 3569 ia_state |= STATE_SYSTEM_TRAVERSED; |
3572 | 3570 |
| 3571 // Expose whether or not the mouse is over an element, but suppress |
| 3572 // this for tests because it can make the test results flaky depending |
| 3573 // on the position of the mouse. |
| 3574 BrowserAccessibilityStateImpl* accessibility_state = |
| 3575 BrowserAccessibilityStateImpl::GetInstance(); |
| 3576 if (!accessibility_state->disable_hot_tracking_for_testing()) { |
| 3577 if (HasState(ui::AX_STATE_HOVERED)) |
| 3578 ia_state |= STATE_SYSTEM_HOTTRACKED; |
| 3579 } |
| 3580 |
3573 // WebKit marks everything as readonly unless it's editable text, so if it's | 3581 // WebKit marks everything as readonly unless it's editable text, so if it's |
3574 // not readonly, mark it as editable now. The final computation of the | 3582 // not readonly, mark it as editable now. The final computation of the |
3575 // READONLY state for MSAA is below, after the switch. | 3583 // READONLY state for MSAA is below, after the switch. |
3576 if (!HasState(ui::AX_STATE_READ_ONLY)) | 3584 if (!HasState(ui::AX_STATE_READ_ONLY)) |
3577 ia2_state |= IA2_STATE_EDITABLE; | 3585 ia2_state |= IA2_STATE_EDITABLE; |
3578 | 3586 |
3579 if (GetBoolAttribute(ui::AX_ATTR_BUTTON_MIXED)) | 3587 if (GetBoolAttribute(ui::AX_ATTR_BUTTON_MIXED)) |
3580 ia_state |= STATE_SYSTEM_MIXED; | 3588 ia_state |= STATE_SYSTEM_MIXED; |
3581 | 3589 |
3582 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) | 3590 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4044 ia2_role = ia_role; | 4052 ia2_role = ia_role; |
4045 | 4053 |
4046 win_attributes_->ia_role = ia_role; | 4054 win_attributes_->ia_role = ia_role; |
4047 win_attributes_->ia_state = ia_state; | 4055 win_attributes_->ia_state = ia_state; |
4048 win_attributes_->role_name = role_name; | 4056 win_attributes_->role_name = role_name; |
4049 win_attributes_->ia2_role = ia2_role; | 4057 win_attributes_->ia2_role = ia2_role; |
4050 win_attributes_->ia2_state = ia2_state; | 4058 win_attributes_->ia2_state = ia2_state; |
4051 } | 4059 } |
4052 | 4060 |
4053 } // namespace content | 4061 } // namespace content |
OLD | NEW |