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 <algorithm> | 10 #include <algorithm> |
(...skipping 3950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3961 table->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); | 3961 table->GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); |
3962 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { | 3962 for (size_t i = 0; i < unique_cell_ids.size(); ++i) { |
3963 if (unique_cell_ids[i] == GetId()) { | 3963 if (unique_cell_ids[i] == GetId()) { |
3964 win_attributes_->ia2_attributes.push_back( | 3964 win_attributes_->ia2_attributes.push_back( |
3965 base::string16(L"table-cell-index:") + base::IntToString16(i)); | 3965 base::string16(L"table-cell-index:") + base::IntToString16(i)); |
3966 } | 3966 } |
3967 } | 3967 } |
3968 } | 3968 } |
3969 } | 3969 } |
3970 | 3970 |
| 3971 // Expose aria-colcount and aria-rowcount in a table, grid or treegrid. |
| 3972 if (IsTableOrGridOrTreeGridRole()) { |
| 3973 IntAttributeToIA2(ui::AX_ATTR_ARIA_COL_COUNT, "colcount"); |
| 3974 IntAttributeToIA2(ui::AX_ATTR_ARIA_ROW_COUNT, "rowcount"); |
| 3975 } |
| 3976 |
| 3977 // Expose aria-colindex and aria-rowindex in a cell or row. |
| 3978 if (IsCellOrTableHeaderRole() || GetRole() == ui::AX_ROLE_ROW) { |
| 3979 if (GetRole() != ui::AX_ROLE_ROW) |
| 3980 IntAttributeToIA2(ui::AX_ATTR_ARIA_COL_INDEX, "colindex"); |
| 3981 IntAttributeToIA2(ui::AX_ATTR_ARIA_ROW_INDEX, "rowindex"); |
| 3982 } |
| 3983 |
3971 // Expose row or column header sort direction. | 3984 // Expose row or column header sort direction. |
3972 int32_t sort_direction; | 3985 int32_t sort_direction; |
3973 if ((ia_role() == ROLE_SYSTEM_COLUMNHEADER || | 3986 if ((ia_role() == ROLE_SYSTEM_COLUMNHEADER || |
3974 ia_role() == ROLE_SYSTEM_ROWHEADER) && | 3987 ia_role() == ROLE_SYSTEM_ROWHEADER) && |
3975 GetIntAttribute(ui::AX_ATTR_SORT_DIRECTION, &sort_direction)) { | 3988 GetIntAttribute(ui::AX_ATTR_SORT_DIRECTION, &sort_direction)) { |
3976 switch (static_cast<ui::AXSortDirection>(sort_direction)) { | 3989 switch (static_cast<ui::AXSortDirection>(sort_direction)) { |
3977 case ui::AX_SORT_DIRECTION_NONE: | 3990 case ui::AX_SORT_DIRECTION_NONE: |
3978 break; | 3991 break; |
3979 case ui::AX_SORT_DIRECTION_UNSORTED: | 3992 case ui::AX_SORT_DIRECTION_UNSORTED: |
3980 win_attributes_->ia2_attributes.push_back(L"sort:none"); | 3993 win_attributes_->ia2_attributes.push_back(L"sort:none"); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4016 ui::AX_ATTR_DESCRIBEDBY_IDS); | 4029 ui::AX_ATTR_DESCRIBEDBY_IDS); |
4017 AddBidirectionalRelations(IA2_RELATION_FLOWS_TO, IA2_RELATION_FLOWS_FROM, | 4030 AddBidirectionalRelations(IA2_RELATION_FLOWS_TO, IA2_RELATION_FLOWS_FROM, |
4018 ui::AX_ATTR_FLOWTO_IDS); | 4031 ui::AX_ATTR_FLOWTO_IDS); |
4019 AddBidirectionalRelations(IA2_RELATION_LABELLED_BY, IA2_RELATION_LABEL_FOR, | 4032 AddBidirectionalRelations(IA2_RELATION_LABELLED_BY, IA2_RELATION_LABEL_FOR, |
4020 ui::AX_ATTR_LABELLEDBY_IDS); | 4033 ui::AX_ATTR_LABELLEDBY_IDS); |
4021 | 4034 |
4022 int member_of_id; | 4035 int member_of_id; |
4023 if (GetIntAttribute(ui::AX_ATTR_MEMBER_OF_ID, &member_of_id)) | 4036 if (GetIntAttribute(ui::AX_ATTR_MEMBER_OF_ID, &member_of_id)) |
4024 AddRelation(IA2_RELATION_MEMBER_OF, member_of_id); | 4037 AddRelation(IA2_RELATION_MEMBER_OF, member_of_id); |
4025 | 4038 |
| 4039 // Expose slider value. |
| 4040 if (ia_role() == ROLE_SYSTEM_PROGRESSBAR || |
| 4041 ia_role() == ROLE_SYSTEM_SCROLLBAR || |
| 4042 ia_role() == ROLE_SYSTEM_SLIDER) { |
| 4043 base::string16 value_text = GetValueText(); |
| 4044 SanitizeStringAttributeForIA2(value_text, &value_text); |
| 4045 win_attributes_->ia2_attributes.push_back(L"valuetext:" + value_text); |
| 4046 } |
| 4047 |
4026 UpdateRequiredAttributes(); | 4048 UpdateRequiredAttributes(); |
4027 // If this is a web area for a presentational iframe, give it a role of | 4049 // If this is a web area for a presentational iframe, give it a role of |
4028 // something other than DOCUMENT so that the fact that it's a separate doc | 4050 // something other than DOCUMENT so that the fact that it's a separate doc |
4029 // is not exposed to AT. | 4051 // is not exposed to AT. |
4030 if (IsWebAreaForPresentationalIframe()) { | 4052 if (IsWebAreaForPresentationalIframe()) { |
4031 win_attributes_->ia_role = ROLE_SYSTEM_GROUPING; | 4053 win_attributes_->ia_role = ROLE_SYSTEM_GROUPING; |
4032 win_attributes_->ia2_role = ROLE_SYSTEM_GROUPING; | 4054 win_attributes_->ia2_role = ROLE_SYSTEM_GROUPING; |
4033 } | 4055 } |
4034 } | 4056 } |
4035 | 4057 |
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5030 if (relation->get_target_ids().empty()) { | 5052 if (relation->get_target_ids().empty()) { |
5031 iter = relations_.erase(iter); | 5053 iter = relations_.erase(iter); |
5032 relation->Release(); | 5054 relation->Release(); |
5033 } else { | 5055 } else { |
5034 ++iter; | 5056 ++iter; |
5035 } | 5057 } |
5036 } | 5058 } |
5037 } | 5059 } |
5038 | 5060 |
5039 void BrowserAccessibilityWin::UpdateRequiredAttributes() { | 5061 void BrowserAccessibilityWin::UpdateRequiredAttributes() { |
5040 // Expose slider value. | 5062 if (IsCellOrTableHeaderRole()) { |
5041 if (ia_role() == ROLE_SYSTEM_PROGRESSBAR || | 5063 // Expose colspan attribute. |
5042 ia_role() == ROLE_SYSTEM_SCROLLBAR || | 5064 base::string16 colspan; |
5043 ia_role() == ROLE_SYSTEM_SLIDER) { | 5065 if (GetHtmlAttribute("aria-colspan", &colspan)) { |
5044 base::string16 value_text = GetValueText(); | 5066 SanitizeStringAttributeForIA2(colspan, &colspan); |
5045 SanitizeStringAttributeForIA2(value_text, &value_text); | 5067 win_attributes_->ia2_attributes.push_back(L"colspan:" + colspan); |
5046 win_attributes_->ia2_attributes.push_back(L"valuetext:" + value_text); | 5068 } |
| 5069 // Expose rowspan attribute. |
| 5070 base::string16 rowspan; |
| 5071 if (GetHtmlAttribute("aria-rowspan", &rowspan)) { |
| 5072 SanitizeStringAttributeForIA2(rowspan, &rowspan); |
| 5073 win_attributes_->ia2_attributes.push_back(L"rowspan:" + rowspan); |
| 5074 } |
5047 } | 5075 } |
5048 | 5076 |
5049 // Expose dropeffect attribute. | 5077 // Expose dropeffect attribute. |
5050 base::string16 drop_effect; | 5078 base::string16 drop_effect; |
5051 if (GetHtmlAttribute("aria-dropeffect", &drop_effect)) { | 5079 if (GetHtmlAttribute("aria-dropeffect", &drop_effect)) { |
5052 SanitizeStringAttributeForIA2(drop_effect, &drop_effect); | 5080 SanitizeStringAttributeForIA2(drop_effect, &drop_effect); |
5053 win_attributes_->ia2_attributes.push_back(L"dropeffect:" + drop_effect); | 5081 win_attributes_->ia2_attributes.push_back(L"dropeffect:" + drop_effect); |
5054 } | 5082 } |
5055 | 5083 |
5056 // Expose grabbed attribute. | 5084 // Expose grabbed attribute. |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5678 return static_cast<BrowserAccessibilityWin*>(obj); | 5706 return static_cast<BrowserAccessibilityWin*>(obj); |
5679 } | 5707 } |
5680 | 5708 |
5681 const BrowserAccessibilityWin* | 5709 const BrowserAccessibilityWin* |
5682 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5710 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
5683 DCHECK(!obj || obj->IsNative()); | 5711 DCHECK(!obj || obj->IsNative()); |
5684 return static_cast<const BrowserAccessibilityWin*>(obj); | 5712 return static_cast<const BrowserAccessibilityWin*>(obj); |
5685 } | 5713 } |
5686 | 5714 |
5687 } // namespace content | 5715 } // namespace content |
OLD | NEW |