| 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 3070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3081 // Add a labelled by relationship. | 3081 // Add a labelled by relationship. |
| 3082 CComObject<BrowserAccessibilityRelation>* relation; | 3082 CComObject<BrowserAccessibilityRelation>* relation; |
| 3083 HRESULT hr = CComObject<BrowserAccessibilityRelation>::CreateInstance( | 3083 HRESULT hr = CComObject<BrowserAccessibilityRelation>::CreateInstance( |
| 3084 &relation); | 3084 &relation); |
| 3085 DCHECK(SUCCEEDED(hr)); | 3085 DCHECK(SUCCEEDED(hr)); |
| 3086 relation->AddRef(); | 3086 relation->AddRef(); |
| 3087 relation->Initialize(this, IA2_RELATION_LABELLED_BY); | 3087 relation->Initialize(this, IA2_RELATION_LABELLED_BY); |
| 3088 relation->AddTarget(title_elem_id); | 3088 relation->AddTarget(title_elem_id); |
| 3089 relations_.push_back(relation); | 3089 relations_.push_back(relation); |
| 3090 } | 3090 } |
| 3091 |
| 3092 // If this is a web area for a presentational iframe, give it a role of |
| 3093 // something other than DOCUMENT so that the fact that it's a separate doc |
| 3094 // is not exposed to AT. |
| 3095 if (IsWebAreaForPresentationalIframe()) { |
| 3096 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3097 ia2_role_ = ROLE_SYSTEM_GROUPING; |
| 3098 } |
| 3091 } | 3099 } |
| 3092 | 3100 |
| 3093 void BrowserAccessibilityWin::OnUpdateFinished() { | 3101 void BrowserAccessibilityWin::OnUpdateFinished() { |
| 3094 // Construct the hypertext for this node. | 3102 // Construct the hypertext for this node. |
| 3095 hyperlink_offset_to_index_.clear(); | 3103 hyperlink_offset_to_index_.clear(); |
| 3096 hyperlinks_.clear(); | 3104 hyperlinks_.clear(); |
| 3097 hypertext_.clear(); | 3105 hypertext_.clear(); |
| 3098 for (unsigned int i = 0; i < PlatformChildCount(); ++i) { | 3106 for (unsigned int i = 0; i < PlatformChildCount(); ++i) { |
| 3099 BrowserAccessibility* child = PlatformGetChild(i); | 3107 BrowserAccessibility* child = PlatformGetChild(i); |
| 3100 if (child->GetRole() == ui::AX_ROLE_STATIC_TEXT) { | 3108 if (child->GetRole() == ui::AX_ROLE_STATIC_TEXT) { |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3543 } | 3551 } |
| 3544 case ui::AX_ROLE_HEADING: | 3552 case ui::AX_ROLE_HEADING: |
| 3545 role_name_ = html_tag; | 3553 role_name_ = html_tag; |
| 3546 ia2_role_ = IA2_ROLE_HEADING; | 3554 ia2_role_ = IA2_ROLE_HEADING; |
| 3547 break; | 3555 break; |
| 3548 case ui::AX_ROLE_IFRAME: | 3556 case ui::AX_ROLE_IFRAME: |
| 3549 ia_role_ = ROLE_SYSTEM_DOCUMENT; | 3557 ia_role_ = ROLE_SYSTEM_DOCUMENT; |
| 3550 ia2_role_ = IA2_ROLE_INTERNAL_FRAME; | 3558 ia2_role_ = IA2_ROLE_INTERNAL_FRAME; |
| 3551 ia_state_ = STATE_SYSTEM_READONLY; | 3559 ia_state_ = STATE_SYSTEM_READONLY; |
| 3552 break; | 3560 break; |
| 3561 case ui::AX_ROLE_IFRAME_PRESENTATIONAL: |
| 3562 ia_role_ = ROLE_SYSTEM_GROUPING; |
| 3563 break; |
| 3553 case ui::AX_ROLE_IMAGE: | 3564 case ui::AX_ROLE_IMAGE: |
| 3554 ia_role_ = ROLE_SYSTEM_GRAPHIC; | 3565 ia_role_ = ROLE_SYSTEM_GRAPHIC; |
| 3555 ia_state_ |= STATE_SYSTEM_READONLY; | 3566 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3556 break; | 3567 break; |
| 3557 case ui::AX_ROLE_IMAGE_MAP: | 3568 case ui::AX_ROLE_IMAGE_MAP: |
| 3558 role_name_ = html_tag; | 3569 role_name_ = html_tag; |
| 3559 ia2_role_ = IA2_ROLE_IMAGE_MAP; | 3570 ia2_role_ = IA2_ROLE_IMAGE_MAP; |
| 3560 ia_state_ |= STATE_SYSTEM_READONLY; | 3571 ia_state_ |= STATE_SYSTEM_READONLY; |
| 3561 break; | 3572 break; |
| 3562 case ui::AX_ROLE_IMAGE_MAP_LINK: | 3573 case ui::AX_ROLE_IMAGE_MAP_LINK: |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3831 // The role should always be set. | 3842 // The role should always be set. |
| 3832 DCHECK(!role_name_.empty() || ia_role_); | 3843 DCHECK(!role_name_.empty() || ia_role_); |
| 3833 | 3844 |
| 3834 // If we didn't explicitly set the IAccessible2 role, make it the same | 3845 // If we didn't explicitly set the IAccessible2 role, make it the same |
| 3835 // as the MSAA role. | 3846 // as the MSAA role. |
| 3836 if (!ia2_role_) | 3847 if (!ia2_role_) |
| 3837 ia2_role_ = ia_role_; | 3848 ia2_role_ = ia_role_; |
| 3838 } | 3849 } |
| 3839 | 3850 |
| 3840 } // namespace content | 3851 } // namespace content |
| OLD | NEW |