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 3068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3079 // Add a labelled by relationship. | 3079 // Add a labelled by relationship. |
3080 CComObject<BrowserAccessibilityRelation>* relation; | 3080 CComObject<BrowserAccessibilityRelation>* relation; |
3081 HRESULT hr = CComObject<BrowserAccessibilityRelation>::CreateInstance( | 3081 HRESULT hr = CComObject<BrowserAccessibilityRelation>::CreateInstance( |
3082 &relation); | 3082 &relation); |
3083 DCHECK(SUCCEEDED(hr)); | 3083 DCHECK(SUCCEEDED(hr)); |
3084 relation->AddRef(); | 3084 relation->AddRef(); |
3085 relation->Initialize(this, IA2_RELATION_LABELLED_BY); | 3085 relation->Initialize(this, IA2_RELATION_LABELLED_BY); |
3086 relation->AddTarget(title_elem_id); | 3086 relation->AddTarget(title_elem_id); |
3087 relations_.push_back(relation); | 3087 relations_.push_back(relation); |
3088 } | 3088 } |
| 3089 |
| 3090 // If this is a web area for a presentational iframe, give it a role of |
| 3091 // something other than DOCUMENT so that the fact that it's a separate doc |
| 3092 // is not exposed to AT. |
| 3093 if (IsWebAreaForPresentationalIframe()) { |
| 3094 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3095 ia2_role_ = ROLE_SYSTEM_GROUPING; |
| 3096 } |
3089 } | 3097 } |
3090 | 3098 |
3091 void BrowserAccessibilityWin::OnUpdateFinished() { | 3099 void BrowserAccessibilityWin::OnUpdateFinished() { |
3092 // Construct the hypertext for this node. | 3100 // Construct the hypertext for this node. |
3093 hyperlink_offset_to_index_.clear(); | 3101 hyperlink_offset_to_index_.clear(); |
3094 hyperlinks_.clear(); | 3102 hyperlinks_.clear(); |
3095 hypertext_.clear(); | 3103 hypertext_.clear(); |
3096 for (unsigned int i = 0; i < PlatformChildCount(); ++i) { | 3104 for (unsigned int i = 0; i < PlatformChildCount(); ++i) { |
3097 BrowserAccessibility* child = PlatformGetChild(i); | 3105 BrowserAccessibility* child = PlatformGetChild(i); |
3098 if (child->GetRole() == ui::AX_ROLE_STATIC_TEXT) { | 3106 if (child->GetRole() == ui::AX_ROLE_STATIC_TEXT) { |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3548 } | 3556 } |
3549 case ui::AX_ROLE_GROW_AREA: | 3557 case ui::AX_ROLE_GROW_AREA: |
3550 ia_role_ = ROLE_SYSTEM_GRIP; | 3558 ia_role_ = ROLE_SYSTEM_GRIP; |
3551 ia_state_ |= STATE_SYSTEM_READONLY; | 3559 ia_state_ |= STATE_SYSTEM_READONLY; |
3552 break; | 3560 break; |
3553 case ui::AX_ROLE_HEADING: | 3561 case ui::AX_ROLE_HEADING: |
3554 role_name_ = html_tag; | 3562 role_name_ = html_tag; |
3555 ia2_role_ = IA2_ROLE_HEADING; | 3563 ia2_role_ = IA2_ROLE_HEADING; |
3556 break; | 3564 break; |
3557 case ui::AX_ROLE_IFRAME: | 3565 case ui::AX_ROLE_IFRAME: |
3558 ia_role_ = ROLE_SYSTEM_DOCUMENT; | |
3559 ia2_role_ = IA2_ROLE_INTERNAL_FRAME; | 3566 ia2_role_ = IA2_ROLE_INTERNAL_FRAME; |
3560 ia_state_ = STATE_SYSTEM_READONLY; | 3567 ia_state_ = STATE_SYSTEM_READONLY; |
3561 break; | 3568 break; |
| 3569 case ui::AX_ROLE_IFRAME_PRESENTATIONAL: |
| 3570 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3571 break; |
3562 case ui::AX_ROLE_IMAGE: | 3572 case ui::AX_ROLE_IMAGE: |
3563 ia_role_ = ROLE_SYSTEM_GRAPHIC; | 3573 ia_role_ = ROLE_SYSTEM_GRAPHIC; |
3564 ia_state_ |= STATE_SYSTEM_READONLY; | 3574 ia_state_ |= STATE_SYSTEM_READONLY; |
3565 break; | 3575 break; |
3566 case ui::AX_ROLE_IMAGE_MAP: | 3576 case ui::AX_ROLE_IMAGE_MAP: |
3567 role_name_ = html_tag; | 3577 role_name_ = html_tag; |
3568 ia2_role_ = IA2_ROLE_IMAGE_MAP; | 3578 ia2_role_ = IA2_ROLE_IMAGE_MAP; |
3569 ia_state_ |= STATE_SYSTEM_READONLY; | 3579 ia_state_ |= STATE_SYSTEM_READONLY; |
3570 break; | 3580 break; |
3571 case ui::AX_ROLE_IMAGE_MAP_LINK: | 3581 case ui::AX_ROLE_IMAGE_MAP_LINK: |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3853 // The role should always be set. | 3863 // The role should always be set. |
3854 DCHECK(!role_name_.empty() || ia_role_); | 3864 DCHECK(!role_name_.empty() || ia_role_); |
3855 | 3865 |
3856 // If we didn't explicitly set the IAccessible2 role, make it the same | 3866 // If we didn't explicitly set the IAccessible2 role, make it the same |
3857 // as the MSAA role. | 3867 // as the MSAA role. |
3858 if (!ia2_role_) | 3868 if (!ia2_role_) |
3859 ia2_role_ = ia_role_; | 3869 ia2_role_ = ia_role_; |
3860 } | 3870 } |
3861 | 3871 |
3862 } // namespace content | 3872 } // namespace content |
OLD | NEW |