| 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> |
| 11 #include <iterator> | 11 #include <iterator> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/metrics/histogram_macros.h" | 14 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
| 17 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/win/enum_variant.h" | 19 #include "base/win/enum_variant.h" |
| 20 #include "base/win/scoped_comptr.h" | 20 #include "base/win/scoped_comptr.h" |
| 21 #include "base/win/windows_version.h" | 21 #include "base/win/windows_version.h" |
| 22 #include "content/browser/accessibility/browser_accessibility_event_win.h" | 22 #include "content/browser/accessibility/browser_accessibility_event_win.h" |
| 23 #include "content/browser/accessibility/browser_accessibility_manager_win.h" | 23 #include "content/browser/accessibility/browser_accessibility_manager_win.h" |
| 24 #include "content/browser/accessibility/browser_accessibility_state_impl.h" | 24 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
| 25 #include "content/common/accessibility_messages.h" | 25 #include "content/common/accessibility_messages.h" |
| 26 #include "content/common/accessibility_mode.h" |
| 26 #include "content/public/common/content_client.h" | 27 #include "content/public/common/content_client.h" |
| 27 #include "third_party/skia/include/core/SkColor.h" | 28 #include "third_party/skia/include/core/SkColor.h" |
| 28 #include "ui/accessibility/ax_text_utils.h" | 29 #include "ui/accessibility/ax_text_utils.h" |
| 29 #include "ui/base/win/accessibility_ids_win.h" | 30 #include "ui/base/win/accessibility_ids_win.h" |
| 30 #include "ui/base/win/accessibility_misc_utils.h" | 31 #include "ui/base/win/accessibility_misc_utils.h" |
| 31 #include "ui/base/win/atl_module.h" | 32 #include "ui/base/win/atl_module.h" |
| 32 | 33 |
| 33 namespace { | 34 namespace { |
| 34 | 35 |
| 35 // IMPORTANT! | 36 // IMPORTANT! |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 UMA_API_UNSELECT_ROW = 157, | 197 UMA_API_UNSELECT_ROW = 157, |
| 197 | 198 |
| 198 // This must always be the last enum. It's okay for its value to | 199 // This must always be the last enum. It's okay for its value to |
| 199 // increase, but none of the other enum values may change. | 200 // increase, but none of the other enum values may change. |
| 200 UMA_API_MAX | 201 UMA_API_MAX |
| 201 }; | 202 }; |
| 202 | 203 |
| 203 #define WIN_ACCESSIBILITY_API_HISTOGRAM(enum_value) \ | 204 #define WIN_ACCESSIBILITY_API_HISTOGRAM(enum_value) \ |
| 204 UMA_HISTOGRAM_ENUMERATION("Accessibility.WinAPIs", enum_value, UMA_API_MAX) | 205 UMA_HISTOGRAM_ENUMERATION("Accessibility.WinAPIs", enum_value, UMA_API_MAX) |
| 205 | 206 |
| 207 // There is no easy way to decouple |kScreenReader| and |kHTML| accessibility |
| 208 // modes when Windows screen readers are used. For example, certain roles use |
| 209 // the HTML tag name. Input fields require their type attribute to be exposed. |
| 210 const uint32_t kScreenReaderAndHTMLAccessibilityModes = |
| 211 content::AccessibilityMode::kScreenReader | |
| 212 content::AccessibilityMode::kHTML; |
| 213 |
| 206 const WCHAR *const IA2_RELATION_DETAILS = L"details"; | 214 const WCHAR *const IA2_RELATION_DETAILS = L"details"; |
| 207 const WCHAR *const IA2_RELATION_DETAILS_FOR = L"detailsFor"; | 215 const WCHAR *const IA2_RELATION_DETAILS_FOR = L"detailsFor"; |
| 208 const WCHAR *const IA2_RELATION_ERROR_MESSAGE = L"errorMessage"; | 216 const WCHAR *const IA2_RELATION_ERROR_MESSAGE = L"errorMessage"; |
| 209 | 217 |
| 210 } // namespace | 218 } // namespace |
| 211 | 219 |
| 212 namespace content { | 220 namespace content { |
| 213 | 221 |
| 214 // These nonstandard GUIDs are taken directly from the Mozilla sources | 222 // These nonstandard GUIDs are taken directly from the Mozilla sources |
| 215 // (accessible/src/msaa/nsAccessNodeWrap.cpp); some documentation is here: | 223 // (accessible/src/msaa/nsAccessNodeWrap.cpp); some documentation is here: |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 | 913 |
| 906 if (!role) | 914 if (!role) |
| 907 return E_INVALIDARG; | 915 return E_INVALIDARG; |
| 908 | 916 |
| 909 *role = ia2_role(); | 917 *role = ia2_role(); |
| 910 return S_OK; | 918 return S_OK; |
| 911 } | 919 } |
| 912 | 920 |
| 913 STDMETHODIMP BrowserAccessibilityWin::get_attributes(BSTR* attributes) { | 921 STDMETHODIMP BrowserAccessibilityWin::get_attributes(BSTR* attributes) { |
| 914 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IA2_GET_ATTRIBUTES); | 922 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IA2_GET_ATTRIBUTES); |
| 915 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 923 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 916 if (!attributes) | 924 if (!attributes) |
| 917 return E_INVALIDARG; | 925 return E_INVALIDARG; |
| 918 *attributes = nullptr; | 926 *attributes = nullptr; |
| 919 | 927 |
| 920 if (!instance_active()) | 928 if (!instance_active()) |
| 921 return E_FAIL; | 929 return E_FAIL; |
| 922 | 930 |
| 923 base::string16 str; | 931 base::string16 str; |
| 924 for (const base::string16& attribute : ia2_attributes()) | 932 for (const base::string16& attribute : ia2_attributes()) |
| 925 str += attribute + L';'; | 933 str += attribute + L';'; |
| 926 | 934 |
| 927 if (str.empty()) | 935 if (str.empty()) |
| 928 return S_FALSE; | 936 return S_FALSE; |
| 929 | 937 |
| 930 *attributes = SysAllocString(str.c_str()); | 938 *attributes = SysAllocString(str.c_str()); |
| 931 DCHECK(*attributes); | 939 DCHECK(*attributes); |
| 932 return S_OK; | 940 return S_OK; |
| 933 } | 941 } |
| 934 | 942 |
| 935 STDMETHODIMP BrowserAccessibilityWin::get_states(AccessibleStates* states) { | 943 STDMETHODIMP BrowserAccessibilityWin::get_states(AccessibleStates* states) { |
| 936 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_STATES); | 944 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_STATES); |
| 937 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 945 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 938 if (!instance_active()) | 946 if (!instance_active()) |
| 939 return E_FAIL; | 947 return E_FAIL; |
| 940 | 948 |
| 941 if (!states) | 949 if (!states) |
| 942 return E_INVALIDARG; | 950 return E_INVALIDARG; |
| 943 | 951 |
| 944 *states = ia2_state(); | 952 *states = ia2_state(); |
| 945 | 953 |
| 946 return S_OK; | 954 return S_OK; |
| 947 } | 955 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 | 989 |
| 982 if (!index_in_parent) | 990 if (!index_in_parent) |
| 983 return E_INVALIDARG; | 991 return E_INVALIDARG; |
| 984 | 992 |
| 985 *index_in_parent = this->GetIndexInParent(); | 993 *index_in_parent = this->GetIndexInParent(); |
| 986 return S_OK; | 994 return S_OK; |
| 987 } | 995 } |
| 988 | 996 |
| 989 STDMETHODIMP BrowserAccessibilityWin::get_nRelations(LONG* n_relations) { | 997 STDMETHODIMP BrowserAccessibilityWin::get_nRelations(LONG* n_relations) { |
| 990 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_RELATIONS); | 998 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_RELATIONS); |
| 991 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 999 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 992 if (!instance_active()) | 1000 if (!instance_active()) |
| 993 return E_FAIL; | 1001 return E_FAIL; |
| 994 | 1002 |
| 995 if (!n_relations) | 1003 if (!n_relations) |
| 996 return E_INVALIDARG; | 1004 return E_INVALIDARG; |
| 997 | 1005 |
| 998 *n_relations = relations_.size(); | 1006 *n_relations = relations_.size(); |
| 999 return S_OK; | 1007 return S_OK; |
| 1000 } | 1008 } |
| 1001 | 1009 |
| 1002 STDMETHODIMP BrowserAccessibilityWin::get_relation( | 1010 STDMETHODIMP BrowserAccessibilityWin::get_relation( |
| 1003 LONG relation_index, | 1011 LONG relation_index, |
| 1004 IAccessibleRelation** relation) { | 1012 IAccessibleRelation** relation) { |
| 1005 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_RELATION); | 1013 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_RELATION); |
| 1006 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1014 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1007 if (!instance_active()) | 1015 if (!instance_active()) |
| 1008 return E_FAIL; | 1016 return E_FAIL; |
| 1009 | 1017 |
| 1010 if (relation_index < 0 || | 1018 if (relation_index < 0 || |
| 1011 relation_index >= static_cast<long>(relations_.size())) { | 1019 relation_index >= static_cast<long>(relations_.size())) { |
| 1012 return E_INVALIDARG; | 1020 return E_INVALIDARG; |
| 1013 } | 1021 } |
| 1014 | 1022 |
| 1015 if (!relation) | 1023 if (!relation) |
| 1016 return E_INVALIDARG; | 1024 return E_INVALIDARG; |
| 1017 | 1025 |
| 1018 relations_[relation_index]->AddRef(); | 1026 relations_[relation_index]->AddRef(); |
| 1019 *relation = relations_[relation_index]; | 1027 *relation = relations_[relation_index]; |
| 1020 return S_OK; | 1028 return S_OK; |
| 1021 } | 1029 } |
| 1022 | 1030 |
| 1023 STDMETHODIMP BrowserAccessibilityWin::get_relations( | 1031 STDMETHODIMP BrowserAccessibilityWin::get_relations( |
| 1024 LONG max_relations, | 1032 LONG max_relations, |
| 1025 IAccessibleRelation** relations, | 1033 IAccessibleRelation** relations, |
| 1026 LONG* n_relations) { | 1034 LONG* n_relations) { |
| 1027 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_RELATIONS); | 1035 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_RELATIONS); |
| 1028 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1036 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1029 if (!instance_active()) | 1037 if (!instance_active()) |
| 1030 return E_FAIL; | 1038 return E_FAIL; |
| 1031 | 1039 |
| 1032 if (!relations || !n_relations) | 1040 if (!relations || !n_relations) |
| 1033 return E_INVALIDARG; | 1041 return E_INVALIDARG; |
| 1034 | 1042 |
| 1035 long count = static_cast<long>(relations_.size()); | 1043 long count = static_cast<long>(relations_.size()); |
| 1036 *n_relations = count; | 1044 *n_relations = count; |
| 1037 if (count == 0) | 1045 if (count == 0) |
| 1038 return S_FALSE; | 1046 return S_FALSE; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 manager_->ScrollToPoint(*this, scroll_to); | 1114 manager_->ScrollToPoint(*this, scroll_to); |
| 1107 | 1115 |
| 1108 return S_OK; | 1116 return S_OK; |
| 1109 } | 1117 } |
| 1110 | 1118 |
| 1111 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( | 1119 STDMETHODIMP BrowserAccessibilityWin::get_groupPosition( |
| 1112 LONG* group_level, | 1120 LONG* group_level, |
| 1113 LONG* similar_items_in_group, | 1121 LONG* similar_items_in_group, |
| 1114 LONG* position_in_group) { | 1122 LONG* position_in_group) { |
| 1115 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_GROUP_POSITION); | 1123 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_GROUP_POSITION); |
| 1116 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1124 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1117 if (!instance_active()) | 1125 if (!instance_active()) |
| 1118 return E_FAIL; | 1126 return E_FAIL; |
| 1119 | 1127 |
| 1120 if (!group_level || !similar_items_in_group || !position_in_group) | 1128 if (!group_level || !similar_items_in_group || !position_in_group) |
| 1121 return E_INVALIDARG; | 1129 return E_INVALIDARG; |
| 1122 | 1130 |
| 1123 *group_level = GetIntAttribute(ui::AX_ATTR_HIERARCHICAL_LEVEL); | 1131 *group_level = GetIntAttribute(ui::AX_ATTR_HIERARCHICAL_LEVEL); |
| 1124 *similar_items_in_group = GetIntAttribute(ui::AX_ATTR_SET_SIZE); | 1132 *similar_items_in_group = GetIntAttribute(ui::AX_ATTR_SET_SIZE); |
| 1125 *position_in_group = GetIntAttribute(ui::AX_ATTR_POS_IN_SET); | 1133 *position_in_group = GetIntAttribute(ui::AX_ATTR_POS_IN_SET); |
| 1126 | 1134 |
| 1127 if (*group_level == *similar_items_in_group == *position_in_group == 0) | 1135 if (*group_level == *similar_items_in_group == *position_in_group == 0) |
| 1128 return S_FALSE; | 1136 return S_FALSE; |
| 1129 return S_OK; | 1137 return S_OK; |
| 1130 } | 1138 } |
| 1131 | 1139 |
| 1132 STDMETHODIMP | 1140 STDMETHODIMP |
| 1133 BrowserAccessibilityWin::get_localizedExtendedRole( | 1141 BrowserAccessibilityWin::get_localizedExtendedRole( |
| 1134 BSTR* localized_extended_role) { | 1142 BSTR* localized_extended_role) { |
| 1135 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCALIZED_EXTENDED_ROLE); | 1143 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCALIZED_EXTENDED_ROLE); |
| 1136 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1144 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1137 | 1145 |
| 1138 if (!instance_active()) | 1146 if (!instance_active()) |
| 1139 return E_FAIL; | 1147 return E_FAIL; |
| 1140 | 1148 |
| 1141 if (!localized_extended_role) | 1149 if (!localized_extended_role) |
| 1142 return E_INVALIDARG; | 1150 return E_INVALIDARG; |
| 1143 | 1151 |
| 1144 return GetStringAttributeAsBstr( | 1152 return GetStringAttributeAsBstr( |
| 1145 ui::AX_ATTR_ROLE_DESCRIPTION, localized_extended_role); | 1153 ui::AX_ATTR_ROLE_DESCRIPTION, localized_extended_role); |
| 1146 } | 1154 } |
| 1147 | 1155 |
| 1148 // | 1156 // |
| 1149 // IAccessible2 methods not implemented. | 1157 // IAccessible2 methods not implemented. |
| 1150 // | 1158 // |
| 1151 | 1159 |
| 1152 STDMETHODIMP BrowserAccessibilityWin::get_extendedRole(BSTR* extended_role) { | 1160 STDMETHODIMP BrowserAccessibilityWin::get_extendedRole(BSTR* extended_role) { |
| 1153 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_EXTENDED_ROLE); | 1161 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_EXTENDED_ROLE); |
| 1154 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1162 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1155 return E_NOTIMPL; | 1163 return E_NOTIMPL; |
| 1156 } | 1164 } |
| 1157 STDMETHODIMP | 1165 STDMETHODIMP |
| 1158 BrowserAccessibilityWin::get_nExtendedStates(LONG* n_extended_states) { | 1166 BrowserAccessibilityWin::get_nExtendedStates(LONG* n_extended_states) { |
| 1159 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_EXTENDED_STATES); | 1167 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_EXTENDED_STATES); |
| 1160 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1168 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1161 return E_NOTIMPL; | 1169 return E_NOTIMPL; |
| 1162 } | 1170 } |
| 1163 STDMETHODIMP | 1171 STDMETHODIMP |
| 1164 BrowserAccessibilityWin::get_extendedStates(LONG max_extended_states, | 1172 BrowserAccessibilityWin::get_extendedStates(LONG max_extended_states, |
| 1165 BSTR** extended_states, | 1173 BSTR** extended_states, |
| 1166 LONG* n_extended_states) { | 1174 LONG* n_extended_states) { |
| 1167 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_EXTENDED_STATES); | 1175 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_EXTENDED_STATES); |
| 1168 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1176 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1169 return E_NOTIMPL; | 1177 return E_NOTIMPL; |
| 1170 } | 1178 } |
| 1171 STDMETHODIMP | 1179 STDMETHODIMP |
| 1172 BrowserAccessibilityWin::get_localizedExtendedStates( | 1180 BrowserAccessibilityWin::get_localizedExtendedStates( |
| 1173 LONG max_localized_extended_states, | 1181 LONG max_localized_extended_states, |
| 1174 BSTR** localized_extended_states, | 1182 BSTR** localized_extended_states, |
| 1175 LONG* n_localized_extended_states) { | 1183 LONG* n_localized_extended_states) { |
| 1176 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCALIZED_EXTENDED_STATES); | 1184 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCALIZED_EXTENDED_STATES); |
| 1177 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1185 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1178 return E_NOTIMPL; | 1186 return E_NOTIMPL; |
| 1179 } | 1187 } |
| 1180 STDMETHODIMP BrowserAccessibilityWin::get_locale(IA2Locale* locale) { | 1188 STDMETHODIMP BrowserAccessibilityWin::get_locale(IA2Locale* locale) { |
| 1181 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCALE); | 1189 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCALE); |
| 1182 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1190 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1183 return E_NOTIMPL; | 1191 return E_NOTIMPL; |
| 1184 } | 1192 } |
| 1185 | 1193 |
| 1186 // | 1194 // |
| 1187 // IAccessibleApplication methods. | 1195 // IAccessibleApplication methods. |
| 1188 // | 1196 // |
| 1189 | 1197 |
| 1190 STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) { | 1198 STDMETHODIMP BrowserAccessibilityWin::get_appName(BSTR* app_name) { |
| 1191 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_APP_NAME); | 1199 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_APP_NAME); |
| 1192 // No need to check |instance_active()| because this interface is | 1200 // No need to check |instance_active()| because this interface is |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 | 1333 |
| 1326 // | 1334 // |
| 1327 // IAccessibleTable methods. | 1335 // IAccessibleTable methods. |
| 1328 // | 1336 // |
| 1329 | 1337 |
| 1330 STDMETHODIMP BrowserAccessibilityWin::get_accessibleAt( | 1338 STDMETHODIMP BrowserAccessibilityWin::get_accessibleAt( |
| 1331 long row, | 1339 long row, |
| 1332 long column, | 1340 long column, |
| 1333 IUnknown** accessible) { | 1341 IUnknown** accessible) { |
| 1334 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACCESSIBLE_AT); | 1342 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACCESSIBLE_AT); |
| 1335 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1343 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1336 if (!instance_active()) | 1344 if (!instance_active()) |
| 1337 return E_FAIL; | 1345 return E_FAIL; |
| 1338 | 1346 |
| 1339 if (!accessible) | 1347 if (!accessible) |
| 1340 return E_INVALIDARG; | 1348 return E_INVALIDARG; |
| 1341 | 1349 |
| 1342 int columns; | 1350 int columns; |
| 1343 int rows; | 1351 int rows; |
| 1344 if (!GetIntAttribute( | 1352 if (!GetIntAttribute( |
| 1345 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1353 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1363 *accessible = static_cast<IAccessible*>(cell->NewReference()); | 1371 *accessible = static_cast<IAccessible*>(cell->NewReference()); |
| 1364 return S_OK; | 1372 return S_OK; |
| 1365 } | 1373 } |
| 1366 | 1374 |
| 1367 *accessible = NULL; | 1375 *accessible = NULL; |
| 1368 return E_INVALIDARG; | 1376 return E_INVALIDARG; |
| 1369 } | 1377 } |
| 1370 | 1378 |
| 1371 STDMETHODIMP BrowserAccessibilityWin::get_caption(IUnknown** accessible) { | 1379 STDMETHODIMP BrowserAccessibilityWin::get_caption(IUnknown** accessible) { |
| 1372 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CAPTION); | 1380 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CAPTION); |
| 1373 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1381 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1374 if (!instance_active()) | 1382 if (!instance_active()) |
| 1375 return E_FAIL; | 1383 return E_FAIL; |
| 1376 | 1384 |
| 1377 if (!accessible) | 1385 if (!accessible) |
| 1378 return E_INVALIDARG; | 1386 return E_INVALIDARG; |
| 1379 | 1387 |
| 1380 // TODO(dmazzoni): implement | 1388 // TODO(dmazzoni): implement |
| 1381 return S_FALSE; | 1389 return S_FALSE; |
| 1382 } | 1390 } |
| 1383 | 1391 |
| 1384 STDMETHODIMP BrowserAccessibilityWin::get_childIndex(long row, | 1392 STDMETHODIMP BrowserAccessibilityWin::get_childIndex(long row, |
| 1385 long column, | 1393 long column, |
| 1386 long* cell_index) { | 1394 long* cell_index) { |
| 1387 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHILD_INDEX); | 1395 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHILD_INDEX); |
| 1388 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1396 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1389 if (!instance_active()) | 1397 if (!instance_active()) |
| 1390 return E_FAIL; | 1398 return E_FAIL; |
| 1391 | 1399 |
| 1392 if (!cell_index) | 1400 if (!cell_index) |
| 1393 return E_INVALIDARG; | 1401 return E_INVALIDARG; |
| 1394 | 1402 |
| 1395 int columns; | 1403 int columns; |
| 1396 int rows; | 1404 int rows; |
| 1397 if (!GetIntAttribute( | 1405 if (!GetIntAttribute( |
| 1398 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1406 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1418 return S_OK; | 1426 return S_OK; |
| 1419 } | 1427 } |
| 1420 } | 1428 } |
| 1421 | 1429 |
| 1422 return S_FALSE; | 1430 return S_FALSE; |
| 1423 } | 1431 } |
| 1424 | 1432 |
| 1425 STDMETHODIMP BrowserAccessibilityWin::get_columnDescription(long column, | 1433 STDMETHODIMP BrowserAccessibilityWin::get_columnDescription(long column, |
| 1426 BSTR* description) { | 1434 BSTR* description) { |
| 1427 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_DESCRIPTION); | 1435 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_DESCRIPTION); |
| 1428 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1436 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1429 if (!instance_active()) | 1437 if (!instance_active()) |
| 1430 return E_FAIL; | 1438 return E_FAIL; |
| 1431 | 1439 |
| 1432 if (!description) | 1440 if (!description) |
| 1433 return E_INVALIDARG; | 1441 return E_INVALIDARG; |
| 1434 | 1442 |
| 1435 int columns; | 1443 int columns; |
| 1436 int rows; | 1444 int rows; |
| 1437 if (!GetIntAttribute( | 1445 if (!GetIntAttribute( |
| 1438 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1446 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1466 } | 1474 } |
| 1467 | 1475 |
| 1468 return S_FALSE; | 1476 return S_FALSE; |
| 1469 } | 1477 } |
| 1470 | 1478 |
| 1471 STDMETHODIMP BrowserAccessibilityWin::get_columnExtentAt( | 1479 STDMETHODIMP BrowserAccessibilityWin::get_columnExtentAt( |
| 1472 long row, | 1480 long row, |
| 1473 long column, | 1481 long column, |
| 1474 long* n_columns_spanned) { | 1482 long* n_columns_spanned) { |
| 1475 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_EXTENT_AT); | 1483 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_EXTENT_AT); |
| 1476 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1484 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1477 if (!instance_active()) | 1485 if (!instance_active()) |
| 1478 return E_FAIL; | 1486 return E_FAIL; |
| 1479 | 1487 |
| 1480 if (!n_columns_spanned) | 1488 if (!n_columns_spanned) |
| 1481 return E_INVALIDARG; | 1489 return E_INVALIDARG; |
| 1482 | 1490 |
| 1483 int columns; | 1491 int columns; |
| 1484 int rows; | 1492 int rows; |
| 1485 if (!GetIntAttribute( | 1493 if (!GetIntAttribute( |
| 1486 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1494 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1506 return S_OK; | 1514 return S_OK; |
| 1507 } | 1515 } |
| 1508 | 1516 |
| 1509 return S_FALSE; | 1517 return S_FALSE; |
| 1510 } | 1518 } |
| 1511 | 1519 |
| 1512 STDMETHODIMP BrowserAccessibilityWin::get_columnHeader( | 1520 STDMETHODIMP BrowserAccessibilityWin::get_columnHeader( |
| 1513 IAccessibleTable** accessible_table, | 1521 IAccessibleTable** accessible_table, |
| 1514 long* starting_row_index) { | 1522 long* starting_row_index) { |
| 1515 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_HEADER); | 1523 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_HEADER); |
| 1516 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1524 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1517 // TODO(dmazzoni): implement | 1525 // TODO(dmazzoni): implement |
| 1518 return E_NOTIMPL; | 1526 return E_NOTIMPL; |
| 1519 } | 1527 } |
| 1520 | 1528 |
| 1521 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long cell_index, | 1529 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long cell_index, |
| 1522 long* column_index) { | 1530 long* column_index) { |
| 1523 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_INDEX); | 1531 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_INDEX); |
| 1524 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1532 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1525 if (!instance_active()) | 1533 if (!instance_active()) |
| 1526 return E_FAIL; | 1534 return E_FAIL; |
| 1527 | 1535 |
| 1528 if (!column_index) | 1536 if (!column_index) |
| 1529 return E_INVALIDARG; | 1537 return E_INVALIDARG; |
| 1530 | 1538 |
| 1531 const std::vector<int32_t>& unique_cell_ids = | 1539 const std::vector<int32_t>& unique_cell_ids = |
| 1532 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); | 1540 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 1533 int cell_id_count = static_cast<int>(unique_cell_ids.size()); | 1541 int cell_id_count = static_cast<int>(unique_cell_ids.size()); |
| 1534 if (cell_index < 0) | 1542 if (cell_index < 0) |
| 1535 return E_INVALIDARG; | 1543 return E_INVALIDARG; |
| 1536 if (cell_index >= cell_id_count) | 1544 if (cell_index >= cell_id_count) |
| 1537 return S_FALSE; | 1545 return S_FALSE; |
| 1538 | 1546 |
| 1539 int cell_id = unique_cell_ids[cell_index]; | 1547 int cell_id = unique_cell_ids[cell_index]; |
| 1540 BrowserAccessibilityWin* cell = GetFromID(cell_id); | 1548 BrowserAccessibilityWin* cell = GetFromID(cell_id); |
| 1541 int col_index; | 1549 int col_index; |
| 1542 if (cell && | 1550 if (cell && |
| 1543 cell->GetIntAttribute( | 1551 cell->GetIntAttribute( |
| 1544 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &col_index)) { | 1552 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &col_index)) { |
| 1545 *column_index = col_index; | 1553 *column_index = col_index; |
| 1546 return S_OK; | 1554 return S_OK; |
| 1547 } | 1555 } |
| 1548 | 1556 |
| 1549 return S_FALSE; | 1557 return S_FALSE; |
| 1550 } | 1558 } |
| 1551 | 1559 |
| 1552 STDMETHODIMP BrowserAccessibilityWin::get_nColumns(long* column_count) { | 1560 STDMETHODIMP BrowserAccessibilityWin::get_nColumns(long* column_count) { |
| 1553 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_COLUMNS); | 1561 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_COLUMNS); |
| 1554 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1562 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1555 if (!instance_active()) | 1563 if (!instance_active()) |
| 1556 return E_FAIL; | 1564 return E_FAIL; |
| 1557 | 1565 |
| 1558 if (!column_count) | 1566 if (!column_count) |
| 1559 return E_INVALIDARG; | 1567 return E_INVALIDARG; |
| 1560 | 1568 |
| 1561 int columns; | 1569 int columns; |
| 1562 if (GetIntAttribute( | 1570 if (GetIntAttribute( |
| 1563 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns)) { | 1571 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns)) { |
| 1564 *column_count = columns; | 1572 *column_count = columns; |
| 1565 return S_OK; | 1573 return S_OK; |
| 1566 } | 1574 } |
| 1567 | 1575 |
| 1568 return S_FALSE; | 1576 return S_FALSE; |
| 1569 } | 1577 } |
| 1570 | 1578 |
| 1571 STDMETHODIMP BrowserAccessibilityWin::get_nRows(long* row_count) { | 1579 STDMETHODIMP BrowserAccessibilityWin::get_nRows(long* row_count) { |
| 1572 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_ROWS); | 1580 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_ROWS); |
| 1573 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1581 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1574 if (!instance_active()) | 1582 if (!instance_active()) |
| 1575 return E_FAIL; | 1583 return E_FAIL; |
| 1576 | 1584 |
| 1577 if (!row_count) | 1585 if (!row_count) |
| 1578 return E_INVALIDARG; | 1586 return E_INVALIDARG; |
| 1579 | 1587 |
| 1580 int rows; | 1588 int rows; |
| 1581 if (GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows)) { | 1589 if (GetIntAttribute(ui::AX_ATTR_TABLE_ROW_COUNT, &rows)) { |
| 1582 *row_count = rows; | 1590 *row_count = rows; |
| 1583 return S_OK; | 1591 return S_OK; |
| 1584 } | 1592 } |
| 1585 | 1593 |
| 1586 return S_FALSE; | 1594 return S_FALSE; |
| 1587 } | 1595 } |
| 1588 | 1596 |
| 1589 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedChildren(long* cell_count) { | 1597 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedChildren(long* cell_count) { |
| 1590 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_CHILDREN); | 1598 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_CHILDREN); |
| 1591 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1599 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1592 if (!instance_active()) | 1600 if (!instance_active()) |
| 1593 return E_FAIL; | 1601 return E_FAIL; |
| 1594 | 1602 |
| 1595 if (!cell_count) | 1603 if (!cell_count) |
| 1596 return E_INVALIDARG; | 1604 return E_INVALIDARG; |
| 1597 | 1605 |
| 1598 // TODO(dmazzoni): add support for selected cells/rows/columns in tables. | 1606 // TODO(dmazzoni): add support for selected cells/rows/columns in tables. |
| 1599 *cell_count = 0; | 1607 *cell_count = 0; |
| 1600 return S_OK; | 1608 return S_OK; |
| 1601 } | 1609 } |
| 1602 | 1610 |
| 1603 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedColumns(long* column_count) { | 1611 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedColumns(long* column_count) { |
| 1604 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_COLUMNS); | 1612 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_COLUMNS); |
| 1605 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1613 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1606 if (!instance_active()) | 1614 if (!instance_active()) |
| 1607 return E_FAIL; | 1615 return E_FAIL; |
| 1608 | 1616 |
| 1609 if (!column_count) | 1617 if (!column_count) |
| 1610 return E_INVALIDARG; | 1618 return E_INVALIDARG; |
| 1611 | 1619 |
| 1612 *column_count = 0; | 1620 *column_count = 0; |
| 1613 return S_OK; | 1621 return S_OK; |
| 1614 } | 1622 } |
| 1615 | 1623 |
| 1616 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedRows(long* row_count) { | 1624 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedRows(long* row_count) { |
| 1617 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_ROWS); | 1625 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_ROWS); |
| 1618 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1626 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1619 if (!instance_active()) | 1627 if (!instance_active()) |
| 1620 return E_FAIL; | 1628 return E_FAIL; |
| 1621 | 1629 |
| 1622 if (!row_count) | 1630 if (!row_count) |
| 1623 return E_INVALIDARG; | 1631 return E_INVALIDARG; |
| 1624 | 1632 |
| 1625 *row_count = 0; | 1633 *row_count = 0; |
| 1626 return S_OK; | 1634 return S_OK; |
| 1627 } | 1635 } |
| 1628 | 1636 |
| 1629 STDMETHODIMP BrowserAccessibilityWin::get_rowDescription(long row, | 1637 STDMETHODIMP BrowserAccessibilityWin::get_rowDescription(long row, |
| 1630 BSTR* description) { | 1638 BSTR* description) { |
| 1631 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_DESCRIPTION); | 1639 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_DESCRIPTION); |
| 1632 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1640 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1633 if (!instance_active()) | 1641 if (!instance_active()) |
| 1634 return E_FAIL; | 1642 return E_FAIL; |
| 1635 | 1643 |
| 1636 if (!description) | 1644 if (!description) |
| 1637 return E_INVALIDARG; | 1645 return E_INVALIDARG; |
| 1638 | 1646 |
| 1639 int columns; | 1647 int columns; |
| 1640 int rows; | 1648 int rows; |
| 1641 if (!GetIntAttribute( | 1649 if (!GetIntAttribute( |
| 1642 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1650 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 26 matching lines...) Expand all Loading... |
| 1669 } | 1677 } |
| 1670 } | 1678 } |
| 1671 | 1679 |
| 1672 return S_FALSE; | 1680 return S_FALSE; |
| 1673 } | 1681 } |
| 1674 | 1682 |
| 1675 STDMETHODIMP BrowserAccessibilityWin::get_rowExtentAt(long row, | 1683 STDMETHODIMP BrowserAccessibilityWin::get_rowExtentAt(long row, |
| 1676 long column, | 1684 long column, |
| 1677 long* n_rows_spanned) { | 1685 long* n_rows_spanned) { |
| 1678 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_EXTENT_AT); | 1686 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_EXTENT_AT); |
| 1679 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1687 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1680 if (!instance_active()) | 1688 if (!instance_active()) |
| 1681 return E_FAIL; | 1689 return E_FAIL; |
| 1682 | 1690 |
| 1683 if (!n_rows_spanned) | 1691 if (!n_rows_spanned) |
| 1684 return E_INVALIDARG; | 1692 return E_INVALIDARG; |
| 1685 | 1693 |
| 1686 int columns; | 1694 int columns; |
| 1687 int rows; | 1695 int rows; |
| 1688 if (!GetIntAttribute( | 1696 if (!GetIntAttribute( |
| 1689 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || | 1697 ui::AX_ATTR_TABLE_COLUMN_COUNT, &columns) || |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1709 return S_OK; | 1717 return S_OK; |
| 1710 } | 1718 } |
| 1711 | 1719 |
| 1712 return S_FALSE; | 1720 return S_FALSE; |
| 1713 } | 1721 } |
| 1714 | 1722 |
| 1715 STDMETHODIMP BrowserAccessibilityWin::get_rowHeader( | 1723 STDMETHODIMP BrowserAccessibilityWin::get_rowHeader( |
| 1716 IAccessibleTable** accessible_table, | 1724 IAccessibleTable** accessible_table, |
| 1717 long* starting_column_index) { | 1725 long* starting_column_index) { |
| 1718 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_HEADER); | 1726 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_HEADER); |
| 1719 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1727 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1720 // TODO(dmazzoni): implement | 1728 // TODO(dmazzoni): implement |
| 1721 return E_NOTIMPL; | 1729 return E_NOTIMPL; |
| 1722 } | 1730 } |
| 1723 | 1731 |
| 1724 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long cell_index, | 1732 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long cell_index, |
| 1725 long* row_index) { | 1733 long* row_index) { |
| 1726 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_INDEX); | 1734 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_INDEX); |
| 1727 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1735 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1728 if (!instance_active()) | 1736 if (!instance_active()) |
| 1729 return E_FAIL; | 1737 return E_FAIL; |
| 1730 | 1738 |
| 1731 if (!row_index) | 1739 if (!row_index) |
| 1732 return E_INVALIDARG; | 1740 return E_INVALIDARG; |
| 1733 | 1741 |
| 1734 const std::vector<int32_t>& unique_cell_ids = | 1742 const std::vector<int32_t>& unique_cell_ids = |
| 1735 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); | 1743 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 1736 int cell_id_count = static_cast<int>(unique_cell_ids.size()); | 1744 int cell_id_count = static_cast<int>(unique_cell_ids.size()); |
| 1737 if (cell_index < 0) | 1745 if (cell_index < 0) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1749 return S_OK; | 1757 return S_OK; |
| 1750 } | 1758 } |
| 1751 | 1759 |
| 1752 return S_FALSE; | 1760 return S_FALSE; |
| 1753 } | 1761 } |
| 1754 | 1762 |
| 1755 STDMETHODIMP BrowserAccessibilityWin::get_selectedChildren(long max_children, | 1763 STDMETHODIMP BrowserAccessibilityWin::get_selectedChildren(long max_children, |
| 1756 long** children, | 1764 long** children, |
| 1757 long* n_children) { | 1765 long* n_children) { |
| 1758 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_CHILDREN); | 1766 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_CHILDREN); |
| 1759 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1767 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1760 if (!instance_active()) | 1768 if (!instance_active()) |
| 1761 return E_FAIL; | 1769 return E_FAIL; |
| 1762 | 1770 |
| 1763 if (!children || !n_children) | 1771 if (!children || !n_children) |
| 1764 return E_INVALIDARG; | 1772 return E_INVALIDARG; |
| 1765 | 1773 |
| 1766 // TODO(dmazzoni): Implement this. | 1774 // TODO(dmazzoni): Implement this. |
| 1767 *n_children = 0; | 1775 *n_children = 0; |
| 1768 return S_OK; | 1776 return S_OK; |
| 1769 } | 1777 } |
| 1770 | 1778 |
| 1771 STDMETHODIMP BrowserAccessibilityWin::get_selectedColumns(long max_columns, | 1779 STDMETHODIMP BrowserAccessibilityWin::get_selectedColumns(long max_columns, |
| 1772 long** columns, | 1780 long** columns, |
| 1773 long* n_columns) { | 1781 long* n_columns) { |
| 1774 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_COLUMNS); | 1782 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_COLUMNS); |
| 1775 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1783 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1776 if (!instance_active()) | 1784 if (!instance_active()) |
| 1777 return E_FAIL; | 1785 return E_FAIL; |
| 1778 | 1786 |
| 1779 if (!columns || !n_columns) | 1787 if (!columns || !n_columns) |
| 1780 return E_INVALIDARG; | 1788 return E_INVALIDARG; |
| 1781 | 1789 |
| 1782 // TODO(dmazzoni): Implement this. | 1790 // TODO(dmazzoni): Implement this. |
| 1783 *n_columns = 0; | 1791 *n_columns = 0; |
| 1784 return S_OK; | 1792 return S_OK; |
| 1785 } | 1793 } |
| 1786 | 1794 |
| 1787 STDMETHODIMP BrowserAccessibilityWin::get_selectedRows(long max_rows, | 1795 STDMETHODIMP BrowserAccessibilityWin::get_selectedRows(long max_rows, |
| 1788 long** rows, | 1796 long** rows, |
| 1789 long* n_rows) { | 1797 long* n_rows) { |
| 1790 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_ROWS); | 1798 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_ROWS); |
| 1791 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1799 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1792 if (!instance_active()) | 1800 if (!instance_active()) |
| 1793 return E_FAIL; | 1801 return E_FAIL; |
| 1794 | 1802 |
| 1795 if (!rows || !n_rows) | 1803 if (!rows || !n_rows) |
| 1796 return E_INVALIDARG; | 1804 return E_INVALIDARG; |
| 1797 | 1805 |
| 1798 // TODO(dmazzoni): Implement this. | 1806 // TODO(dmazzoni): Implement this. |
| 1799 *n_rows = 0; | 1807 *n_rows = 0; |
| 1800 return S_OK; | 1808 return S_OK; |
| 1801 } | 1809 } |
| 1802 | 1810 |
| 1803 STDMETHODIMP BrowserAccessibilityWin::get_summary(IUnknown** accessible) { | 1811 STDMETHODIMP BrowserAccessibilityWin::get_summary(IUnknown** accessible) { |
| 1804 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SUMMARY); | 1812 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SUMMARY); |
| 1805 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1813 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1806 if (!instance_active()) | 1814 if (!instance_active()) |
| 1807 return E_FAIL; | 1815 return E_FAIL; |
| 1808 | 1816 |
| 1809 if (!accessible) | 1817 if (!accessible) |
| 1810 return E_INVALIDARG; | 1818 return E_INVALIDARG; |
| 1811 | 1819 |
| 1812 // TODO(dmazzoni): implement | 1820 // TODO(dmazzoni): implement |
| 1813 return S_FALSE; | 1821 return S_FALSE; |
| 1814 } | 1822 } |
| 1815 | 1823 |
| 1816 STDMETHODIMP BrowserAccessibilityWin::get_isColumnSelected( | 1824 STDMETHODIMP BrowserAccessibilityWin::get_isColumnSelected( |
| 1817 long column, | 1825 long column, |
| 1818 boolean* is_selected) { | 1826 boolean* is_selected) { |
| 1819 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_COLUMN_SELECTED); | 1827 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_COLUMN_SELECTED); |
| 1820 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1828 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1821 if (!instance_active()) | 1829 if (!instance_active()) |
| 1822 return E_FAIL; | 1830 return E_FAIL; |
| 1823 | 1831 |
| 1824 if (!is_selected) | 1832 if (!is_selected) |
| 1825 return E_INVALIDARG; | 1833 return E_INVALIDARG; |
| 1826 | 1834 |
| 1827 // TODO(dmazzoni): Implement this. | 1835 // TODO(dmazzoni): Implement this. |
| 1828 *is_selected = false; | 1836 *is_selected = false; |
| 1829 return S_OK; | 1837 return S_OK; |
| 1830 } | 1838 } |
| 1831 | 1839 |
| 1832 STDMETHODIMP BrowserAccessibilityWin::get_isRowSelected(long row, | 1840 STDMETHODIMP BrowserAccessibilityWin::get_isRowSelected(long row, |
| 1833 boolean* is_selected) { | 1841 boolean* is_selected) { |
| 1834 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_ROW_SELECTED); | 1842 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_ROW_SELECTED); |
| 1835 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1843 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1836 if (!instance_active()) | 1844 if (!instance_active()) |
| 1837 return E_FAIL; | 1845 return E_FAIL; |
| 1838 | 1846 |
| 1839 if (!is_selected) | 1847 if (!is_selected) |
| 1840 return E_INVALIDARG; | 1848 return E_INVALIDARG; |
| 1841 | 1849 |
| 1842 // TODO(dmazzoni): Implement this. | 1850 // TODO(dmazzoni): Implement this. |
| 1843 *is_selected = false; | 1851 *is_selected = false; |
| 1844 return S_OK; | 1852 return S_OK; |
| 1845 } | 1853 } |
| 1846 | 1854 |
| 1847 STDMETHODIMP BrowserAccessibilityWin::get_isSelected(long row, | 1855 STDMETHODIMP BrowserAccessibilityWin::get_isSelected(long row, |
| 1848 long column, | 1856 long column, |
| 1849 boolean* is_selected) { | 1857 boolean* is_selected) { |
| 1850 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_SELECTED); | 1858 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_SELECTED); |
| 1851 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1859 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1852 if (!instance_active()) | 1860 if (!instance_active()) |
| 1853 return E_FAIL; | 1861 return E_FAIL; |
| 1854 | 1862 |
| 1855 if (!is_selected) | 1863 if (!is_selected) |
| 1856 return E_INVALIDARG; | 1864 return E_INVALIDARG; |
| 1857 | 1865 |
| 1858 // TODO(dmazzoni): Implement this. | 1866 // TODO(dmazzoni): Implement this. |
| 1859 *is_selected = false; | 1867 *is_selected = false; |
| 1860 return S_OK; | 1868 return S_OK; |
| 1861 } | 1869 } |
| 1862 | 1870 |
| 1863 STDMETHODIMP BrowserAccessibilityWin::get_rowColumnExtentsAtIndex( | 1871 STDMETHODIMP BrowserAccessibilityWin::get_rowColumnExtentsAtIndex( |
| 1864 long index, | 1872 long index, |
| 1865 long* row, | 1873 long* row, |
| 1866 long* column, | 1874 long* column, |
| 1867 long* row_extents, | 1875 long* row_extents, |
| 1868 long* column_extents, | 1876 long* column_extents, |
| 1869 boolean* is_selected) { | 1877 boolean* is_selected) { |
| 1870 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_COLUMN_EXTENTS_AT_INDEX); | 1878 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_COLUMN_EXTENTS_AT_INDEX); |
| 1871 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1879 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1872 if (!instance_active()) | 1880 if (!instance_active()) |
| 1873 return E_FAIL; | 1881 return E_FAIL; |
| 1874 | 1882 |
| 1875 if (!row || !column || !row_extents || !column_extents || !is_selected) | 1883 if (!row || !column || !row_extents || !column_extents || !is_selected) |
| 1876 return E_INVALIDARG; | 1884 return E_INVALIDARG; |
| 1877 | 1885 |
| 1878 const std::vector<int32_t>& unique_cell_ids = | 1886 const std::vector<int32_t>& unique_cell_ids = |
| 1879 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); | 1887 GetIntListAttribute(ui::AX_ATTR_UNIQUE_CELL_IDS); |
| 1880 int cell_id_count = static_cast<int>(unique_cell_ids.size()); | 1888 int cell_id_count = static_cast<int>(unique_cell_ids.size()); |
| 1881 if (index < 0) | 1889 if (index < 0) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1897 *row_extents = rowspan; | 1905 *row_extents = rowspan; |
| 1898 *column_extents = colspan; | 1906 *column_extents = colspan; |
| 1899 return S_OK; | 1907 return S_OK; |
| 1900 } | 1908 } |
| 1901 | 1909 |
| 1902 return S_FALSE; | 1910 return S_FALSE; |
| 1903 } | 1911 } |
| 1904 | 1912 |
| 1905 STDMETHODIMP BrowserAccessibilityWin::selectRow(long row) { | 1913 STDMETHODIMP BrowserAccessibilityWin::selectRow(long row) { |
| 1906 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SELECT_ROW); | 1914 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SELECT_ROW); |
| 1907 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1915 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1908 return E_NOTIMPL; | 1916 return E_NOTIMPL; |
| 1909 } | 1917 } |
| 1910 | 1918 |
| 1911 STDMETHODIMP BrowserAccessibilityWin::selectColumn(long column) { | 1919 STDMETHODIMP BrowserAccessibilityWin::selectColumn(long column) { |
| 1912 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SELECT_COLUMN); | 1920 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SELECT_COLUMN); |
| 1913 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1921 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1914 return E_NOTIMPL; | 1922 return E_NOTIMPL; |
| 1915 } | 1923 } |
| 1916 | 1924 |
| 1917 STDMETHODIMP BrowserAccessibilityWin::unselectRow(long row) { | 1925 STDMETHODIMP BrowserAccessibilityWin::unselectRow(long row) { |
| 1918 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_UNSELECT_ROW); | 1926 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_UNSELECT_ROW); |
| 1919 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1927 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1920 return E_NOTIMPL; | 1928 return E_NOTIMPL; |
| 1921 } | 1929 } |
| 1922 | 1930 |
| 1923 STDMETHODIMP BrowserAccessibilityWin::unselectColumn(long column) { | 1931 STDMETHODIMP BrowserAccessibilityWin::unselectColumn(long column) { |
| 1924 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_UNSELECT_COLUMN); | 1932 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_UNSELECT_COLUMN); |
| 1925 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1933 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1926 return E_NOTIMPL; | 1934 return E_NOTIMPL; |
| 1927 } | 1935 } |
| 1928 | 1936 |
| 1929 STDMETHODIMP | 1937 STDMETHODIMP |
| 1930 BrowserAccessibilityWin::get_modelChange(IA2TableModelChange* model_change) { | 1938 BrowserAccessibilityWin::get_modelChange(IA2TableModelChange* model_change) { |
| 1931 return E_NOTIMPL; | 1939 return E_NOTIMPL; |
| 1932 } | 1940 } |
| 1933 | 1941 |
| 1934 // | 1942 // |
| 1935 // IAccessibleTable2 methods. | 1943 // IAccessibleTable2 methods. |
| 1936 // | 1944 // |
| 1937 | 1945 |
| 1938 STDMETHODIMP BrowserAccessibilityWin::get_cellAt(long row, | 1946 STDMETHODIMP BrowserAccessibilityWin::get_cellAt(long row, |
| 1939 long column, | 1947 long column, |
| 1940 IUnknown** cell) { | 1948 IUnknown** cell) { |
| 1941 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CELL_AT); | 1949 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CELL_AT); |
| 1942 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1950 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1943 return get_accessibleAt(row, column, cell); | 1951 return get_accessibleAt(row, column, cell); |
| 1944 } | 1952 } |
| 1945 | 1953 |
| 1946 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedCells(long* cell_count) { | 1954 STDMETHODIMP BrowserAccessibilityWin::get_nSelectedCells(long* cell_count) { |
| 1947 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_CELLS); | 1955 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_CELLS); |
| 1948 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1956 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1949 return get_nSelectedChildren(cell_count); | 1957 return get_nSelectedChildren(cell_count); |
| 1950 } | 1958 } |
| 1951 | 1959 |
| 1952 STDMETHODIMP BrowserAccessibilityWin::get_selectedCells( | 1960 STDMETHODIMP BrowserAccessibilityWin::get_selectedCells( |
| 1953 IUnknown*** cells, | 1961 IUnknown*** cells, |
| 1954 long* n_selected_cells) { | 1962 long* n_selected_cells) { |
| 1955 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_CELLS); | 1963 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_CELLS); |
| 1956 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1964 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1957 if (!instance_active()) | 1965 if (!instance_active()) |
| 1958 return E_FAIL; | 1966 return E_FAIL; |
| 1959 | 1967 |
| 1960 if (!cells || !n_selected_cells) | 1968 if (!cells || !n_selected_cells) |
| 1961 return E_INVALIDARG; | 1969 return E_INVALIDARG; |
| 1962 | 1970 |
| 1963 // TODO(dmazzoni): Implement this. | 1971 // TODO(dmazzoni): Implement this. |
| 1964 *n_selected_cells = 0; | 1972 *n_selected_cells = 0; |
| 1965 return S_OK; | 1973 return S_OK; |
| 1966 } | 1974 } |
| 1967 | 1975 |
| 1968 STDMETHODIMP BrowserAccessibilityWin::get_selectedColumns(long** columns, | 1976 STDMETHODIMP BrowserAccessibilityWin::get_selectedColumns(long** columns, |
| 1969 long* n_columns) { | 1977 long* n_columns) { |
| 1970 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLE2_GET_SELECTED_COLUMNS); | 1978 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLE2_GET_SELECTED_COLUMNS); |
| 1971 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1979 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1972 if (!instance_active()) | 1980 if (!instance_active()) |
| 1973 return E_FAIL; | 1981 return E_FAIL; |
| 1974 | 1982 |
| 1975 if (!columns || !n_columns) | 1983 if (!columns || !n_columns) |
| 1976 return E_INVALIDARG; | 1984 return E_INVALIDARG; |
| 1977 | 1985 |
| 1978 // TODO(dmazzoni): Implement this. | 1986 // TODO(dmazzoni): Implement this. |
| 1979 *n_columns = 0; | 1987 *n_columns = 0; |
| 1980 return S_OK; | 1988 return S_OK; |
| 1981 } | 1989 } |
| 1982 | 1990 |
| 1983 STDMETHODIMP BrowserAccessibilityWin::get_selectedRows(long** rows, | 1991 STDMETHODIMP BrowserAccessibilityWin::get_selectedRows(long** rows, |
| 1984 long* n_rows) { | 1992 long* n_rows) { |
| 1985 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLE2_GET_SELECTED_ROWS); | 1993 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLE2_GET_SELECTED_ROWS); |
| 1986 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1994 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1987 if (!instance_active()) | 1995 if (!instance_active()) |
| 1988 return E_FAIL; | 1996 return E_FAIL; |
| 1989 | 1997 |
| 1990 if (!rows || !n_rows) | 1998 if (!rows || !n_rows) |
| 1991 return E_INVALIDARG; | 1999 return E_INVALIDARG; |
| 1992 | 2000 |
| 1993 // TODO(dmazzoni): Implement this. | 2001 // TODO(dmazzoni): Implement this. |
| 1994 *n_rows = 0; | 2002 *n_rows = 0; |
| 1995 return S_OK; | 2003 return S_OK; |
| 1996 } | 2004 } |
| 1997 | 2005 |
| 1998 | 2006 |
| 1999 // | 2007 // |
| 2000 // IAccessibleTableCell methods. | 2008 // IAccessibleTableCell methods. |
| 2001 // | 2009 // |
| 2002 | 2010 |
| 2003 STDMETHODIMP BrowserAccessibilityWin::get_columnExtent( | 2011 STDMETHODIMP BrowserAccessibilityWin::get_columnExtent( |
| 2004 long* n_columns_spanned) { | 2012 long* n_columns_spanned) { |
| 2005 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_EXTENT); | 2013 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_EXTENT); |
| 2006 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2014 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2007 if (!instance_active()) | 2015 if (!instance_active()) |
| 2008 return E_FAIL; | 2016 return E_FAIL; |
| 2009 | 2017 |
| 2010 if (!n_columns_spanned) | 2018 if (!n_columns_spanned) |
| 2011 return E_INVALIDARG; | 2019 return E_INVALIDARG; |
| 2012 | 2020 |
| 2013 int colspan; | 2021 int colspan; |
| 2014 if (GetIntAttribute( | 2022 if (GetIntAttribute( |
| 2015 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && | 2023 ui::AX_ATTR_TABLE_CELL_COLUMN_SPAN, &colspan) && |
| 2016 colspan >= 1) { | 2024 colspan >= 1) { |
| 2017 *n_columns_spanned = colspan; | 2025 *n_columns_spanned = colspan; |
| 2018 return S_OK; | 2026 return S_OK; |
| 2019 } | 2027 } |
| 2020 | 2028 |
| 2021 return S_FALSE; | 2029 return S_FALSE; |
| 2022 } | 2030 } |
| 2023 | 2031 |
| 2024 STDMETHODIMP BrowserAccessibilityWin::get_columnHeaderCells( | 2032 STDMETHODIMP BrowserAccessibilityWin::get_columnHeaderCells( |
| 2025 IUnknown*** cell_accessibles, | 2033 IUnknown*** cell_accessibles, |
| 2026 long* n_column_header_cells) { | 2034 long* n_column_header_cells) { |
| 2027 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_HEADER_CELLS); | 2035 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_HEADER_CELLS); |
| 2028 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2036 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2029 if (!instance_active()) | 2037 if (!instance_active()) |
| 2030 return E_FAIL; | 2038 return E_FAIL; |
| 2031 | 2039 |
| 2032 if (!cell_accessibles || !n_column_header_cells) | 2040 if (!cell_accessibles || !n_column_header_cells) |
| 2033 return E_INVALIDARG; | 2041 return E_INVALIDARG; |
| 2034 | 2042 |
| 2035 *n_column_header_cells = 0; | 2043 *n_column_header_cells = 0; |
| 2036 | 2044 |
| 2037 int column; | 2045 int column; |
| 2038 if (!GetIntAttribute( | 2046 if (!GetIntAttribute( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2080 ToBrowserAccessibilityWin(cell)->NewReference()); | 2088 ToBrowserAccessibilityWin(cell)->NewReference()); |
| 2081 ++index; | 2089 ++index; |
| 2082 } | 2090 } |
| 2083 } | 2091 } |
| 2084 | 2092 |
| 2085 return S_OK; | 2093 return S_OK; |
| 2086 } | 2094 } |
| 2087 | 2095 |
| 2088 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long* column_index) { | 2096 STDMETHODIMP BrowserAccessibilityWin::get_columnIndex(long* column_index) { |
| 2089 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_COLUMN_INDEX); | 2097 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_COLUMN_INDEX); |
| 2090 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2098 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2091 if (!instance_active()) | 2099 if (!instance_active()) |
| 2092 return E_FAIL; | 2100 return E_FAIL; |
| 2093 | 2101 |
| 2094 if (!column_index) | 2102 if (!column_index) |
| 2095 return E_INVALIDARG; | 2103 return E_INVALIDARG; |
| 2096 | 2104 |
| 2097 int column; | 2105 int column; |
| 2098 if (GetIntAttribute( | 2106 if (GetIntAttribute( |
| 2099 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { | 2107 ui::AX_ATTR_TABLE_CELL_COLUMN_INDEX, &column)) { |
| 2100 *column_index = column; | 2108 *column_index = column; |
| 2101 return S_OK; | 2109 return S_OK; |
| 2102 } | 2110 } |
| 2103 | 2111 |
| 2104 return S_FALSE; | 2112 return S_FALSE; |
| 2105 } | 2113 } |
| 2106 | 2114 |
| 2107 STDMETHODIMP BrowserAccessibilityWin::get_rowExtent(long* n_rows_spanned) { | 2115 STDMETHODIMP BrowserAccessibilityWin::get_rowExtent(long* n_rows_spanned) { |
| 2108 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_EXTENT); | 2116 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_EXTENT); |
| 2109 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2117 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2110 if (!instance_active()) | 2118 if (!instance_active()) |
| 2111 return E_FAIL; | 2119 return E_FAIL; |
| 2112 | 2120 |
| 2113 if (!n_rows_spanned) | 2121 if (!n_rows_spanned) |
| 2114 return E_INVALIDARG; | 2122 return E_INVALIDARG; |
| 2115 | 2123 |
| 2116 int rowspan; | 2124 int rowspan; |
| 2117 if (GetIntAttribute( | 2125 if (GetIntAttribute( |
| 2118 ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && | 2126 ui::AX_ATTR_TABLE_CELL_ROW_SPAN, &rowspan) && |
| 2119 rowspan >= 1) { | 2127 rowspan >= 1) { |
| 2120 *n_rows_spanned = rowspan; | 2128 *n_rows_spanned = rowspan; |
| 2121 return S_OK; | 2129 return S_OK; |
| 2122 } | 2130 } |
| 2123 | 2131 |
| 2124 return S_FALSE; | 2132 return S_FALSE; |
| 2125 } | 2133 } |
| 2126 | 2134 |
| 2127 STDMETHODIMP BrowserAccessibilityWin::get_rowHeaderCells( | 2135 STDMETHODIMP BrowserAccessibilityWin::get_rowHeaderCells( |
| 2128 IUnknown*** cell_accessibles, | 2136 IUnknown*** cell_accessibles, |
| 2129 long* n_row_header_cells) { | 2137 long* n_row_header_cells) { |
| 2130 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_HEADER_CELLS); | 2138 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_HEADER_CELLS); |
| 2131 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2139 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2132 if (!instance_active()) | 2140 if (!instance_active()) |
| 2133 return E_FAIL; | 2141 return E_FAIL; |
| 2134 | 2142 |
| 2135 if (!cell_accessibles || !n_row_header_cells) | 2143 if (!cell_accessibles || !n_row_header_cells) |
| 2136 return E_INVALIDARG; | 2144 return E_INVALIDARG; |
| 2137 | 2145 |
| 2138 *n_row_header_cells = 0; | 2146 *n_row_header_cells = 0; |
| 2139 | 2147 |
| 2140 int row; | 2148 int row; |
| 2141 if (!GetIntAttribute( | 2149 if (!GetIntAttribute( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2183 ToBrowserAccessibilityWin(cell)->NewReference()); | 2191 ToBrowserAccessibilityWin(cell)->NewReference()); |
| 2184 ++index; | 2192 ++index; |
| 2185 } | 2193 } |
| 2186 } | 2194 } |
| 2187 | 2195 |
| 2188 return S_OK; | 2196 return S_OK; |
| 2189 } | 2197 } |
| 2190 | 2198 |
| 2191 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long* row_index) { | 2199 STDMETHODIMP BrowserAccessibilityWin::get_rowIndex(long* row_index) { |
| 2192 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_ROW_INDEX); | 2200 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_ROW_INDEX); |
| 2193 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2201 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2194 if (!instance_active()) | 2202 if (!instance_active()) |
| 2195 return E_FAIL; | 2203 return E_FAIL; |
| 2196 | 2204 |
| 2197 if (!row_index) | 2205 if (!row_index) |
| 2198 return E_INVALIDARG; | 2206 return E_INVALIDARG; |
| 2199 | 2207 |
| 2200 int row; | 2208 int row; |
| 2201 if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row)) { | 2209 if (GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row)) { |
| 2202 *row_index = row; | 2210 *row_index = row; |
| 2203 return S_OK; | 2211 return S_OK; |
| 2204 } | 2212 } |
| 2205 return S_FALSE; | 2213 return S_FALSE; |
| 2206 } | 2214 } |
| 2207 | 2215 |
| 2208 STDMETHODIMP BrowserAccessibilityWin::get_isSelected(boolean* is_selected) { | 2216 STDMETHODIMP BrowserAccessibilityWin::get_isSelected(boolean* is_selected) { |
| 2209 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_IS_SELECTED); | 2217 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_IS_SELECTED); |
| 2210 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2218 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2211 if (!instance_active()) | 2219 if (!instance_active()) |
| 2212 return E_FAIL; | 2220 return E_FAIL; |
| 2213 | 2221 |
| 2214 if (!is_selected) | 2222 if (!is_selected) |
| 2215 return E_INVALIDARG; | 2223 return E_INVALIDARG; |
| 2216 | 2224 |
| 2217 *is_selected = false; | 2225 *is_selected = false; |
| 2218 return S_OK; | 2226 return S_OK; |
| 2219 } | 2227 } |
| 2220 | 2228 |
| 2221 STDMETHODIMP BrowserAccessibilityWin::get_rowColumnExtents( | 2229 STDMETHODIMP BrowserAccessibilityWin::get_rowColumnExtents( |
| 2222 long* row_index, | 2230 long* row_index, |
| 2223 long* column_index, | 2231 long* column_index, |
| 2224 long* row_extents, | 2232 long* row_extents, |
| 2225 long* column_extents, | 2233 long* column_extents, |
| 2226 boolean* is_selected) { | 2234 boolean* is_selected) { |
| 2227 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_COLUMN_EXTENTS); | 2235 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_COLUMN_EXTENTS); |
| 2228 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2236 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2229 if (!instance_active()) | 2237 if (!instance_active()) |
| 2230 return E_FAIL; | 2238 return E_FAIL; |
| 2231 | 2239 |
| 2232 if (!row_index || | 2240 if (!row_index || |
| 2233 !column_index || | 2241 !column_index || |
| 2234 !row_extents || | 2242 !row_extents || |
| 2235 !column_extents || | 2243 !column_extents || |
| 2236 !is_selected) { | 2244 !is_selected) { |
| 2237 return E_INVALIDARG; | 2245 return E_INVALIDARG; |
| 2238 } | 2246 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2254 *column_extents = colspan; | 2262 *column_extents = colspan; |
| 2255 *is_selected = false; | 2263 *is_selected = false; |
| 2256 return S_OK; | 2264 return S_OK; |
| 2257 } | 2265 } |
| 2258 | 2266 |
| 2259 return S_FALSE; | 2267 return S_FALSE; |
| 2260 } | 2268 } |
| 2261 | 2269 |
| 2262 STDMETHODIMP BrowserAccessibilityWin::get_table(IUnknown** table) { | 2270 STDMETHODIMP BrowserAccessibilityWin::get_table(IUnknown** table) { |
| 2263 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TABLE); | 2271 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TABLE); |
| 2264 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2272 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2265 if (!instance_active()) | 2273 if (!instance_active()) |
| 2266 return E_FAIL; | 2274 return E_FAIL; |
| 2267 | 2275 |
| 2268 if (!table) | 2276 if (!table) |
| 2269 return E_INVALIDARG; | 2277 return E_INVALIDARG; |
| 2270 | 2278 |
| 2271 | 2279 |
| 2272 int row; | 2280 int row; |
| 2273 int column; | 2281 int column; |
| 2274 GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row); | 2282 GetIntAttribute(ui::AX_ATTR_TABLE_CELL_ROW_INDEX, &row); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2287 | 2295 |
| 2288 return S_OK; | 2296 return S_OK; |
| 2289 } | 2297 } |
| 2290 | 2298 |
| 2291 // | 2299 // |
| 2292 // IAccessibleText methods. | 2300 // IAccessibleText methods. |
| 2293 // | 2301 // |
| 2294 | 2302 |
| 2295 STDMETHODIMP BrowserAccessibilityWin::get_nCharacters(LONG* n_characters) { | 2303 STDMETHODIMP BrowserAccessibilityWin::get_nCharacters(LONG* n_characters) { |
| 2296 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_CHARACTERS); | 2304 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_CHARACTERS); |
| 2297 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 2305 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 2298 AccessibilityMode::kInlineTextBoxes); | 2306 AccessibilityMode::kInlineTextBoxes); |
| 2299 if (!instance_active()) | 2307 if (!instance_active()) |
| 2300 return E_FAIL; | 2308 return E_FAIL; |
| 2301 | 2309 |
| 2302 if (!n_characters) | 2310 if (!n_characters) |
| 2303 return E_INVALIDARG; | 2311 return E_INVALIDARG; |
| 2304 | 2312 |
| 2305 *n_characters = static_cast<LONG>(GetText().size()); | 2313 *n_characters = static_cast<LONG>(GetText().size()); |
| 2306 return S_OK; | 2314 return S_OK; |
| 2307 } | 2315 } |
| 2308 | 2316 |
| 2309 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) { | 2317 STDMETHODIMP BrowserAccessibilityWin::get_caretOffset(LONG* offset) { |
| 2310 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CARET_OFFSET); | 2318 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CARET_OFFSET); |
| 2311 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2319 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2312 if (!instance_active()) | 2320 if (!instance_active()) |
| 2313 return E_FAIL; | 2321 return E_FAIL; |
| 2314 | 2322 |
| 2315 if (!offset) | 2323 if (!offset) |
| 2316 return E_INVALIDARG; | 2324 return E_INVALIDARG; |
| 2317 | 2325 |
| 2318 if (!HasCaret()) | 2326 if (!HasCaret()) |
| 2319 return S_FALSE; | 2327 return S_FALSE; |
| 2320 | 2328 |
| 2321 int selection_start, selection_end; | 2329 int selection_start, selection_end; |
| 2322 GetSelectionOffsets(&selection_start, &selection_end); | 2330 GetSelectionOffsets(&selection_start, &selection_end); |
| 2323 // The caret is always at the end of the selection. | 2331 // The caret is always at the end of the selection. |
| 2324 *offset = selection_end; | 2332 *offset = selection_end; |
| 2325 if (*offset < 0) | 2333 if (*offset < 0) |
| 2326 return S_FALSE; | 2334 return S_FALSE; |
| 2327 | 2335 |
| 2328 return S_OK; | 2336 return S_OK; |
| 2329 } | 2337 } |
| 2330 | 2338 |
| 2331 STDMETHODIMP BrowserAccessibilityWin::get_characterExtents( | 2339 STDMETHODIMP BrowserAccessibilityWin::get_characterExtents( |
| 2332 LONG offset, | 2340 LONG offset, |
| 2333 IA2CoordinateType coordinate_type, | 2341 IA2CoordinateType coordinate_type, |
| 2334 LONG* out_x, | 2342 LONG* out_x, |
| 2335 LONG* out_y, | 2343 LONG* out_y, |
| 2336 LONG* out_width, | 2344 LONG* out_width, |
| 2337 LONG* out_height) { | 2345 LONG* out_height) { |
| 2338 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHARACTER_EXTENTS); | 2346 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHARACTER_EXTENTS); |
| 2339 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 2347 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 2340 AccessibilityMode::kInlineTextBoxes); | 2348 AccessibilityMode::kInlineTextBoxes); |
| 2341 if (!instance_active()) | 2349 if (!instance_active()) |
| 2342 return E_FAIL; | 2350 return E_FAIL; |
| 2343 | 2351 |
| 2344 if (!out_x || !out_y || !out_width || !out_height) | 2352 if (!out_x || !out_y || !out_width || !out_height) |
| 2345 return E_INVALIDARG; | 2353 return E_INVALIDARG; |
| 2346 | 2354 |
| 2347 const base::string16& text_str = GetText(); | 2355 const base::string16& text_str = GetText(); |
| 2348 HandleSpecialTextOffset(&offset); | 2356 HandleSpecialTextOffset(&offset); |
| 2349 if (offset < 0 || offset > static_cast<LONG>(text_str.size())) | 2357 if (offset < 0 || offset > static_cast<LONG>(text_str.size())) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 2363 *out_x = character_bounds.x(); | 2371 *out_x = character_bounds.x(); |
| 2364 *out_y = character_bounds.y(); | 2372 *out_y = character_bounds.y(); |
| 2365 *out_width = character_bounds.width(); | 2373 *out_width = character_bounds.width(); |
| 2366 *out_height = character_bounds.height(); | 2374 *out_height = character_bounds.height(); |
| 2367 | 2375 |
| 2368 return S_OK; | 2376 return S_OK; |
| 2369 } | 2377 } |
| 2370 | 2378 |
| 2371 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) { | 2379 STDMETHODIMP BrowserAccessibilityWin::get_nSelections(LONG* n_selections) { |
| 2372 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTIONS); | 2380 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTIONS); |
| 2373 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2381 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2374 if (!instance_active()) | 2382 if (!instance_active()) |
| 2375 return E_FAIL; | 2383 return E_FAIL; |
| 2376 | 2384 |
| 2377 if (!n_selections) | 2385 if (!n_selections) |
| 2378 return E_INVALIDARG; | 2386 return E_INVALIDARG; |
| 2379 | 2387 |
| 2380 *n_selections = 0; | 2388 *n_selections = 0; |
| 2381 int selection_start, selection_end; | 2389 int selection_start, selection_end; |
| 2382 GetSelectionOffsets(&selection_start, &selection_end); | 2390 GetSelectionOffsets(&selection_start, &selection_end); |
| 2383 if (selection_start >= 0 && selection_end >= 0 && | 2391 if (selection_start >= 0 && selection_end >= 0 && |
| 2384 selection_start != selection_end) { | 2392 selection_start != selection_end) { |
| 2385 *n_selections = 1; | 2393 *n_selections = 1; |
| 2386 } | 2394 } |
| 2387 | 2395 |
| 2388 return S_OK; | 2396 return S_OK; |
| 2389 } | 2397 } |
| 2390 | 2398 |
| 2391 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index, | 2399 STDMETHODIMP BrowserAccessibilityWin::get_selection(LONG selection_index, |
| 2392 LONG* start_offset, | 2400 LONG* start_offset, |
| 2393 LONG* end_offset) { | 2401 LONG* end_offset) { |
| 2394 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTION); | 2402 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTION); |
| 2395 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2403 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2396 if (!instance_active()) | 2404 if (!instance_active()) |
| 2397 return E_FAIL; | 2405 return E_FAIL; |
| 2398 | 2406 |
| 2399 if (!start_offset || !end_offset || selection_index != 0) | 2407 if (!start_offset || !end_offset || selection_index != 0) |
| 2400 return E_INVALIDARG; | 2408 return E_INVALIDARG; |
| 2401 | 2409 |
| 2402 *start_offset = 0; | 2410 *start_offset = 0; |
| 2403 *end_offset = 0; | 2411 *end_offset = 0; |
| 2404 int selection_start, selection_end; | 2412 int selection_start, selection_end; |
| 2405 GetSelectionOffsets(&selection_start, &selection_end); | 2413 GetSelectionOffsets(&selection_start, &selection_end); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2417 return S_OK; | 2425 return S_OK; |
| 2418 } | 2426 } |
| 2419 | 2427 |
| 2420 return E_INVALIDARG; | 2428 return E_INVALIDARG; |
| 2421 } | 2429 } |
| 2422 | 2430 |
| 2423 STDMETHODIMP BrowserAccessibilityWin::get_text(LONG start_offset, | 2431 STDMETHODIMP BrowserAccessibilityWin::get_text(LONG start_offset, |
| 2424 LONG end_offset, | 2432 LONG end_offset, |
| 2425 BSTR* text) { | 2433 BSTR* text) { |
| 2426 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT); | 2434 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT); |
| 2427 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2435 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2428 if (!instance_active()) | 2436 if (!instance_active()) |
| 2429 return E_FAIL; | 2437 return E_FAIL; |
| 2430 | 2438 |
| 2431 if (!text) | 2439 if (!text) |
| 2432 return E_INVALIDARG; | 2440 return E_INVALIDARG; |
| 2433 | 2441 |
| 2434 const base::string16& text_str = GetText(); | 2442 const base::string16& text_str = GetText(); |
| 2435 HandleSpecialTextOffset(&start_offset); | 2443 HandleSpecialTextOffset(&start_offset); |
| 2436 HandleSpecialTextOffset(&end_offset); | 2444 HandleSpecialTextOffset(&end_offset); |
| 2437 | 2445 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2461 return S_OK; | 2469 return S_OK; |
| 2462 } | 2470 } |
| 2463 | 2471 |
| 2464 STDMETHODIMP BrowserAccessibilityWin::get_textAtOffset( | 2472 STDMETHODIMP BrowserAccessibilityWin::get_textAtOffset( |
| 2465 LONG offset, | 2473 LONG offset, |
| 2466 IA2TextBoundaryType boundary_type, | 2474 IA2TextBoundaryType boundary_type, |
| 2467 LONG* start_offset, | 2475 LONG* start_offset, |
| 2468 LONG* end_offset, | 2476 LONG* end_offset, |
| 2469 BSTR* text) { | 2477 BSTR* text) { |
| 2470 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_AT_OFFSET); | 2478 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_AT_OFFSET); |
| 2471 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 2479 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 2472 AccessibilityMode::kInlineTextBoxes); | 2480 AccessibilityMode::kInlineTextBoxes); |
| 2473 if (!instance_active()) | 2481 if (!instance_active()) |
| 2474 return E_FAIL; | 2482 return E_FAIL; |
| 2475 | 2483 |
| 2476 if (!start_offset || !end_offset || !text) | 2484 if (!start_offset || !end_offset || !text) |
| 2477 return E_INVALIDARG; | 2485 return E_INVALIDARG; |
| 2478 | 2486 |
| 2479 const base::string16& text_str = GetText(); | 2487 const base::string16& text_str = GetText(); |
| 2480 HandleSpecialTextOffset(&offset); | 2488 HandleSpecialTextOffset(&offset); |
| 2481 if (offset < 0) | 2489 if (offset < 0) |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2514 return get_text(*start_offset, *end_offset, text); | 2522 return get_text(*start_offset, *end_offset, text); |
| 2515 } | 2523 } |
| 2516 | 2524 |
| 2517 STDMETHODIMP BrowserAccessibilityWin::get_textBeforeOffset( | 2525 STDMETHODIMP BrowserAccessibilityWin::get_textBeforeOffset( |
| 2518 LONG offset, | 2526 LONG offset, |
| 2519 IA2TextBoundaryType boundary_type, | 2527 IA2TextBoundaryType boundary_type, |
| 2520 LONG* start_offset, | 2528 LONG* start_offset, |
| 2521 LONG* end_offset, | 2529 LONG* end_offset, |
| 2522 BSTR* text) { | 2530 BSTR* text) { |
| 2523 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_BEFORE_OFFSET); | 2531 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_BEFORE_OFFSET); |
| 2524 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 2532 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 2525 AccessibilityMode::kInlineTextBoxes); | 2533 AccessibilityMode::kInlineTextBoxes); |
| 2526 if (!instance_active()) | 2534 if (!instance_active()) |
| 2527 return E_FAIL; | 2535 return E_FAIL; |
| 2528 | 2536 |
| 2529 if (!start_offset || !end_offset || !text) | 2537 if (!start_offset || !end_offset || !text) |
| 2530 return E_INVALIDARG; | 2538 return E_INVALIDARG; |
| 2531 | 2539 |
| 2532 // The IAccessible2 spec says we don't have to implement the "sentence" | 2540 // The IAccessible2 spec says we don't have to implement the "sentence" |
| 2533 // boundary type, we can just let the screenreader handle it. | 2541 // boundary type, we can just let the screenreader handle it. |
| 2534 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { | 2542 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2546 return get_text(*start_offset, *end_offset, text); | 2554 return get_text(*start_offset, *end_offset, text); |
| 2547 } | 2555 } |
| 2548 | 2556 |
| 2549 STDMETHODIMP BrowserAccessibilityWin::get_textAfterOffset( | 2557 STDMETHODIMP BrowserAccessibilityWin::get_textAfterOffset( |
| 2550 LONG offset, | 2558 LONG offset, |
| 2551 IA2TextBoundaryType boundary_type, | 2559 IA2TextBoundaryType boundary_type, |
| 2552 LONG* start_offset, | 2560 LONG* start_offset, |
| 2553 LONG* end_offset, | 2561 LONG* end_offset, |
| 2554 BSTR* text) { | 2562 BSTR* text) { |
| 2555 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_AFTER_OFFSET); | 2563 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TEXT_AFTER_OFFSET); |
| 2556 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 2564 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 2557 AccessibilityMode::kInlineTextBoxes); | 2565 AccessibilityMode::kInlineTextBoxes); |
| 2558 if (!instance_active()) | 2566 if (!instance_active()) |
| 2559 return E_FAIL; | 2567 return E_FAIL; |
| 2560 | 2568 |
| 2561 if (!start_offset || !end_offset || !text) | 2569 if (!start_offset || !end_offset || !text) |
| 2562 return E_INVALIDARG; | 2570 return E_INVALIDARG; |
| 2563 | 2571 |
| 2564 // The IAccessible2 spec says we don't have to implement the "sentence" | 2572 // The IAccessible2 spec says we don't have to implement the "sentence" |
| 2565 // boundary type, we can just let the screenreader handle it. | 2573 // boundary type, we can just let the screenreader handle it. |
| 2566 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { | 2574 if (boundary_type == IA2_TEXT_BOUNDARY_SENTENCE) { |
| 2567 *start_offset = 0; | 2575 *start_offset = 0; |
| 2568 *end_offset = 0; | 2576 *end_offset = 0; |
| 2569 *text = NULL; | 2577 *text = NULL; |
| 2570 return S_FALSE; | 2578 return S_FALSE; |
| 2571 } | 2579 } |
| 2572 | 2580 |
| 2573 const base::string16& text_str = GetText(); | 2581 const base::string16& text_str = GetText(); |
| 2574 | 2582 |
| 2575 *start_offset = offset; | 2583 *start_offset = offset; |
| 2576 *end_offset = FindBoundary( | 2584 *end_offset = FindBoundary( |
| 2577 text_str, boundary_type, offset, ui::FORWARDS_DIRECTION); | 2585 text_str, boundary_type, offset, ui::FORWARDS_DIRECTION); |
| 2578 return get_text(*start_offset, *end_offset, text); | 2586 return get_text(*start_offset, *end_offset, text); |
| 2579 } | 2587 } |
| 2580 | 2588 |
| 2581 STDMETHODIMP BrowserAccessibilityWin::get_newText(IA2TextSegment* new_text) { | 2589 STDMETHODIMP BrowserAccessibilityWin::get_newText(IA2TextSegment* new_text) { |
| 2582 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_NEW_TEXT); | 2590 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_NEW_TEXT); |
| 2583 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2591 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2584 if (!instance_active()) | 2592 if (!instance_active()) |
| 2585 return E_FAIL; | 2593 return E_FAIL; |
| 2586 | 2594 |
| 2587 if (!new_text) | 2595 if (!new_text) |
| 2588 return E_INVALIDARG; | 2596 return E_INVALIDARG; |
| 2589 | 2597 |
| 2590 if (!old_win_attributes_) | 2598 if (!old_win_attributes_) |
| 2591 return E_FAIL; | 2599 return E_FAIL; |
| 2592 | 2600 |
| 2593 int start, old_len, new_len; | 2601 int start, old_len, new_len; |
| 2594 ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); | 2602 ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); |
| 2595 if (new_len == 0) | 2603 if (new_len == 0) |
| 2596 return E_FAIL; | 2604 return E_FAIL; |
| 2597 | 2605 |
| 2598 base::string16 substr = GetText().substr(start, new_len); | 2606 base::string16 substr = GetText().substr(start, new_len); |
| 2599 new_text->text = SysAllocString(substr.c_str()); | 2607 new_text->text = SysAllocString(substr.c_str()); |
| 2600 new_text->start = static_cast<long>(start); | 2608 new_text->start = static_cast<long>(start); |
| 2601 new_text->end = static_cast<long>(start + new_len); | 2609 new_text->end = static_cast<long>(start + new_len); |
| 2602 return S_OK; | 2610 return S_OK; |
| 2603 } | 2611 } |
| 2604 | 2612 |
| 2605 STDMETHODIMP BrowserAccessibilityWin::get_oldText(IA2TextSegment* old_text) { | 2613 STDMETHODIMP BrowserAccessibilityWin::get_oldText(IA2TextSegment* old_text) { |
| 2606 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_OLD_TEXT); | 2614 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_OLD_TEXT); |
| 2607 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2615 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2608 if (!instance_active()) | 2616 if (!instance_active()) |
| 2609 return E_FAIL; | 2617 return E_FAIL; |
| 2610 | 2618 |
| 2611 if (!old_text) | 2619 if (!old_text) |
| 2612 return E_INVALIDARG; | 2620 return E_INVALIDARG; |
| 2613 | 2621 |
| 2614 if (!old_win_attributes_) | 2622 if (!old_win_attributes_) |
| 2615 return E_FAIL; | 2623 return E_FAIL; |
| 2616 | 2624 |
| 2617 int start, old_len, new_len; | 2625 int start, old_len, new_len; |
| 2618 ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); | 2626 ComputeHypertextRemovedAndInserted(&start, &old_len, &new_len); |
| 2619 if (old_len == 0) | 2627 if (old_len == 0) |
| 2620 return E_FAIL; | 2628 return E_FAIL; |
| 2621 | 2629 |
| 2622 base::string16 old_hypertext = old_win_attributes_->hypertext; | 2630 base::string16 old_hypertext = old_win_attributes_->hypertext; |
| 2623 base::string16 substr = old_hypertext.substr(start, old_len); | 2631 base::string16 substr = old_hypertext.substr(start, old_len); |
| 2624 old_text->text = SysAllocString(substr.c_str()); | 2632 old_text->text = SysAllocString(substr.c_str()); |
| 2625 old_text->start = static_cast<long>(start); | 2633 old_text->start = static_cast<long>(start); |
| 2626 old_text->end = static_cast<long>(start + old_len); | 2634 old_text->end = static_cast<long>(start + old_len); |
| 2627 return S_OK; | 2635 return S_OK; |
| 2628 } | 2636 } |
| 2629 | 2637 |
| 2630 STDMETHODIMP BrowserAccessibilityWin::get_offsetAtPoint( | 2638 STDMETHODIMP BrowserAccessibilityWin::get_offsetAtPoint( |
| 2631 LONG x, | 2639 LONG x, |
| 2632 LONG y, | 2640 LONG y, |
| 2633 IA2CoordinateType coord_type, | 2641 IA2CoordinateType coord_type, |
| 2634 LONG* offset) { | 2642 LONG* offset) { |
| 2635 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_OFFSET_AT_POINT); | 2643 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_OFFSET_AT_POINT); |
| 2636 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 2644 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 2637 AccessibilityMode::kInlineTextBoxes); | 2645 AccessibilityMode::kInlineTextBoxes); |
| 2638 if (!instance_active()) | 2646 if (!instance_active()) |
| 2639 return E_FAIL; | 2647 return E_FAIL; |
| 2640 | 2648 |
| 2641 if (!offset) | 2649 if (!offset) |
| 2642 return E_INVALIDARG; | 2650 return E_INVALIDARG; |
| 2643 | 2651 |
| 2644 // TODO(dmazzoni): implement this. We're returning S_OK for now so that | 2652 // TODO(dmazzoni): implement this. We're returning S_OK for now so that |
| 2645 // screen readers still return partially accurate results rather than | 2653 // screen readers still return partially accurate results rather than |
| 2646 // completely failing. | 2654 // completely failing. |
| 2647 *offset = 0; | 2655 *offset = 0; |
| 2648 return S_OK; | 2656 return S_OK; |
| 2649 } | 2657 } |
| 2650 | 2658 |
| 2651 STDMETHODIMP BrowserAccessibilityWin::scrollSubstringTo( | 2659 STDMETHODIMP BrowserAccessibilityWin::scrollSubstringTo( |
| 2652 LONG start_index, | 2660 LONG start_index, |
| 2653 LONG end_index, | 2661 LONG end_index, |
| 2654 IA2ScrollType scroll_type) { | 2662 IA2ScrollType scroll_type) { |
| 2655 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_SUBSTRING_TO); | 2663 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_SUBSTRING_TO); |
| 2656 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 2664 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 2657 AccessibilityMode::kInlineTextBoxes); | 2665 AccessibilityMode::kInlineTextBoxes); |
| 2658 // TODO(dmazzoni): adjust this for the start and end index, too. | 2666 // TODO(dmazzoni): adjust this for the start and end index, too. |
| 2659 return scrollTo(scroll_type); | 2667 return scrollTo(scroll_type); |
| 2660 } | 2668 } |
| 2661 | 2669 |
| 2662 STDMETHODIMP BrowserAccessibilityWin::scrollSubstringToPoint( | 2670 STDMETHODIMP BrowserAccessibilityWin::scrollSubstringToPoint( |
| 2663 LONG start_index, | 2671 LONG start_index, |
| 2664 LONG end_index, | 2672 LONG end_index, |
| 2665 IA2CoordinateType coordinate_type, | 2673 IA2CoordinateType coordinate_type, |
| 2666 LONG x, | 2674 LONG x, |
| 2667 LONG y) { | 2675 LONG y) { |
| 2668 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_SUBSTRING_TO_POINT); | 2676 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_SUBSTRING_TO_POINT); |
| 2669 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 2677 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 2670 AccessibilityMode::kInlineTextBoxes); | 2678 AccessibilityMode::kInlineTextBoxes); |
| 2671 if (start_index > end_index) | 2679 if (start_index > end_index) |
| 2672 std::swap(start_index, end_index); | 2680 std::swap(start_index, end_index); |
| 2673 LONG length = end_index - start_index + 1; | 2681 LONG length = end_index - start_index + 1; |
| 2674 DCHECK_GE(length, 0); | 2682 DCHECK_GE(length, 0); |
| 2675 | 2683 |
| 2676 gfx::Rect string_bounds = GetPageBoundsForRange(start_index, length); | 2684 gfx::Rect string_bounds = GetPageBoundsForRange(start_index, length); |
| 2677 string_bounds -= GetPageBoundsRect().OffsetFromOrigin(); | 2685 string_bounds -= GetPageBoundsRect().OffsetFromOrigin(); |
| 2678 x -= string_bounds.x(); | 2686 x -= string_bounds.x(); |
| 2679 y -= string_bounds.y(); | 2687 y -= string_bounds.y(); |
| 2680 | 2688 |
| 2681 return scrollToPoint(coordinate_type, x, y); | 2689 return scrollToPoint(coordinate_type, x, y); |
| 2682 } | 2690 } |
| 2683 | 2691 |
| 2684 STDMETHODIMP BrowserAccessibilityWin::addSelection(LONG start_offset, | 2692 STDMETHODIMP BrowserAccessibilityWin::addSelection(LONG start_offset, |
| 2685 LONG end_offset) { | 2693 LONG end_offset) { |
| 2686 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ADD_SELECTION); | 2694 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ADD_SELECTION); |
| 2687 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2695 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2688 if (!instance_active()) | 2696 if (!instance_active()) |
| 2689 return E_FAIL; | 2697 return E_FAIL; |
| 2690 | 2698 |
| 2691 // We only support one selection. | 2699 // We only support one selection. |
| 2692 SetIA2HypertextSelection(start_offset, end_offset); | 2700 SetIA2HypertextSelection(start_offset, end_offset); |
| 2693 return S_OK; | 2701 return S_OK; |
| 2694 } | 2702 } |
| 2695 | 2703 |
| 2696 STDMETHODIMP BrowserAccessibilityWin::removeSelection(LONG selection_index) { | 2704 STDMETHODIMP BrowserAccessibilityWin::removeSelection(LONG selection_index) { |
| 2697 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_REMOVE_SELECTION); | 2705 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_REMOVE_SELECTION); |
| 2698 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2706 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2699 if (!instance_active()) | 2707 if (!instance_active()) |
| 2700 return E_FAIL; | 2708 return E_FAIL; |
| 2701 | 2709 |
| 2702 if (selection_index != 0) | 2710 if (selection_index != 0) |
| 2703 return E_INVALIDARG; | 2711 return E_INVALIDARG; |
| 2704 | 2712 |
| 2705 // Simply collapse the selection to the position of the caret if a caret is | 2713 // Simply collapse the selection to the position of the caret if a caret is |
| 2706 // visible, otherwise set the selection to 0. | 2714 // visible, otherwise set the selection to 0. |
| 2707 LONG caret_offset = 0; | 2715 LONG caret_offset = 0; |
| 2708 int selection_start, selection_end; | 2716 int selection_start, selection_end; |
| 2709 GetSelectionOffsets(&selection_start, &selection_end); | 2717 GetSelectionOffsets(&selection_start, &selection_end); |
| 2710 if (HasCaret() && selection_end >= 0) | 2718 if (HasCaret() && selection_end >= 0) |
| 2711 caret_offset = selection_end; | 2719 caret_offset = selection_end; |
| 2712 SetIA2HypertextSelection(caret_offset, caret_offset); | 2720 SetIA2HypertextSelection(caret_offset, caret_offset); |
| 2713 return S_OK; | 2721 return S_OK; |
| 2714 } | 2722 } |
| 2715 | 2723 |
| 2716 STDMETHODIMP BrowserAccessibilityWin::setCaretOffset(LONG offset) { | 2724 STDMETHODIMP BrowserAccessibilityWin::setCaretOffset(LONG offset) { |
| 2717 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_CARET_OFFSET); | 2725 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_CARET_OFFSET); |
| 2718 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2726 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2719 if (!instance_active()) | 2727 if (!instance_active()) |
| 2720 return E_FAIL; | 2728 return E_FAIL; |
| 2721 SetIA2HypertextSelection(offset, offset); | 2729 SetIA2HypertextSelection(offset, offset); |
| 2722 return S_OK; | 2730 return S_OK; |
| 2723 } | 2731 } |
| 2724 | 2732 |
| 2725 STDMETHODIMP BrowserAccessibilityWin::setSelection(LONG selection_index, | 2733 STDMETHODIMP BrowserAccessibilityWin::setSelection(LONG selection_index, |
| 2726 LONG start_offset, | 2734 LONG start_offset, |
| 2727 LONG end_offset) { | 2735 LONG end_offset) { |
| 2728 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_SELECTION); | 2736 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_SELECTION); |
| 2729 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2737 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2730 if (!instance_active()) | 2738 if (!instance_active()) |
| 2731 return E_FAIL; | 2739 return E_FAIL; |
| 2732 if (selection_index != 0) | 2740 if (selection_index != 0) |
| 2733 return E_INVALIDARG; | 2741 return E_INVALIDARG; |
| 2734 SetIA2HypertextSelection(start_offset, end_offset); | 2742 SetIA2HypertextSelection(start_offset, end_offset); |
| 2735 return S_OK; | 2743 return S_OK; |
| 2736 } | 2744 } |
| 2737 | 2745 |
| 2738 STDMETHODIMP BrowserAccessibilityWin::get_attributes(LONG offset, | 2746 STDMETHODIMP BrowserAccessibilityWin::get_attributes(LONG offset, |
| 2739 LONG* start_offset, | 2747 LONG* start_offset, |
| 2740 LONG* end_offset, | 2748 LONG* end_offset, |
| 2741 BSTR* text_attributes) { | 2749 BSTR* text_attributes) { |
| 2742 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IATEXT_GET_ATTRIBUTES); | 2750 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IATEXT_GET_ATTRIBUTES); |
| 2743 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2751 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2744 if (!start_offset || !end_offset || !text_attributes) | 2752 if (!start_offset || !end_offset || !text_attributes) |
| 2745 return E_INVALIDARG; | 2753 return E_INVALIDARG; |
| 2746 | 2754 |
| 2747 *start_offset = *end_offset = 0; | 2755 *start_offset = *end_offset = 0; |
| 2748 *text_attributes = nullptr; | 2756 *text_attributes = nullptr; |
| 2749 if (!instance_active()) | 2757 if (!instance_active()) |
| 2750 return E_FAIL; | 2758 return E_FAIL; |
| 2751 | 2759 |
| 2752 const base::string16 text = GetText(); | 2760 const base::string16 text = GetText(); |
| 2753 HandleSpecialTextOffset(&offset); | 2761 HandleSpecialTextOffset(&offset); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2772 DCHECK(*text_attributes); | 2780 DCHECK(*text_attributes); |
| 2773 return S_OK; | 2781 return S_OK; |
| 2774 } | 2782 } |
| 2775 | 2783 |
| 2776 // | 2784 // |
| 2777 // IAccessibleHypertext methods. | 2785 // IAccessibleHypertext methods. |
| 2778 // | 2786 // |
| 2779 | 2787 |
| 2780 STDMETHODIMP BrowserAccessibilityWin::get_nHyperlinks(long* hyperlink_count) { | 2788 STDMETHODIMP BrowserAccessibilityWin::get_nHyperlinks(long* hyperlink_count) { |
| 2781 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_HYPERLINKS); | 2789 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_HYPERLINKS); |
| 2782 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2790 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2783 if (!instance_active()) | 2791 if (!instance_active()) |
| 2784 return E_FAIL; | 2792 return E_FAIL; |
| 2785 | 2793 |
| 2786 if (!hyperlink_count) | 2794 if (!hyperlink_count) |
| 2787 return E_INVALIDARG; | 2795 return E_INVALIDARG; |
| 2788 | 2796 |
| 2789 *hyperlink_count = hyperlink_offset_to_index().size(); | 2797 *hyperlink_count = hyperlink_offset_to_index().size(); |
| 2790 return S_OK; | 2798 return S_OK; |
| 2791 } | 2799 } |
| 2792 | 2800 |
| 2793 STDMETHODIMP BrowserAccessibilityWin::get_hyperlink( | 2801 STDMETHODIMP BrowserAccessibilityWin::get_hyperlink( |
| 2794 long index, | 2802 long index, |
| 2795 IAccessibleHyperlink** hyperlink) { | 2803 IAccessibleHyperlink** hyperlink) { |
| 2796 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_HYPERLINK); | 2804 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_HYPERLINK); |
| 2797 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2805 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2798 if (!instance_active()) | 2806 if (!instance_active()) |
| 2799 return E_FAIL; | 2807 return E_FAIL; |
| 2800 | 2808 |
| 2801 if (!hyperlink || | 2809 if (!hyperlink || |
| 2802 index < 0 || | 2810 index < 0 || |
| 2803 index >= static_cast<long>(hyperlinks().size())) { | 2811 index >= static_cast<long>(hyperlinks().size())) { |
| 2804 return E_INVALIDARG; | 2812 return E_INVALIDARG; |
| 2805 } | 2813 } |
| 2806 | 2814 |
| 2807 int32_t id = hyperlinks()[index]; | 2815 int32_t id = hyperlinks()[index]; |
| 2808 BrowserAccessibilityWin* link = | 2816 BrowserAccessibilityWin* link = |
| 2809 ToBrowserAccessibilityWin(GetFromUniqueID(id)); | 2817 ToBrowserAccessibilityWin(GetFromUniqueID(id)); |
| 2810 if (!link) | 2818 if (!link) |
| 2811 return E_FAIL; | 2819 return E_FAIL; |
| 2812 | 2820 |
| 2813 *hyperlink = static_cast<IAccessibleHyperlink*>(link->NewReference()); | 2821 *hyperlink = static_cast<IAccessibleHyperlink*>(link->NewReference()); |
| 2814 return S_OK; | 2822 return S_OK; |
| 2815 } | 2823 } |
| 2816 | 2824 |
| 2817 STDMETHODIMP BrowserAccessibilityWin::get_hyperlinkIndex( | 2825 STDMETHODIMP BrowserAccessibilityWin::get_hyperlinkIndex( |
| 2818 long char_index, | 2826 long char_index, |
| 2819 long* hyperlink_index) { | 2827 long* hyperlink_index) { |
| 2820 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_HYPERLINK_INDEX); | 2828 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_HYPERLINK_INDEX); |
| 2821 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2829 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2822 if (!instance_active()) | 2830 if (!instance_active()) |
| 2823 return E_FAIL; | 2831 return E_FAIL; |
| 2824 | 2832 |
| 2825 if (!hyperlink_index) | 2833 if (!hyperlink_index) |
| 2826 return E_INVALIDARG; | 2834 return E_INVALIDARG; |
| 2827 | 2835 |
| 2828 if (char_index < 0 || char_index >= static_cast<long>(GetText().size())) { | 2836 if (char_index < 0 || char_index >= static_cast<long>(GetText().size())) { |
| 2829 return E_INVALIDARG; | 2837 return E_INVALIDARG; |
| 2830 } | 2838 } |
| 2831 | 2839 |
| 2832 std::map<int32_t, int32_t>::iterator it = | 2840 std::map<int32_t, int32_t>::iterator it = |
| 2833 hyperlink_offset_to_index().find(char_index); | 2841 hyperlink_offset_to_index().find(char_index); |
| 2834 if (it == hyperlink_offset_to_index().end()) { | 2842 if (it == hyperlink_offset_to_index().end()) { |
| 2835 *hyperlink_index = -1; | 2843 *hyperlink_index = -1; |
| 2836 return S_FALSE; | 2844 return S_FALSE; |
| 2837 } | 2845 } |
| 2838 | 2846 |
| 2839 *hyperlink_index = it->second; | 2847 *hyperlink_index = it->second; |
| 2840 return S_OK; | 2848 return S_OK; |
| 2841 } | 2849 } |
| 2842 | 2850 |
| 2843 // | 2851 // |
| 2844 // IAccessibleHyperlink methods. | 2852 // IAccessibleHyperlink methods. |
| 2845 // | 2853 // |
| 2846 | 2854 |
| 2847 // Currently, only text links are supported. | 2855 // Currently, only text links are supported. |
| 2848 STDMETHODIMP BrowserAccessibilityWin::get_anchor(long index, VARIANT* anchor) { | 2856 STDMETHODIMP BrowserAccessibilityWin::get_anchor(long index, VARIANT* anchor) { |
| 2849 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ANCHOR); | 2857 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ANCHOR); |
| 2850 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2858 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2851 if (!instance_active() || !IsHyperlink()) | 2859 if (!instance_active() || !IsHyperlink()) |
| 2852 return E_FAIL; | 2860 return E_FAIL; |
| 2853 | 2861 |
| 2854 // IA2 text links can have only one anchor, that is the text inside them. | 2862 // IA2 text links can have only one anchor, that is the text inside them. |
| 2855 if (index != 0 || !anchor) | 2863 if (index != 0 || !anchor) |
| 2856 return E_INVALIDARG; | 2864 return E_INVALIDARG; |
| 2857 | 2865 |
| 2858 BSTR ia2_hypertext = SysAllocString(GetText().c_str()); | 2866 BSTR ia2_hypertext = SysAllocString(GetText().c_str()); |
| 2859 DCHECK(ia2_hypertext); | 2867 DCHECK(ia2_hypertext); |
| 2860 anchor->vt = VT_BSTR; | 2868 anchor->vt = VT_BSTR; |
| 2861 anchor->bstrVal = ia2_hypertext; | 2869 anchor->bstrVal = ia2_hypertext; |
| 2862 | 2870 |
| 2863 // Returning S_FALSE is not mentioned in the IA2 Spec, but it might have been | 2871 // Returning S_FALSE is not mentioned in the IA2 Spec, but it might have been |
| 2864 // an oversight. | 2872 // an oversight. |
| 2865 if (!SysStringLen(ia2_hypertext)) | 2873 if (!SysStringLen(ia2_hypertext)) |
| 2866 return S_FALSE; | 2874 return S_FALSE; |
| 2867 | 2875 |
| 2868 return S_OK; | 2876 return S_OK; |
| 2869 } | 2877 } |
| 2870 | 2878 |
| 2871 // Currently, only text links are supported. | 2879 // Currently, only text links are supported. |
| 2872 STDMETHODIMP BrowserAccessibilityWin::get_anchorTarget(long index, | 2880 STDMETHODIMP BrowserAccessibilityWin::get_anchorTarget(long index, |
| 2873 VARIANT* anchor_target) { | 2881 VARIANT* anchor_target) { |
| 2874 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ANCHOR_TARGET); | 2882 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ANCHOR_TARGET); |
| 2875 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2883 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2876 if (!instance_active() || !IsHyperlink()) | 2884 if (!instance_active() || !IsHyperlink()) |
| 2877 return E_FAIL; | 2885 return E_FAIL; |
| 2878 | 2886 |
| 2879 // IA2 text links can have at most one target, that is when they represent an | 2887 // IA2 text links can have at most one target, that is when they represent an |
| 2880 // HTML hyperlink, i.e. an <a> element with a "href" attribute. | 2888 // HTML hyperlink, i.e. an <a> element with a "href" attribute. |
| 2881 if (index != 0 || !anchor_target) | 2889 if (index != 0 || !anchor_target) |
| 2882 return E_INVALIDARG; | 2890 return E_INVALIDARG; |
| 2883 | 2891 |
| 2884 BSTR target; | 2892 BSTR target; |
| 2885 if (!(ia_state() & STATE_SYSTEM_LINKED) || | 2893 if (!(ia_state() & STATE_SYSTEM_LINKED) || |
| 2886 FAILED(GetStringAttributeAsBstr(ui::AX_ATTR_URL, &target))) { | 2894 FAILED(GetStringAttributeAsBstr(ui::AX_ATTR_URL, &target))) { |
| 2887 target = SysAllocString(L""); | 2895 target = SysAllocString(L""); |
| 2888 } | 2896 } |
| 2889 DCHECK(target); | 2897 DCHECK(target); |
| 2890 anchor_target->vt = VT_BSTR; | 2898 anchor_target->vt = VT_BSTR; |
| 2891 anchor_target->bstrVal = target; | 2899 anchor_target->bstrVal = target; |
| 2892 | 2900 |
| 2893 // Returning S_FALSE is not mentioned in the IA2 Spec, but it might have been | 2901 // Returning S_FALSE is not mentioned in the IA2 Spec, but it might have been |
| 2894 // an oversight. | 2902 // an oversight. |
| 2895 if (!SysStringLen(target)) | 2903 if (!SysStringLen(target)) |
| 2896 return S_FALSE; | 2904 return S_FALSE; |
| 2897 | 2905 |
| 2898 return S_OK; | 2906 return S_OK; |
| 2899 } | 2907 } |
| 2900 | 2908 |
| 2901 STDMETHODIMP BrowserAccessibilityWin::get_startIndex(long* index) { | 2909 STDMETHODIMP BrowserAccessibilityWin::get_startIndex(long* index) { |
| 2902 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_START_INDEX); | 2910 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_START_INDEX); |
| 2903 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2911 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2904 if (!instance_active() || !IsHyperlink()) | 2912 if (!instance_active() || !IsHyperlink()) |
| 2905 return E_FAIL; | 2913 return E_FAIL; |
| 2906 | 2914 |
| 2907 if (!index) | 2915 if (!index) |
| 2908 return E_INVALIDARG; | 2916 return E_INVALIDARG; |
| 2909 | 2917 |
| 2910 int32_t hypertext_offset = 0; | 2918 int32_t hypertext_offset = 0; |
| 2911 auto* parent = GetParent(); | 2919 auto* parent = GetParent(); |
| 2912 if (parent) { | 2920 if (parent) { |
| 2913 hypertext_offset = | 2921 hypertext_offset = |
| 2914 ToBrowserAccessibilityWin(parent)->GetHypertextOffsetFromChild(*this); | 2922 ToBrowserAccessibilityWin(parent)->GetHypertextOffsetFromChild(*this); |
| 2915 } | 2923 } |
| 2916 *index = static_cast<LONG>(hypertext_offset); | 2924 *index = static_cast<LONG>(hypertext_offset); |
| 2917 return S_OK; | 2925 return S_OK; |
| 2918 } | 2926 } |
| 2919 | 2927 |
| 2920 STDMETHODIMP BrowserAccessibilityWin::get_endIndex(long* index) { | 2928 STDMETHODIMP BrowserAccessibilityWin::get_endIndex(long* index) { |
| 2921 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_END_INDEX); | 2929 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_END_INDEX); |
| 2922 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2930 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2923 LONG start_index; | 2931 LONG start_index; |
| 2924 HRESULT hr = get_startIndex(&start_index); | 2932 HRESULT hr = get_startIndex(&start_index); |
| 2925 if (hr == S_OK) | 2933 if (hr == S_OK) |
| 2926 *index = start_index + 1; | 2934 *index = start_index + 1; |
| 2927 return hr; | 2935 return hr; |
| 2928 } | 2936 } |
| 2929 | 2937 |
| 2930 // This method is deprecated in the IA2 Spec. | 2938 // This method is deprecated in the IA2 Spec. |
| 2931 STDMETHODIMP BrowserAccessibilityWin::get_valid(boolean* valid) { | 2939 STDMETHODIMP BrowserAccessibilityWin::get_valid(boolean* valid) { |
| 2932 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_VALID); | 2940 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_VALID); |
| 2933 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2941 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2934 return E_NOTIMPL; | 2942 return E_NOTIMPL; |
| 2935 } | 2943 } |
| 2936 | 2944 |
| 2937 // | 2945 // |
| 2938 // IAccessibleAction partly implemented. | 2946 // IAccessibleAction partly implemented. |
| 2939 // | 2947 // |
| 2940 | 2948 |
| 2941 STDMETHODIMP BrowserAccessibilityWin::nActions(long* n_actions) { | 2949 STDMETHODIMP BrowserAccessibilityWin::nActions(long* n_actions) { |
| 2942 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_N_ACTIONS); | 2950 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_N_ACTIONS); |
| 2943 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2951 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2944 if (!instance_active()) | 2952 if (!instance_active()) |
| 2945 return E_FAIL; | 2953 return E_FAIL; |
| 2946 | 2954 |
| 2947 if (!n_actions) | 2955 if (!n_actions) |
| 2948 return E_INVALIDARG; | 2956 return E_INVALIDARG; |
| 2949 | 2957 |
| 2950 // |IsHyperlink| is required for |IAccessibleHyperlink::anchor/anchorTarget| | 2958 // |IsHyperlink| is required for |IAccessibleHyperlink::anchor/anchorTarget| |
| 2951 // to work properly because the |IAccessibleHyperlink| interface inherits from | 2959 // to work properly because the |IAccessibleHyperlink| interface inherits from |
| 2952 // |IAccessibleAction|. | 2960 // |IAccessibleAction|. |
| 2953 if (IsHyperlink() || HasIntAttribute(ui::AX_ATTR_ACTION)) { | 2961 if (IsHyperlink() || HasIntAttribute(ui::AX_ATTR_ACTION)) { |
| 2954 *n_actions = 1; | 2962 *n_actions = 1; |
| 2955 } else { | 2963 } else { |
| 2956 *n_actions = 0; | 2964 *n_actions = 0; |
| 2957 } | 2965 } |
| 2958 | 2966 |
| 2959 return S_OK; | 2967 return S_OK; |
| 2960 } | 2968 } |
| 2961 | 2969 |
| 2962 STDMETHODIMP BrowserAccessibilityWin::doAction(long action_index) { | 2970 STDMETHODIMP BrowserAccessibilityWin::doAction(long action_index) { |
| 2963 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_DO_ACTION); | 2971 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_DO_ACTION); |
| 2964 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2972 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2965 if (!instance_active()) | 2973 if (!instance_active()) |
| 2966 return E_FAIL; | 2974 return E_FAIL; |
| 2967 | 2975 |
| 2968 if (!HasIntAttribute(ui::AX_ATTR_ACTION) || action_index != 0) | 2976 if (!HasIntAttribute(ui::AX_ATTR_ACTION) || action_index != 0) |
| 2969 return E_INVALIDARG; | 2977 return E_INVALIDARG; |
| 2970 | 2978 |
| 2971 manager_->DoDefaultAction(*this); | 2979 manager_->DoDefaultAction(*this); |
| 2972 return S_OK; | 2980 return S_OK; |
| 2973 } | 2981 } |
| 2974 | 2982 |
| 2975 STDMETHODIMP | 2983 STDMETHODIMP |
| 2976 BrowserAccessibilityWin::get_description(long action_index, BSTR* description) { | 2984 BrowserAccessibilityWin::get_description(long action_index, BSTR* description) { |
| 2977 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IAACTION_GET_DESCRIPTION); | 2985 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_IAACTION_GET_DESCRIPTION); |
| 2978 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2986 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2979 return E_NOTIMPL; | 2987 return E_NOTIMPL; |
| 2980 } | 2988 } |
| 2981 | 2989 |
| 2982 STDMETHODIMP BrowserAccessibilityWin::get_keyBinding(long action_index, | 2990 STDMETHODIMP BrowserAccessibilityWin::get_keyBinding(long action_index, |
| 2983 long n_max_bindings, | 2991 long n_max_bindings, |
| 2984 BSTR** key_bindings, | 2992 BSTR** key_bindings, |
| 2985 long* n_bindings) { | 2993 long* n_bindings) { |
| 2986 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_KEY_BINDING); | 2994 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_KEY_BINDING); |
| 2987 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 2995 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2988 return E_NOTIMPL; | 2996 return E_NOTIMPL; |
| 2989 } | 2997 } |
| 2990 | 2998 |
| 2991 STDMETHODIMP BrowserAccessibilityWin::get_name(long action_index, BSTR* name) { | 2999 STDMETHODIMP BrowserAccessibilityWin::get_name(long action_index, BSTR* name) { |
| 2992 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_NAME); | 3000 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_NAME); |
| 2993 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 3001 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 2994 if (!instance_active()) | 3002 if (!instance_active()) |
| 2995 return E_FAIL; | 3003 return E_FAIL; |
| 2996 | 3004 |
| 2997 if (!name) | 3005 if (!name) |
| 2998 return E_INVALIDARG; | 3006 return E_INVALIDARG; |
| 2999 | 3007 |
| 3000 int action; | 3008 int action; |
| 3001 if (!GetIntAttribute(ui::AX_ATTR_ACTION, &action) || action_index != 0) { | 3009 if (!GetIntAttribute(ui::AX_ATTR_ACTION, &action) || action_index != 0) { |
| 3002 *name = nullptr; | 3010 *name = nullptr; |
| 3003 return E_INVALIDARG; | 3011 return E_INVALIDARG; |
| 3004 } | 3012 } |
| 3005 | 3013 |
| 3006 base::string16 action_verb = | 3014 base::string16 action_verb = |
| 3007 ui::ActionToUnlocalizedString(static_cast<ui::AXSupportedAction>(action)); | 3015 ui::ActionToUnlocalizedString(static_cast<ui::AXSupportedAction>(action)); |
| 3008 if (action_verb.empty() || action_verb == L"none") { | 3016 if (action_verb.empty() || action_verb == L"none") { |
| 3009 *name = nullptr; | 3017 *name = nullptr; |
| 3010 return S_FALSE; | 3018 return S_FALSE; |
| 3011 } | 3019 } |
| 3012 | 3020 |
| 3013 *name = SysAllocString(action_verb.c_str()); | 3021 *name = SysAllocString(action_verb.c_str()); |
| 3014 DCHECK(name); | 3022 DCHECK(name); |
| 3015 return S_OK; | 3023 return S_OK; |
| 3016 } | 3024 } |
| 3017 | 3025 |
| 3018 STDMETHODIMP | 3026 STDMETHODIMP |
| 3019 BrowserAccessibilityWin::get_localizedName(long action_index, | 3027 BrowserAccessibilityWin::get_localizedName(long action_index, |
| 3020 BSTR* localized_name) { | 3028 BSTR* localized_name) { |
| 3021 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCALIZED_NAME); | 3029 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCALIZED_NAME); |
| 3022 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 3030 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3023 if (!instance_active()) | 3031 if (!instance_active()) |
| 3024 return E_FAIL; | 3032 return E_FAIL; |
| 3025 | 3033 |
| 3026 if (!localized_name) | 3034 if (!localized_name) |
| 3027 return E_INVALIDARG; | 3035 return E_INVALIDARG; |
| 3028 | 3036 |
| 3029 int action; | 3037 int action; |
| 3030 if (!GetIntAttribute(ui::AX_ATTR_ACTION, &action) || action_index != 0) { | 3038 if (!GetIntAttribute(ui::AX_ATTR_ACTION, &action) || action_index != 0) { |
| 3031 *localized_name = nullptr; | 3039 *localized_name = nullptr; |
| 3032 return E_INVALIDARG; | 3040 return E_INVALIDARG; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3043 DCHECK(localized_name); | 3051 DCHECK(localized_name); |
| 3044 return S_OK; | 3052 return S_OK; |
| 3045 } | 3053 } |
| 3046 | 3054 |
| 3047 // | 3055 // |
| 3048 // IAccessibleValue methods. | 3056 // IAccessibleValue methods. |
| 3049 // | 3057 // |
| 3050 | 3058 |
| 3051 STDMETHODIMP BrowserAccessibilityWin::get_currentValue(VARIANT* value) { | 3059 STDMETHODIMP BrowserAccessibilityWin::get_currentValue(VARIANT* value) { |
| 3052 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CURRENT_VALUE); | 3060 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CURRENT_VALUE); |
| 3053 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 3061 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3054 if (!instance_active()) | 3062 if (!instance_active()) |
| 3055 return E_FAIL; | 3063 return E_FAIL; |
| 3056 | 3064 |
| 3057 if (!value) | 3065 if (!value) |
| 3058 return E_INVALIDARG; | 3066 return E_INVALIDARG; |
| 3059 | 3067 |
| 3060 float float_val; | 3068 float float_val; |
| 3061 if (GetFloatAttribute( | 3069 if (GetFloatAttribute( |
| 3062 ui::AX_ATTR_VALUE_FOR_RANGE, &float_val)) { | 3070 ui::AX_ATTR_VALUE_FOR_RANGE, &float_val)) { |
| 3063 value->vt = VT_R8; | 3071 value->vt = VT_R8; |
| 3064 value->dblVal = float_val; | 3072 value->dblVal = float_val; |
| 3065 return S_OK; | 3073 return S_OK; |
| 3066 } | 3074 } |
| 3067 | 3075 |
| 3068 value->vt = VT_EMPTY; | 3076 value->vt = VT_EMPTY; |
| 3069 return S_FALSE; | 3077 return S_FALSE; |
| 3070 } | 3078 } |
| 3071 | 3079 |
| 3072 STDMETHODIMP BrowserAccessibilityWin::get_minimumValue(VARIANT* value) { | 3080 STDMETHODIMP BrowserAccessibilityWin::get_minimumValue(VARIANT* value) { |
| 3073 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MINIMUM_VALUE); | 3081 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MINIMUM_VALUE); |
| 3074 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 3082 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3075 if (!instance_active()) | 3083 if (!instance_active()) |
| 3076 return E_FAIL; | 3084 return E_FAIL; |
| 3077 | 3085 |
| 3078 if (!value) | 3086 if (!value) |
| 3079 return E_INVALIDARG; | 3087 return E_INVALIDARG; |
| 3080 | 3088 |
| 3081 float float_val; | 3089 float float_val; |
| 3082 if (GetFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, | 3090 if (GetFloatAttribute(ui::AX_ATTR_MIN_VALUE_FOR_RANGE, |
| 3083 &float_val)) { | 3091 &float_val)) { |
| 3084 value->vt = VT_R8; | 3092 value->vt = VT_R8; |
| 3085 value->dblVal = float_val; | 3093 value->dblVal = float_val; |
| 3086 return S_OK; | 3094 return S_OK; |
| 3087 } | 3095 } |
| 3088 | 3096 |
| 3089 value->vt = VT_EMPTY; | 3097 value->vt = VT_EMPTY; |
| 3090 return S_FALSE; | 3098 return S_FALSE; |
| 3091 } | 3099 } |
| 3092 | 3100 |
| 3093 STDMETHODIMP BrowserAccessibilityWin::get_maximumValue(VARIANT* value) { | 3101 STDMETHODIMP BrowserAccessibilityWin::get_maximumValue(VARIANT* value) { |
| 3094 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MAXIMUM_VALUE); | 3102 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_MAXIMUM_VALUE); |
| 3095 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 3103 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3096 if (!instance_active()) | 3104 if (!instance_active()) |
| 3097 return E_FAIL; | 3105 return E_FAIL; |
| 3098 | 3106 |
| 3099 if (!value) | 3107 if (!value) |
| 3100 return E_INVALIDARG; | 3108 return E_INVALIDARG; |
| 3101 | 3109 |
| 3102 float float_val; | 3110 float float_val; |
| 3103 if (GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, | 3111 if (GetFloatAttribute(ui::AX_ATTR_MAX_VALUE_FOR_RANGE, |
| 3104 &float_val)) { | 3112 &float_val)) { |
| 3105 value->vt = VT_R8; | 3113 value->vt = VT_R8; |
| 3106 value->dblVal = float_val; | 3114 value->dblVal = float_val; |
| 3107 return S_OK; | 3115 return S_OK; |
| 3108 } | 3116 } |
| 3109 | 3117 |
| 3110 value->vt = VT_EMPTY; | 3118 value->vt = VT_EMPTY; |
| 3111 return S_FALSE; | 3119 return S_FALSE; |
| 3112 } | 3120 } |
| 3113 | 3121 |
| 3114 STDMETHODIMP BrowserAccessibilityWin::setCurrentValue(VARIANT new_value) { | 3122 STDMETHODIMP BrowserAccessibilityWin::setCurrentValue(VARIANT new_value) { |
| 3115 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_CURRENT_VALUE); | 3123 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SET_CURRENT_VALUE); |
| 3116 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 3124 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3117 // TODO(dmazzoni): Implement this. | 3125 // TODO(dmazzoni): Implement this. |
| 3118 return E_NOTIMPL; | 3126 return E_NOTIMPL; |
| 3119 } | 3127 } |
| 3120 | 3128 |
| 3121 // | 3129 // |
| 3122 // ISimpleDOMDocument methods. | 3130 // ISimpleDOMDocument methods. |
| 3123 // | 3131 // |
| 3124 | 3132 |
| 3125 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { | 3133 STDMETHODIMP BrowserAccessibilityWin::get_URL(BSTR* url) { |
| 3126 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_URL); | 3134 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_URL); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3216 // | 3224 // |
| 3217 | 3225 |
| 3218 STDMETHODIMP BrowserAccessibilityWin::get_nodeInfo( | 3226 STDMETHODIMP BrowserAccessibilityWin::get_nodeInfo( |
| 3219 BSTR* node_name, | 3227 BSTR* node_name, |
| 3220 short* name_space_id, | 3228 short* name_space_id, |
| 3221 BSTR* node_value, | 3229 BSTR* node_value, |
| 3222 unsigned int* num_children, | 3230 unsigned int* num_children, |
| 3223 unsigned int* unique_id, | 3231 unsigned int* unique_id, |
| 3224 unsigned short* node_type) { | 3232 unsigned short* node_type) { |
| 3225 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_NODE_INFO); | 3233 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_NODE_INFO); |
| 3226 AddAccessibilityModeFlags(AccessibilityMode::kHTML); | 3234 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3227 if (!instance_active()) | 3235 if (!instance_active()) |
| 3228 return E_FAIL; | 3236 return E_FAIL; |
| 3229 | 3237 |
| 3230 if (!node_name || !name_space_id || !node_value || !num_children || | 3238 if (!node_name || !name_space_id || !node_value || !num_children || |
| 3231 !unique_id || !node_type) { | 3239 !unique_id || !node_type) { |
| 3232 return E_INVALIDARG; | 3240 return E_INVALIDARG; |
| 3233 } | 3241 } |
| 3234 | 3242 |
| 3235 base::string16 tag; | 3243 base::string16 tag; |
| 3236 if (GetString16Attribute(ui::AX_ATTR_HTML_TAG, &tag)) | 3244 if (GetString16Attribute(ui::AX_ATTR_HTML_TAG, &tag)) |
| 3237 *node_name = SysAllocString(tag.c_str()); | 3245 *node_name = SysAllocString(tag.c_str()); |
| 3238 else | 3246 else |
| 3239 *node_name = NULL; | 3247 *node_name = nullptr; |
| 3240 | 3248 |
| 3241 *name_space_id = 0; | 3249 *name_space_id = 0; |
| 3242 *node_value = SysAllocString(value().c_str()); | 3250 *node_value = SysAllocString(value().c_str()); |
| 3243 *num_children = PlatformChildCount(); | 3251 *num_children = PlatformChildCount(); |
| 3244 *unique_id = -this->unique_id(); | 3252 *unique_id = -this->unique_id(); |
| 3245 | 3253 |
| 3246 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA || | 3254 if (GetRole() == ui::AX_ROLE_ROOT_WEB_AREA || |
| 3247 GetRole() == ui::AX_ROLE_WEB_AREA) { | 3255 GetRole() == ui::AX_ROLE_WEB_AREA) { |
| 3248 *node_type = NODETYPE_DOCUMENT; | 3256 *node_type = NODETYPE_DOCUMENT; |
| 3249 } else if (IsTextOnlyObject()) { | 3257 } else if (IsTextOnlyObject()) { |
| 3250 *node_type = NODETYPE_TEXT; | 3258 *node_type = NODETYPE_TEXT; |
| 3251 } else { | 3259 } else { |
| 3252 *node_type = NODETYPE_ELEMENT; | 3260 *node_type = NODETYPE_ELEMENT; |
| 3253 } | 3261 } |
| 3254 | 3262 |
| 3255 return S_OK; | 3263 return S_OK; |
| 3256 } | 3264 } |
| 3257 | 3265 |
| 3258 STDMETHODIMP BrowserAccessibilityWin::get_attributes( | 3266 STDMETHODIMP BrowserAccessibilityWin::get_attributes( |
| 3259 unsigned short max_attribs, | 3267 unsigned short max_attribs, |
| 3260 BSTR* attrib_names, | 3268 BSTR* attrib_names, |
| 3261 short* name_space_id, | 3269 short* name_space_id, |
| 3262 BSTR* attrib_values, | 3270 BSTR* attrib_values, |
| 3263 unsigned short* num_attribs) { | 3271 unsigned short* num_attribs) { |
| 3264 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ISIMPLEDOMNODE_GET_ATTRIBUTES); | 3272 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_ISIMPLEDOMNODE_GET_ATTRIBUTES); |
| 3265 AddAccessibilityModeFlags(AccessibilityMode::kHTML); | 3273 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3266 if (!instance_active()) | 3274 if (!instance_active()) |
| 3267 return E_FAIL; | 3275 return E_FAIL; |
| 3268 | 3276 |
| 3269 if (!attrib_names || !name_space_id || !attrib_values || !num_attribs) | 3277 if (!attrib_names || !name_space_id || !attrib_values || !num_attribs) |
| 3270 return E_INVALIDARG; | 3278 return E_INVALIDARG; |
| 3271 | 3279 |
| 3272 *num_attribs = max_attribs; | 3280 *num_attribs = max_attribs; |
| 3273 if (*num_attribs > GetHtmlAttributes().size()) | 3281 if (*num_attribs > GetHtmlAttributes().size()) |
| 3274 *num_attribs = GetHtmlAttributes().size(); | 3282 *num_attribs = GetHtmlAttributes().size(); |
| 3275 | 3283 |
| 3276 for (unsigned short i = 0; i < *num_attribs; ++i) { | 3284 for (unsigned short i = 0; i < *num_attribs; ++i) { |
| 3277 attrib_names[i] = SysAllocString( | 3285 attrib_names[i] = SysAllocString( |
| 3278 base::UTF8ToUTF16(GetHtmlAttributes()[i].first).c_str()); | 3286 base::UTF8ToUTF16(GetHtmlAttributes()[i].first).c_str()); |
| 3279 name_space_id[i] = 0; | 3287 name_space_id[i] = 0; |
| 3280 attrib_values[i] = SysAllocString( | 3288 attrib_values[i] = SysAllocString( |
| 3281 base::UTF8ToUTF16(GetHtmlAttributes()[i].second).c_str()); | 3289 base::UTF8ToUTF16(GetHtmlAttributes()[i].second).c_str()); |
| 3282 } | 3290 } |
| 3283 return S_OK; | 3291 return S_OK; |
| 3284 } | 3292 } |
| 3285 | 3293 |
| 3286 STDMETHODIMP BrowserAccessibilityWin::get_attributesForNames( | 3294 STDMETHODIMP BrowserAccessibilityWin::get_attributesForNames( |
| 3287 unsigned short num_attribs, | 3295 unsigned short num_attribs, |
| 3288 BSTR* attrib_names, | 3296 BSTR* attrib_names, |
| 3289 short* name_space_id, | 3297 short* name_space_id, |
| 3290 BSTR* attrib_values) { | 3298 BSTR* attrib_values) { |
| 3291 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ATTRIBUTES_FOR_NAMES); | 3299 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ATTRIBUTES_FOR_NAMES); |
| 3292 AddAccessibilityModeFlags(AccessibilityMode::kHTML); | 3300 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3293 if (!instance_active()) | 3301 if (!instance_active()) |
| 3294 return E_FAIL; | 3302 return E_FAIL; |
| 3295 | 3303 |
| 3296 if (!attrib_names || !name_space_id || !attrib_values) | 3304 if (!attrib_names || !name_space_id || !attrib_values) |
| 3297 return E_INVALIDARG; | 3305 return E_INVALIDARG; |
| 3298 | 3306 |
| 3299 for (unsigned short i = 0; i < num_attribs; ++i) { | 3307 for (unsigned short i = 0; i < num_attribs; ++i) { |
| 3300 name_space_id[i] = 0; | 3308 name_space_id[i] = 0; |
| 3301 bool found = false; | 3309 bool found = false; |
| 3302 std::string name = base::UTF16ToUTF8((LPCWSTR)attrib_names[i]); | 3310 std::string name = base::UTF16ToUTF8((LPCWSTR)attrib_names[i]); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3315 return S_OK; | 3323 return S_OK; |
| 3316 } | 3324 } |
| 3317 | 3325 |
| 3318 STDMETHODIMP BrowserAccessibilityWin::get_computedStyle( | 3326 STDMETHODIMP BrowserAccessibilityWin::get_computedStyle( |
| 3319 unsigned short max_style_properties, | 3327 unsigned short max_style_properties, |
| 3320 boolean use_alternate_view, | 3328 boolean use_alternate_view, |
| 3321 BSTR* style_properties, | 3329 BSTR* style_properties, |
| 3322 BSTR* style_values, | 3330 BSTR* style_values, |
| 3323 unsigned short *num_style_properties) { | 3331 unsigned short *num_style_properties) { |
| 3324 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COMPUTED_STYLE); | 3332 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COMPUTED_STYLE); |
| 3325 AddAccessibilityModeFlags(AccessibilityMode::kHTML); | 3333 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3326 if (!instance_active()) | 3334 if (!instance_active()) |
| 3327 return E_FAIL; | 3335 return E_FAIL; |
| 3328 | 3336 |
| 3329 if (!style_properties || !style_values) | 3337 if (!style_properties || !style_values) |
| 3330 return E_INVALIDARG; | 3338 return E_INVALIDARG; |
| 3331 | 3339 |
| 3332 // We only cache a single style property for now: DISPLAY | 3340 // We only cache a single style property for now: DISPLAY |
| 3333 | 3341 |
| 3334 base::string16 display; | 3342 base::string16 display; |
| 3335 if (max_style_properties == 0 || | 3343 if (max_style_properties == 0 || |
| 3336 !GetString16Attribute(ui::AX_ATTR_DISPLAY, &display)) { | 3344 !GetString16Attribute(ui::AX_ATTR_DISPLAY, &display)) { |
| 3337 *num_style_properties = 0; | 3345 *num_style_properties = 0; |
| 3338 return S_OK; | 3346 return S_OK; |
| 3339 } | 3347 } |
| 3340 | 3348 |
| 3341 *num_style_properties = 1; | 3349 *num_style_properties = 1; |
| 3342 style_properties[0] = SysAllocString(L"display"); | 3350 style_properties[0] = SysAllocString(L"display"); |
| 3343 style_values[0] = SysAllocString(display.c_str()); | 3351 style_values[0] = SysAllocString(display.c_str()); |
| 3344 | 3352 |
| 3345 return S_OK; | 3353 return S_OK; |
| 3346 } | 3354 } |
| 3347 | 3355 |
| 3348 STDMETHODIMP BrowserAccessibilityWin::get_computedStyleForProperties( | 3356 STDMETHODIMP BrowserAccessibilityWin::get_computedStyleForProperties( |
| 3349 unsigned short num_style_properties, | 3357 unsigned short num_style_properties, |
| 3350 boolean use_alternate_view, | 3358 boolean use_alternate_view, |
| 3351 BSTR* style_properties, | 3359 BSTR* style_properties, |
| 3352 BSTR* style_values) { | 3360 BSTR* style_values) { |
| 3353 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COMPUTED_STYLE_FOR_PROPERTIES); | 3361 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COMPUTED_STYLE_FOR_PROPERTIES); |
| 3354 AddAccessibilityModeFlags(AccessibilityMode::kHTML); | 3362 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3355 if (!instance_active()) | 3363 if (!instance_active()) |
| 3356 return E_FAIL; | 3364 return E_FAIL; |
| 3357 | 3365 |
| 3358 if (!style_properties || !style_values) | 3366 if (!style_properties || !style_values) |
| 3359 return E_INVALIDARG; | 3367 return E_INVALIDARG; |
| 3360 | 3368 |
| 3361 // We only cache a single style property for now: DISPLAY | 3369 // We only cache a single style property for now: DISPLAY |
| 3362 | 3370 |
| 3363 for (unsigned short i = 0; i < num_style_properties; ++i) { | 3371 for (unsigned short i = 0; i < num_style_properties; ++i) { |
| 3364 base::string16 name = base::ToLowerASCII( | 3372 base::string16 name = base::ToLowerASCII( |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3487 return S_FALSE; | 3495 return S_FALSE; |
| 3488 } | 3496 } |
| 3489 | 3497 |
| 3490 *node = ToBrowserAccessibilityWin(child)->NewReference(); | 3498 *node = ToBrowserAccessibilityWin(child)->NewReference(); |
| 3491 return S_OK; | 3499 return S_OK; |
| 3492 } | 3500 } |
| 3493 | 3501 |
| 3494 // We only support this method for retrieving MathML content. | 3502 // We only support this method for retrieving MathML content. |
| 3495 STDMETHODIMP BrowserAccessibilityWin::get_innerHTML(BSTR* innerHTML) { | 3503 STDMETHODIMP BrowserAccessibilityWin::get_innerHTML(BSTR* innerHTML) { |
| 3496 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_INNER_HTML); | 3504 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_INNER_HTML); |
| 3497 AddAccessibilityModeFlags(AccessibilityMode::kHTML); | 3505 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3498 if (GetRole() != ui::AX_ROLE_MATH) | 3506 if (GetRole() != ui::AX_ROLE_MATH) |
| 3499 return E_NOTIMPL; | 3507 return E_NOTIMPL; |
| 3500 if (!instance_active()) | 3508 if (!instance_active()) |
| 3501 return E_FAIL; | 3509 return E_FAIL; |
| 3502 | 3510 |
| 3503 base::string16 inner_html = GetString16Attribute(ui::AX_ATTR_INNER_HTML); | 3511 base::string16 inner_html = GetString16Attribute(ui::AX_ATTR_INNER_HTML); |
| 3504 *innerHTML = SysAllocString(inner_html.c_str()); | 3512 *innerHTML = SysAllocString(inner_html.c_str()); |
| 3505 DCHECK(*innerHTML); | 3513 DCHECK(*innerHTML); |
| 3506 return S_OK; | 3514 return S_OK; |
| 3507 } | 3515 } |
| 3508 | 3516 |
| 3509 STDMETHODIMP | 3517 STDMETHODIMP |
| 3510 BrowserAccessibilityWin::get_localInterface(void** local_interface) { | 3518 BrowserAccessibilityWin::get_localInterface(void** local_interface) { |
| 3511 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCAL_INTERFACE); | 3519 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LOCAL_INTERFACE); |
| 3512 AddAccessibilityModeFlags(AccessibilityMode::kHTML); | 3520 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3513 return E_NOTIMPL; | 3521 return E_NOTIMPL; |
| 3514 } | 3522 } |
| 3515 | 3523 |
| 3516 STDMETHODIMP BrowserAccessibilityWin::get_language(BSTR* language) { | 3524 STDMETHODIMP BrowserAccessibilityWin::get_language(BSTR* language) { |
| 3517 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LANGUAGE); | 3525 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_LANGUAGE); |
| 3518 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 3526 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3519 if (!language) | 3527 if (!language) |
| 3520 return E_INVALIDARG; | 3528 return E_INVALIDARG; |
| 3521 *language = nullptr; | 3529 *language = nullptr; |
| 3522 | 3530 |
| 3523 if (!instance_active()) | 3531 if (!instance_active()) |
| 3524 return E_FAIL; | 3532 return E_FAIL; |
| 3525 | 3533 |
| 3526 base::string16 lang = GetInheritedString16Attribute(ui::AX_ATTR_LANGUAGE); | 3534 base::string16 lang = GetInheritedString16Attribute(ui::AX_ATTR_LANGUAGE); |
| 3527 if (lang.empty()) | 3535 if (lang.empty()) |
| 3528 lang = L"en-US"; | 3536 lang = L"en-US"; |
| 3529 | 3537 |
| 3530 *language = SysAllocString(lang.c_str()); | 3538 *language = SysAllocString(lang.c_str()); |
| 3531 DCHECK(*language); | 3539 DCHECK(*language); |
| 3532 return S_OK; | 3540 return S_OK; |
| 3533 } | 3541 } |
| 3534 | 3542 |
| 3535 // | 3543 // |
| 3536 // ISimpleDOMText methods. | 3544 // ISimpleDOMText methods. |
| 3537 // | 3545 // |
| 3538 | 3546 |
| 3539 STDMETHODIMP BrowserAccessibilityWin::get_domText(BSTR* dom_text) { | 3547 STDMETHODIMP BrowserAccessibilityWin::get_domText(BSTR* dom_text) { |
| 3540 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_DOM_TEXT); | 3548 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_DOM_TEXT); |
| 3541 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 3549 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3542 if (!instance_active()) | 3550 if (!instance_active()) |
| 3543 return E_FAIL; | 3551 return E_FAIL; |
| 3544 | 3552 |
| 3545 if (!dom_text) | 3553 if (!dom_text) |
| 3546 return E_INVALIDARG; | 3554 return E_INVALIDARG; |
| 3547 | 3555 |
| 3548 return GetStringAttributeAsBstr( | 3556 return GetStringAttributeAsBstr( |
| 3549 ui::AX_ATTR_NAME, dom_text); | 3557 ui::AX_ATTR_NAME, dom_text); |
| 3550 } | 3558 } |
| 3551 | 3559 |
| 3552 STDMETHODIMP BrowserAccessibilityWin::get_clippedSubstringBounds( | 3560 STDMETHODIMP BrowserAccessibilityWin::get_clippedSubstringBounds( |
| 3553 unsigned int start_index, | 3561 unsigned int start_index, |
| 3554 unsigned int end_index, | 3562 unsigned int end_index, |
| 3555 int* out_x, | 3563 int* out_x, |
| 3556 int* out_y, | 3564 int* out_y, |
| 3557 int* out_width, | 3565 int* out_width, |
| 3558 int* out_height) { | 3566 int* out_height) { |
| 3559 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CLIPPED_SUBSTRING_BOUNDS); | 3567 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CLIPPED_SUBSTRING_BOUNDS); |
| 3560 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 3568 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 3561 AccessibilityMode::kInlineTextBoxes); | 3569 AccessibilityMode::kInlineTextBoxes); |
| 3562 // TODO(dmazzoni): fully support this API by intersecting the | 3570 // TODO(dmazzoni): fully support this API by intersecting the |
| 3563 // rect with the container's rect. | 3571 // rect with the container's rect. |
| 3564 return get_unclippedSubstringBounds( | 3572 return get_unclippedSubstringBounds( |
| 3565 start_index, end_index, out_x, out_y, out_width, out_height); | 3573 start_index, end_index, out_x, out_y, out_width, out_height); |
| 3566 } | 3574 } |
| 3567 | 3575 |
| 3568 STDMETHODIMP BrowserAccessibilityWin::get_unclippedSubstringBounds( | 3576 STDMETHODIMP BrowserAccessibilityWin::get_unclippedSubstringBounds( |
| 3569 unsigned int start_index, | 3577 unsigned int start_index, |
| 3570 unsigned int end_index, | 3578 unsigned int end_index, |
| 3571 int* out_x, | 3579 int* out_x, |
| 3572 int* out_y, | 3580 int* out_y, |
| 3573 int* out_width, | 3581 int* out_width, |
| 3574 int* out_height) { | 3582 int* out_height) { |
| 3575 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_UNCLIPPED_SUBSTRING_BOUNDS); | 3583 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_UNCLIPPED_SUBSTRING_BOUNDS); |
| 3576 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 3584 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 3577 AccessibilityMode::kInlineTextBoxes); | 3585 AccessibilityMode::kInlineTextBoxes); |
| 3578 if (!instance_active()) | 3586 if (!instance_active()) |
| 3579 return E_FAIL; | 3587 return E_FAIL; |
| 3580 | 3588 |
| 3581 if (!out_x || !out_y || !out_width || !out_height) | 3589 if (!out_x || !out_y || !out_width || !out_height) |
| 3582 return E_INVALIDARG; | 3590 return E_INVALIDARG; |
| 3583 | 3591 |
| 3584 unsigned int text_length = static_cast<unsigned int>(GetText().size()); | 3592 unsigned int text_length = static_cast<unsigned int>(GetText().size()); |
| 3585 if (start_index > text_length || end_index > text_length || | 3593 if (start_index > text_length || end_index > text_length || |
| 3586 start_index > end_index) { | 3594 start_index > end_index) { |
| 3587 return E_INVALIDARG; | 3595 return E_INVALIDARG; |
| 3588 } | 3596 } |
| 3589 | 3597 |
| 3590 gfx::Rect bounds = GetScreenBoundsForRange( | 3598 gfx::Rect bounds = GetScreenBoundsForRange( |
| 3591 start_index, end_index - start_index); | 3599 start_index, end_index - start_index); |
| 3592 *out_x = bounds.x(); | 3600 *out_x = bounds.x(); |
| 3593 *out_y = bounds.y(); | 3601 *out_y = bounds.y(); |
| 3594 *out_width = bounds.width(); | 3602 *out_width = bounds.width(); |
| 3595 *out_height = bounds.height(); | 3603 *out_height = bounds.height(); |
| 3596 return S_OK; | 3604 return S_OK; |
| 3597 } | 3605 } |
| 3598 | 3606 |
| 3599 STDMETHODIMP BrowserAccessibilityWin::scrollToSubstring( | 3607 STDMETHODIMP BrowserAccessibilityWin::scrollToSubstring( |
| 3600 unsigned int start_index, | 3608 unsigned int start_index, |
| 3601 unsigned int end_index) { | 3609 unsigned int end_index) { |
| 3602 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_TO_SUBSTRING); | 3610 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SCROLL_TO_SUBSTRING); |
| 3603 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader | | 3611 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 3604 AccessibilityMode::kInlineTextBoxes); | 3612 AccessibilityMode::kInlineTextBoxes); |
| 3605 if (!instance_active()) | 3613 if (!instance_active()) |
| 3606 return E_FAIL; | 3614 return E_FAIL; |
| 3607 | 3615 |
| 3608 unsigned int text_length = static_cast<unsigned int>(GetText().size()); | 3616 unsigned int text_length = static_cast<unsigned int>(GetText().size()); |
| 3609 if (start_index > text_length || end_index > text_length || | 3617 if (start_index > text_length || end_index > text_length || |
| 3610 start_index > end_index) { | 3618 start_index > end_index) { |
| 3611 return E_INVALIDARG; | 3619 return E_INVALIDARG; |
| 3612 } | 3620 } |
| 3613 | 3621 |
| 3614 manager_->ScrollToMakeVisible( | 3622 manager_->ScrollToMakeVisible( |
| 3615 *this, GetPageBoundsForRange(start_index, end_index - start_index)); | 3623 *this, GetPageBoundsForRange(start_index, end_index - start_index)); |
| 3616 | 3624 |
| 3617 return S_OK; | 3625 return S_OK; |
| 3618 } | 3626 } |
| 3619 | 3627 |
| 3620 STDMETHODIMP BrowserAccessibilityWin::get_fontFamily(BSTR* font_family) { | 3628 STDMETHODIMP BrowserAccessibilityWin::get_fontFamily(BSTR* font_family) { |
| 3621 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_FONT_FAMILY); | 3629 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_FONT_FAMILY); |
| 3622 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 3630 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 3623 if (!font_family) | 3631 if (!font_family) |
| 3624 return E_INVALIDARG; | 3632 return E_INVALIDARG; |
| 3625 *font_family = nullptr; | 3633 *font_family = nullptr; |
| 3626 | 3634 |
| 3627 if (!instance_active()) | 3635 if (!instance_active()) |
| 3628 return E_FAIL; | 3636 return E_FAIL; |
| 3629 | 3637 |
| 3630 base::string16 family = | 3638 base::string16 family = |
| 3631 GetInheritedString16Attribute(ui::AX_ATTR_FONT_FAMILY); | 3639 GetInheritedString16Attribute(ui::AX_ATTR_FONT_FAMILY); |
| 3632 if (family.empty()) | 3640 if (family.empty()) |
| (...skipping 2169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5802 return static_cast<BrowserAccessibilityWin*>(obj); | 5810 return static_cast<BrowserAccessibilityWin*>(obj); |
| 5803 } | 5811 } |
| 5804 | 5812 |
| 5805 const BrowserAccessibilityWin* | 5813 const BrowserAccessibilityWin* |
| 5806 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { | 5814 ToBrowserAccessibilityWin(const BrowserAccessibility* obj) { |
| 5807 DCHECK(!obj || obj->IsNative()); | 5815 DCHECK(!obj || obj->IsNative()); |
| 5808 return static_cast<const BrowserAccessibilityWin*>(obj); | 5816 return static_cast<const BrowserAccessibilityWin*>(obj); |
| 5809 } | 5817 } |
| 5810 | 5818 |
| 5811 } // namespace content | 5819 } // namespace content |
| OLD | NEW |