| 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 3339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3350 ia2_state_ |= IA2_STATE_VERTICAL; | 3350 ia2_state_ |= IA2_STATE_VERTICAL; |
| 3351 } else { | 3351 } else { |
| 3352 ia2_state_ |= IA2_STATE_HORIZONTAL; | 3352 ia2_state_ |= IA2_STATE_HORIZONTAL; |
| 3353 } | 3353 } |
| 3354 if (HasState(ui::AX_STATE_VISITED)) | 3354 if (HasState(ui::AX_STATE_VISITED)) |
| 3355 ia_state_ |= STATE_SYSTEM_TRAVERSED; | 3355 ia_state_ |= STATE_SYSTEM_TRAVERSED; |
| 3356 | 3356 |
| 3357 // WebKit marks everything as readonly unless it's editable text, so if it's | 3357 // WebKit marks everything as readonly unless it's editable text, so if it's |
| 3358 // not readonly, mark it as editable now. The final computation of the | 3358 // not readonly, mark it as editable now. The final computation of the |
| 3359 // READONLY state for MSAA is below, after the switch. | 3359 // READONLY state for MSAA is below, after the switch. |
| 3360 if (!HasState(ui::AX_STATE_READONLY)) | 3360 if (!HasState(ui::AX_STATE_READ_ONLY)) |
| 3361 ia2_state_ |= IA2_STATE_EDITABLE; | 3361 ia2_state_ |= IA2_STATE_EDITABLE; |
| 3362 | 3362 |
| 3363 base::string16 invalid; | 3363 base::string16 invalid; |
| 3364 if (GetHtmlAttribute("aria-invalid", &invalid)) | 3364 if (GetHtmlAttribute("aria-invalid", &invalid)) |
| 3365 ia2_state_ |= IA2_STATE_INVALID_ENTRY; | 3365 ia2_state_ |= IA2_STATE_INVALID_ENTRY; |
| 3366 | 3366 |
| 3367 if (GetBoolAttribute(ui::AX_ATTR_BUTTON_MIXED)) | 3367 if (GetBoolAttribute(ui::AX_ATTR_BUTTON_MIXED)) |
| 3368 ia_state_ |= STATE_SYSTEM_MIXED; | 3368 ia_state_ |= STATE_SYSTEM_MIXED; |
| 3369 | 3369 |
| 3370 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) | 3370 if (GetBoolAttribute(ui::AX_ATTR_CAN_SET_VALUE)) |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3519 case ui::AX_ROLE_IMAGE_MAP: | 3519 case ui::AX_ROLE_IMAGE_MAP: |
| 3520 role_name_ = html_tag; | 3520 role_name_ = html_tag; |
| 3521 ia2_role_ = IA2_ROLE_IMAGE_MAP; | 3521 ia2_role_ = IA2_ROLE_IMAGE_MAP; |
| 3522 ia_state_ |= STATE_SYSTEM_READONLY; | 3522 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3523 break; | 3523 break; |
| 3524 case ui::AX_ROLE_IMAGE_MAP_LINK: | 3524 case ui::AX_ROLE_IMAGE_MAP_LINK: |
| 3525 ia_role_ = ROLE_SYSTEM_LINK; | 3525 ia_role_ = ROLE_SYSTEM_LINK; |
| 3526 ia_state_ |= STATE_SYSTEM_LINKED; | 3526 ia_state_ |= STATE_SYSTEM_LINKED; |
| 3527 ia_state_ |= STATE_SYSTEM_READONLY; | 3527 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3528 break; | 3528 break; |
| 3529 case ui::AX_ROLE_LABEL: | 3529 case ui::AX_ROLE_LABEL_TEXT: |
| 3530 ia_role_ = ROLE_SYSTEM_TEXT; | 3530 ia_role_ = ROLE_SYSTEM_TEXT; |
| 3531 ia2_role_ = IA2_ROLE_LABEL; | 3531 ia2_role_ = IA2_ROLE_LABEL; |
| 3532 break; | 3532 break; |
| 3533 case ui::AX_ROLE_BANNER: | 3533 case ui::AX_ROLE_BANNER: |
| 3534 case ui::AX_ROLE_COMPLEMENTARY: | 3534 case ui::AX_ROLE_COMPLEMENTARY: |
| 3535 case ui::AX_ROLE_CONTENT_INFO: | 3535 case ui::AX_ROLE_CONTENT_INFO: |
| 3536 case ui::AX_ROLE_MAIN: | 3536 case ui::AX_ROLE_MAIN: |
| 3537 case ui::AX_ROLE_NAVIGATION: | 3537 case ui::AX_ROLE_NAVIGATION: |
| 3538 case ui::AX_ROLE_SEARCH: | 3538 case ui::AX_ROLE_SEARCH: |
| 3539 ia_role_ = ROLE_SYSTEM_GROUPING; | 3539 ia_role_ = ROLE_SYSTEM_GROUPING; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3771 // Compute the final value of READONLY for MSAA. | 3771 // Compute the final value of READONLY for MSAA. |
| 3772 // | 3772 // |
| 3773 // We always set the READONLY state for elements that have the | 3773 // We always set the READONLY state for elements that have the |
| 3774 // aria-readonly attribute and for a few roles (in the switch above). | 3774 // aria-readonly attribute and for a few roles (in the switch above). |
| 3775 // We clear the READONLY state on focusable controls and on a document. | 3775 // We clear the READONLY state on focusable controls and on a document. |
| 3776 // Everything else, the majority of objects, do not have this state set. | 3776 // Everything else, the majority of objects, do not have this state set. |
| 3777 if (HasState(ui::AX_STATE_FOCUSABLE) && | 3777 if (HasState(ui::AX_STATE_FOCUSABLE) && |
| 3778 ia_role_ != ROLE_SYSTEM_DOCUMENT) { | 3778 ia_role_ != ROLE_SYSTEM_DOCUMENT) { |
| 3779 ia_state_ &= ~(STATE_SYSTEM_READONLY); | 3779 ia_state_ &= ~(STATE_SYSTEM_READONLY); |
| 3780 } | 3780 } |
| 3781 if (!HasState(ui::AX_STATE_READONLY)) | 3781 if (!HasState(ui::AX_STATE_READ_ONLY)) |
| 3782 ia_state_ &= ~(STATE_SYSTEM_READONLY); | 3782 ia_state_ &= ~(STATE_SYSTEM_READONLY); |
| 3783 if (GetBoolAttribute(ui::AX_ATTR_ARIA_READONLY)) | 3783 if (GetBoolAttribute(ui::AX_ATTR_ARIA_READONLY)) |
| 3784 ia_state_ |= STATE_SYSTEM_READONLY; | 3784 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3785 | 3785 |
| 3786 // The role should always be set. | 3786 // The role should always be set. |
| 3787 DCHECK(!role_name_.empty() || ia_role_); | 3787 DCHECK(!role_name_.empty() || ia_role_); |
| 3788 | 3788 |
| 3789 // If we didn't explicitly set the IAccessible2 role, make it the same | 3789 // If we didn't explicitly set the IAccessible2 role, make it the same |
| 3790 // as the MSAA role. | 3790 // as the MSAA role. |
| 3791 if (!ia2_role_) | 3791 if (!ia2_role_) |
| 3792 ia2_role_ = ia_role_; | 3792 ia2_role_ = ia_role_; |
| 3793 } | 3793 } |
| 3794 | 3794 |
| 3795 } // namespace content | 3795 } // namespace content |
| OLD | NEW |