| OLD | NEW |
| 1 // Copyright (c) 2017 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2017 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_com_win.h" | 5 #include "content/browser/accessibility/browser_accessibility_com_win.h" |
| 6 | 6 |
| 7 #include <UIAutomationClient.h> | 7 #include <UIAutomationClient.h> |
| 8 #include <UIAutomationCoreApi.h> | 8 #include <UIAutomationCoreApi.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1070 | 1070 |
| 1071 STDMETHODIMP BrowserAccessibilityComWin::get_accessibleAt( | 1071 STDMETHODIMP BrowserAccessibilityComWin::get_accessibleAt( |
| 1072 long row, | 1072 long row, |
| 1073 long column, | 1073 long column, |
| 1074 IUnknown** accessible) { | 1074 IUnknown** accessible) { |
| 1075 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACCESSIBLE_AT); | 1075 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ACCESSIBLE_AT); |
| 1076 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1076 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1077 if (!owner()) | 1077 if (!owner()) |
| 1078 return E_FAIL; | 1078 return E_FAIL; |
| 1079 | 1079 |
| 1080 if (!accessible) | 1080 return AXPlatformNodeWin::get_accessibleAt(row, column, accessible); |
| 1081 return E_INVALIDARG; | |
| 1082 | |
| 1083 AXPlatformNodeBase* cell = | |
| 1084 GetTableCell(static_cast<int>(row), static_cast<int>(column)); | |
| 1085 if (cell) { | |
| 1086 auto* node_win = static_cast<AXPlatformNodeWin*>(cell); | |
| 1087 node_win->AddRef(); | |
| 1088 | |
| 1089 *accessible = static_cast<IAccessible*>(node_win); | |
| 1090 return S_OK; | |
| 1091 } | |
| 1092 | |
| 1093 *accessible = nullptr; | |
| 1094 return E_INVALIDARG; | |
| 1095 } | 1081 } |
| 1096 | 1082 |
| 1097 STDMETHODIMP BrowserAccessibilityComWin::get_caption(IUnknown** accessible) { | 1083 STDMETHODIMP BrowserAccessibilityComWin::get_caption(IUnknown** accessible) { |
| 1098 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CAPTION); | 1084 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CAPTION); |
| 1099 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1085 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1100 if (!owner()) | 1086 if (!owner()) |
| 1101 return E_FAIL; | 1087 return E_FAIL; |
| 1102 | 1088 |
| 1103 if (!accessible) | 1089 return AXPlatformNodeWin::get_caption(accessible); |
| 1104 return E_INVALIDARG; | |
| 1105 | |
| 1106 // TODO(dmazzoni): implement | |
| 1107 *accessible = nullptr; | |
| 1108 return S_FALSE; | |
| 1109 } | 1090 } |
| 1110 | 1091 |
| 1111 STDMETHODIMP BrowserAccessibilityComWin::get_childIndex(long row, | 1092 STDMETHODIMP BrowserAccessibilityComWin::get_childIndex(long row, |
| 1112 long column, | 1093 long column, |
| 1113 long* cell_index) { | 1094 long* cell_index) { |
| 1114 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHILD_INDEX); | 1095 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CHILD_INDEX); |
| 1115 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1096 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1116 if (!owner()) | 1097 if (!owner()) |
| 1117 return E_FAIL; | 1098 return E_FAIL; |
| 1118 | 1099 |
| 1119 if (!cell_index) | 1100 return AXPlatformNodeWin::get_childIndex(row, column, cell_index); |
| 1120 return E_INVALIDARG; | |
| 1121 | |
| 1122 auto* cell = GetTableCell(static_cast<int>(row), static_cast<int>(column)); | |
| 1123 if (cell) { | |
| 1124 *cell_index = static_cast<LONG>(cell->GetTableCellIndex()); | |
| 1125 return S_OK; | |
| 1126 } | |
| 1127 | |
| 1128 *cell_index = 0; | |
| 1129 return E_INVALIDARG; | |
| 1130 } | 1101 } |
| 1131 | 1102 |
| 1132 STDMETHODIMP BrowserAccessibilityComWin::get_columnDescription( | 1103 STDMETHODIMP BrowserAccessibilityComWin::get_columnDescription( |
| 1133 long column, | 1104 long column, |
| 1134 BSTR* description) { | 1105 BSTR* description) { |
| 1135 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_DESCRIPTION); | 1106 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_DESCRIPTION); |
| 1136 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1107 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1137 if (!owner()) | 1108 if (!owner()) |
| 1138 return E_FAIL; | 1109 return E_FAIL; |
| 1139 | 1110 |
| 1140 if (!description) | 1111 return AXPlatformNodeWin::get_columnDescription(column, description); |
| 1141 return E_INVALIDARG; | |
| 1142 | |
| 1143 int columns = GetTableColumnCount(); | |
| 1144 if (column < 0 || column >= columns) | |
| 1145 return E_INVALIDARG; | |
| 1146 | |
| 1147 int rows = GetTableRowCount(); | |
| 1148 if (rows <= 0) { | |
| 1149 *description = nullptr; | |
| 1150 return S_FALSE; | |
| 1151 } | |
| 1152 | |
| 1153 for (int i = 0; i < rows; ++i) { | |
| 1154 auto* cell = GetTableCell(i, column); | |
| 1155 if (cell && cell->GetData().role == ui::AX_ROLE_COLUMN_HEADER) { | |
| 1156 base::string16 cell_name = cell->GetString16Attribute(ui::AX_ATTR_NAME); | |
| 1157 if (cell_name.size() > 0) { | |
| 1158 *description = SysAllocString(cell_name.c_str()); | |
| 1159 return S_OK; | |
| 1160 } | |
| 1161 | |
| 1162 cell_name = cell->GetString16Attribute(ui::AX_ATTR_DESCRIPTION); | |
| 1163 if (cell_name.size() > 0) { | |
| 1164 *description = SysAllocString(cell_name.c_str()); | |
| 1165 return S_OK; | |
| 1166 } | |
| 1167 } | |
| 1168 } | |
| 1169 | |
| 1170 *description = nullptr; | |
| 1171 return S_FALSE; | |
| 1172 } | 1112 } |
| 1173 | 1113 |
| 1174 STDMETHODIMP BrowserAccessibilityComWin::get_columnExtentAt( | 1114 STDMETHODIMP BrowserAccessibilityComWin::get_columnExtentAt( |
| 1175 long row, | 1115 long row, |
| 1176 long column, | 1116 long column, |
| 1177 long* n_columns_spanned) { | 1117 long* n_columns_spanned) { |
| 1178 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_EXTENT_AT); | 1118 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_EXTENT_AT); |
| 1179 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1119 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1180 if (!owner()) | 1120 if (!owner()) |
| 1181 return E_FAIL; | 1121 return E_FAIL; |
| 1182 | 1122 |
| 1183 if (!n_columns_spanned) | 1123 return AXPlatformNodeWin::get_columnExtentAt(row, column, n_columns_spanned); |
| 1184 return E_INVALIDARG; | |
| 1185 | |
| 1186 auto* cell = GetTableCell(static_cast<int>(row), static_cast<int>(column)); | |
| 1187 if (!cell) | |
| 1188 return E_INVALIDARG; | |
| 1189 | |
| 1190 *n_columns_spanned = cell->GetTableColumnSpan(); | |
| 1191 return S_OK; | |
| 1192 } | 1124 } |
| 1193 | 1125 |
| 1194 STDMETHODIMP BrowserAccessibilityComWin::get_columnHeader( | 1126 STDMETHODIMP BrowserAccessibilityComWin::get_columnHeader( |
| 1195 IAccessibleTable** accessible_table, | 1127 IAccessibleTable** accessible_table, |
| 1196 long* starting_row_index) { | 1128 long* starting_row_index) { |
| 1197 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_HEADER); | 1129 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_HEADER); |
| 1198 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1130 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1199 // TODO(dmazzoni): implement | 1131 |
| 1200 return E_NOTIMPL; | 1132 if (!owner()) |
| 1133 return E_FAIL; |
| 1134 |
| 1135 return AXPlatformNodeWin::get_columnHeader(accessible_table, |
| 1136 starting_row_index); |
| 1201 } | 1137 } |
| 1202 | 1138 |
| 1203 STDMETHODIMP BrowserAccessibilityComWin::get_columnIndex(long cell_index, | 1139 STDMETHODIMP BrowserAccessibilityComWin::get_columnIndex(long cell_index, |
| 1204 long* column_index) { | 1140 long* column_index) { |
| 1205 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_INDEX); | 1141 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_INDEX); |
| 1206 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1142 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1207 if (!owner()) | 1143 if (!owner()) |
| 1208 return E_FAIL; | 1144 return E_FAIL; |
| 1209 | 1145 |
| 1210 if (!column_index) | 1146 return AXPlatformNodeWin::get_columnIndex(cell_index, column_index); |
| 1211 return E_INVALIDARG; | |
| 1212 | |
| 1213 auto* cell = GetTableCell(cell_index); | |
| 1214 if (!cell) | |
| 1215 return E_INVALIDARG; | |
| 1216 *column_index = cell->GetTableColumn(); | |
| 1217 return S_OK; | |
| 1218 } | 1147 } |
| 1219 | 1148 |
| 1220 STDMETHODIMP BrowserAccessibilityComWin::get_nColumns(long* column_count) { | 1149 STDMETHODIMP BrowserAccessibilityComWin::get_nColumns(long* column_count) { |
| 1221 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_COLUMNS); | 1150 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_COLUMNS); |
| 1222 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1151 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1223 if (!owner()) | 1152 if (!owner()) |
| 1224 return E_FAIL; | 1153 return E_FAIL; |
| 1225 | 1154 |
| 1226 if (!column_count) | 1155 return AXPlatformNodeWin::get_nColumns(column_count); |
| 1227 return E_INVALIDARG; | |
| 1228 | |
| 1229 *column_count = GetTableColumnCount(); | |
| 1230 return S_OK; | |
| 1231 } | 1156 } |
| 1232 | 1157 |
| 1233 STDMETHODIMP BrowserAccessibilityComWin::get_nRows(long* row_count) { | 1158 STDMETHODIMP BrowserAccessibilityComWin::get_nRows(long* row_count) { |
| 1234 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_ROWS); | 1159 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_ROWS); |
| 1235 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1160 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1236 if (!owner()) | 1161 if (!owner()) |
| 1237 return E_FAIL; | 1162 return E_FAIL; |
| 1238 | 1163 |
| 1239 if (!row_count) | 1164 return AXPlatformNodeWin::get_nRows(row_count); |
| 1240 return E_INVALIDARG; | |
| 1241 | |
| 1242 *row_count = GetTableRowCount(); | |
| 1243 return S_OK; | |
| 1244 } | 1165 } |
| 1245 | 1166 |
| 1246 STDMETHODIMP BrowserAccessibilityComWin::get_nSelectedChildren( | 1167 STDMETHODIMP BrowserAccessibilityComWin::get_nSelectedChildren( |
| 1247 long* cell_count) { | 1168 long* cell_count) { |
| 1248 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_CHILDREN); | 1169 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_CHILDREN); |
| 1249 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1170 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1250 if (!owner()) | 1171 if (!owner()) |
| 1251 return E_FAIL; | 1172 return E_FAIL; |
| 1252 | 1173 |
| 1253 if (!cell_count) | 1174 return AXPlatformNodeWin::get_nSelectedChildren(cell_count); |
| 1254 return E_INVALIDARG; | |
| 1255 | |
| 1256 // TODO(dmazzoni): add support for selected cells/rows/columns in tables. | |
| 1257 *cell_count = 0; | |
| 1258 return S_FALSE; | |
| 1259 } | 1175 } |
| 1260 | 1176 |
| 1261 STDMETHODIMP BrowserAccessibilityComWin::get_nSelectedColumns( | 1177 STDMETHODIMP BrowserAccessibilityComWin::get_nSelectedColumns( |
| 1262 long* column_count) { | 1178 long* column_count) { |
| 1263 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_COLUMNS); | 1179 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_COLUMNS); |
| 1264 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1180 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1265 if (!owner()) | 1181 if (!owner()) |
| 1266 return E_FAIL; | 1182 return E_FAIL; |
| 1267 | 1183 |
| 1268 if (!column_count) | 1184 return AXPlatformNodeWin::get_nSelectedColumns(column_count); |
| 1269 return E_INVALIDARG; | |
| 1270 | |
| 1271 *column_count = 0; | |
| 1272 return S_FALSE; | |
| 1273 } | 1185 } |
| 1274 | 1186 |
| 1275 STDMETHODIMP BrowserAccessibilityComWin::get_nSelectedRows(long* row_count) { | 1187 STDMETHODIMP BrowserAccessibilityComWin::get_nSelectedRows(long* row_count) { |
| 1276 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_ROWS); | 1188 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_ROWS); |
| 1277 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1189 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1278 if (!owner()) | 1190 if (!owner()) |
| 1279 return E_FAIL; | 1191 return E_FAIL; |
| 1280 | 1192 |
| 1281 if (!row_count) | 1193 return AXPlatformNodeWin::get_nSelectedRows(row_count); |
| 1282 return E_INVALIDARG; | |
| 1283 | |
| 1284 *row_count = 0; | |
| 1285 return S_FALSE; | |
| 1286 } | 1194 } |
| 1287 | 1195 |
| 1288 STDMETHODIMP BrowserAccessibilityComWin::get_rowDescription(long row, | 1196 STDMETHODIMP BrowserAccessibilityComWin::get_rowDescription(long row, |
| 1289 BSTR* description) { | 1197 BSTR* description) { |
| 1290 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_DESCRIPTION); | 1198 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_DESCRIPTION); |
| 1291 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1199 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1292 if (!owner()) | 1200 if (!owner()) |
| 1293 return E_FAIL; | 1201 return E_FAIL; |
| 1294 | 1202 |
| 1295 if (!description) | 1203 return AXPlatformNodeWin::get_rowDescription(row, description); |
| 1296 return E_INVALIDARG; | |
| 1297 | |
| 1298 if (row < 0 || row >= GetTableRowCount()) | |
| 1299 return E_INVALIDARG; | |
| 1300 | |
| 1301 int columns = GetTableColumnCount(); | |
| 1302 if (columns <= 0) { | |
| 1303 *description = nullptr; | |
| 1304 return S_FALSE; | |
| 1305 } | |
| 1306 | |
| 1307 for (int i = 0; i < columns; ++i) { | |
| 1308 auto* cell = GetTableCell(row, i); | |
| 1309 if (cell && cell->GetData().role == ui::AX_ROLE_ROW_HEADER) { | |
| 1310 base::string16 cell_name = cell->GetString16Attribute(ui::AX_ATTR_NAME); | |
| 1311 if (cell_name.size() > 0) { | |
| 1312 *description = SysAllocString(cell_name.c_str()); | |
| 1313 return S_OK; | |
| 1314 } | |
| 1315 cell_name = cell->GetString16Attribute(ui::AX_ATTR_DESCRIPTION); | |
| 1316 if (cell_name.size() > 0) { | |
| 1317 *description = SysAllocString(cell_name.c_str()); | |
| 1318 return S_OK; | |
| 1319 } | |
| 1320 } | |
| 1321 } | |
| 1322 | |
| 1323 *description = nullptr; | |
| 1324 return S_FALSE; | |
| 1325 } | 1204 } |
| 1326 | 1205 |
| 1327 STDMETHODIMP BrowserAccessibilityComWin::get_rowExtentAt(long row, | 1206 STDMETHODIMP BrowserAccessibilityComWin::get_rowExtentAt(long row, |
| 1328 long column, | 1207 long column, |
| 1329 long* n_rows_spanned) { | 1208 long* n_rows_spanned) { |
| 1330 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_EXTENT_AT); | 1209 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_EXTENT_AT); |
| 1331 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1210 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1332 if (!owner()) | 1211 if (!owner()) |
| 1333 return E_FAIL; | 1212 return E_FAIL; |
| 1334 | 1213 |
| 1335 if (!n_rows_spanned) | 1214 return AXPlatformNodeWin::get_rowExtentAt(row, column, n_rows_spanned); |
| 1336 return E_INVALIDARG; | |
| 1337 | |
| 1338 auto* cell = GetTableCell(row, column); | |
| 1339 if (!cell) | |
| 1340 return E_INVALIDARG; | |
| 1341 | |
| 1342 *n_rows_spanned = GetTableRowSpan(); | |
| 1343 return S_OK; | |
| 1344 } | 1215 } |
| 1345 | 1216 |
| 1346 STDMETHODIMP BrowserAccessibilityComWin::get_rowHeader( | 1217 STDMETHODIMP BrowserAccessibilityComWin::get_rowHeader( |
| 1347 IAccessibleTable** accessible_table, | 1218 IAccessibleTable** accessible_table, |
| 1348 long* starting_column_index) { | 1219 long* starting_column_index) { |
| 1349 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_HEADER); | 1220 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_HEADER); |
| 1350 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1221 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1351 // TODO(dmazzoni): implement | 1222 if (!owner()) |
| 1352 return E_NOTIMPL; | 1223 return E_FAIL; |
| 1224 |
| 1225 return AXPlatformNodeWin::get_rowHeader(accessible_table, |
| 1226 starting_column_index); |
| 1353 } | 1227 } |
| 1354 | 1228 |
| 1355 STDMETHODIMP BrowserAccessibilityComWin::get_rowIndex(long cell_index, | 1229 STDMETHODIMP BrowserAccessibilityComWin::get_rowIndex(long cell_index, |
| 1356 long* row_index) { | 1230 long* row_index) { |
| 1357 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_INDEX); | 1231 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_INDEX); |
| 1358 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1232 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1359 if (!owner()) | 1233 if (!owner()) |
| 1360 return E_FAIL; | 1234 return E_FAIL; |
| 1361 | 1235 |
| 1362 if (!row_index) | 1236 return AXPlatformNodeWin::get_rowIndex(cell_index, row_index); |
| 1363 return E_INVALIDARG; | |
| 1364 | |
| 1365 auto* cell = GetTableCell(cell_index); | |
| 1366 if (!cell) | |
| 1367 return E_INVALIDARG; | |
| 1368 | |
| 1369 *row_index = cell->GetTableRow(); | |
| 1370 return S_OK; | |
| 1371 } | 1237 } |
| 1372 | 1238 |
| 1373 STDMETHODIMP BrowserAccessibilityComWin::get_selectedChildren( | 1239 STDMETHODIMP BrowserAccessibilityComWin::get_selectedChildren( |
| 1374 long max_children, | 1240 long max_children, |
| 1375 long** children, | 1241 long** children, |
| 1376 long* n_children) { | 1242 long* n_children) { |
| 1377 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_CHILDREN); | 1243 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_CHILDREN); |
| 1378 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1244 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1379 if (!owner()) | 1245 if (!owner()) |
| 1380 return E_FAIL; | 1246 return E_FAIL; |
| 1381 | 1247 |
| 1382 if (!children || !n_children) | 1248 return AXPlatformNodeWin::get_selectedChildren(max_children, children, |
| 1383 return E_INVALIDARG; | 1249 n_children); |
| 1384 | |
| 1385 // TODO(dmazzoni): Implement this. | |
| 1386 *n_children = 0; | |
| 1387 return S_FALSE; | |
| 1388 } | 1250 } |
| 1389 | 1251 |
| 1390 STDMETHODIMP BrowserAccessibilityComWin::get_selectedColumns(long max_columns, | 1252 STDMETHODIMP BrowserAccessibilityComWin::get_selectedColumns(long max_columns, |
| 1391 long** columns, | 1253 long** columns, |
| 1392 long* n_columns) { | 1254 long* n_columns) { |
| 1393 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_COLUMNS); | 1255 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_COLUMNS); |
| 1394 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1256 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1395 if (!owner()) | 1257 if (!owner()) |
| 1396 return E_FAIL; | 1258 return E_FAIL; |
| 1397 | 1259 |
| 1398 if (!columns || !n_columns) | 1260 return AXPlatformNodeWin::get_selectedColumns(max_columns, columns, |
| 1399 return E_INVALIDARG; | 1261 n_columns); |
| 1400 | |
| 1401 // TODO(dmazzoni): Implement this. | |
| 1402 *n_columns = 0; | |
| 1403 return S_FALSE; | |
| 1404 } | 1262 } |
| 1405 | 1263 |
| 1406 STDMETHODIMP BrowserAccessibilityComWin::get_selectedRows(long max_rows, | 1264 STDMETHODIMP BrowserAccessibilityComWin::get_selectedRows(long max_rows, |
| 1407 long** rows, | 1265 long** rows, |
| 1408 long* n_rows) { | 1266 long* n_rows) { |
| 1409 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_ROWS); | 1267 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_ROWS); |
| 1410 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1268 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1411 if (!owner()) | 1269 if (!owner()) |
| 1412 return E_FAIL; | 1270 return E_FAIL; |
| 1413 | 1271 |
| 1414 if (!rows || !n_rows) | 1272 return AXPlatformNodeWin::get_selectedRows(max_rows, rows, n_rows); |
| 1415 return E_INVALIDARG; | |
| 1416 | |
| 1417 // TODO(dmazzoni): Implement this. | |
| 1418 *n_rows = 0; | |
| 1419 return S_FALSE; | |
| 1420 } | 1273 } |
| 1421 | 1274 |
| 1422 STDMETHODIMP BrowserAccessibilityComWin::get_summary(IUnknown** accessible) { | 1275 STDMETHODIMP BrowserAccessibilityComWin::get_summary(IUnknown** accessible) { |
| 1423 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SUMMARY); | 1276 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SUMMARY); |
| 1424 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1277 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1425 if (!owner()) | 1278 if (!owner()) |
| 1426 return E_FAIL; | 1279 return E_FAIL; |
| 1427 | 1280 |
| 1428 if (!accessible) | 1281 return AXPlatformNodeWin::get_summary(accessible); |
| 1429 return E_INVALIDARG; | |
| 1430 | |
| 1431 // TODO(dmazzoni): implement | |
| 1432 *accessible = nullptr; | |
| 1433 return S_FALSE; | |
| 1434 } | 1282 } |
| 1435 | 1283 |
| 1436 STDMETHODIMP BrowserAccessibilityComWin::get_isColumnSelected( | 1284 STDMETHODIMP BrowserAccessibilityComWin::get_isColumnSelected( |
| 1437 long column, | 1285 long column, |
| 1438 boolean* is_selected) { | 1286 boolean* is_selected) { |
| 1439 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_COLUMN_SELECTED); | 1287 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_COLUMN_SELECTED); |
| 1440 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1288 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1441 if (!owner()) | 1289 if (!owner()) |
| 1442 return E_FAIL; | 1290 return E_FAIL; |
| 1443 | 1291 |
| 1444 if (!is_selected) | 1292 return AXPlatformNodeWin::get_isColumnSelected(column, is_selected); |
| 1445 return E_INVALIDARG; | |
| 1446 | |
| 1447 // TODO(dmazzoni): Implement this. | |
| 1448 *is_selected = false; | |
| 1449 return S_OK; | |
| 1450 } | 1293 } |
| 1451 | 1294 |
| 1452 STDMETHODIMP BrowserAccessibilityComWin::get_isRowSelected( | 1295 STDMETHODIMP BrowserAccessibilityComWin::get_isRowSelected( |
| 1453 long row, | 1296 long row, |
| 1454 boolean* is_selected) { | 1297 boolean* is_selected) { |
| 1455 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_ROW_SELECTED); | 1298 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_ROW_SELECTED); |
| 1456 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1299 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1457 if (!owner()) | 1300 if (!owner()) |
| 1458 return E_FAIL; | 1301 return E_FAIL; |
| 1459 | 1302 |
| 1460 if (!is_selected) | 1303 return AXPlatformNodeWin::get_isRowSelected(row, is_selected); |
| 1461 return E_INVALIDARG; | |
| 1462 | |
| 1463 // TODO(dmazzoni): Implement this. | |
| 1464 *is_selected = false; | |
| 1465 return S_OK; | |
| 1466 } | 1304 } |
| 1467 | 1305 |
| 1468 STDMETHODIMP BrowserAccessibilityComWin::get_isSelected(long row, | 1306 STDMETHODIMP BrowserAccessibilityComWin::get_isSelected(long row, |
| 1469 long column, | 1307 long column, |
| 1470 boolean* is_selected) { | 1308 boolean* is_selected) { |
| 1471 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_SELECTED); | 1309 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_IS_SELECTED); |
| 1472 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1310 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1473 if (!owner()) | 1311 if (!owner()) |
| 1474 return E_FAIL; | 1312 return E_FAIL; |
| 1475 | 1313 |
| 1476 if (!is_selected) | 1314 return AXPlatformNodeWin::get_isSelected(row, column, is_selected); |
| 1477 return E_INVALIDARG; | |
| 1478 | |
| 1479 // TODO(dmazzoni): Implement this. | |
| 1480 *is_selected = false; | |
| 1481 return S_OK; | |
| 1482 } | 1315 } |
| 1483 | 1316 |
| 1484 STDMETHODIMP BrowserAccessibilityComWin::get_rowColumnExtentsAtIndex( | 1317 STDMETHODIMP BrowserAccessibilityComWin::get_rowColumnExtentsAtIndex( |
| 1485 long index, | 1318 long index, |
| 1486 long* row, | 1319 long* row, |
| 1487 long* column, | 1320 long* column, |
| 1488 long* row_extents, | 1321 long* row_extents, |
| 1489 long* column_extents, | 1322 long* column_extents, |
| 1490 boolean* is_selected) { | 1323 boolean* is_selected) { |
| 1491 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_COLUMN_EXTENTS_AT_INDEX); | 1324 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_COLUMN_EXTENTS_AT_INDEX); |
| 1492 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1325 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1493 if (!owner()) | 1326 if (!owner()) |
| 1494 return E_FAIL; | 1327 return E_FAIL; |
| 1495 | 1328 |
| 1496 if (!row || !column || !row_extents || !column_extents || !is_selected) | 1329 return AXPlatformNodeWin::get_rowColumnExtentsAtIndex( |
| 1497 return E_INVALIDARG; | 1330 index, row, column, row_extents, column_extents, is_selected); |
| 1498 | |
| 1499 auto* cell = GetTableCell(index); | |
| 1500 if (!cell) | |
| 1501 return E_INVALIDARG; | |
| 1502 | |
| 1503 *row = cell->GetTableRow(); | |
| 1504 *column = cell->GetTableColumn(); | |
| 1505 *row_extents = GetTableRowSpan(); | |
| 1506 *column_extents = GetTableColumnSpan(); | |
| 1507 *is_selected = false; // Not supported. | |
| 1508 | |
| 1509 return S_OK; | |
| 1510 } | 1331 } |
| 1511 | 1332 |
| 1512 STDMETHODIMP BrowserAccessibilityComWin::selectRow(long row) { | 1333 STDMETHODIMP BrowserAccessibilityComWin::selectRow(long row) { |
| 1513 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SELECT_ROW); | 1334 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SELECT_ROW); |
| 1514 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1335 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1515 return E_NOTIMPL; | 1336 if (!owner()) |
| 1337 return E_FAIL; |
| 1338 |
| 1339 return AXPlatformNodeWin::selectRow(row); |
| 1516 } | 1340 } |
| 1517 | 1341 |
| 1518 STDMETHODIMP BrowserAccessibilityComWin::selectColumn(long column) { | 1342 STDMETHODIMP BrowserAccessibilityComWin::selectColumn(long column) { |
| 1519 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SELECT_COLUMN); | 1343 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_SELECT_COLUMN); |
| 1520 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1344 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1521 return E_NOTIMPL; | 1345 if (!owner()) |
| 1346 return E_FAIL; |
| 1347 |
| 1348 return AXPlatformNodeWin::selectColumn(column); |
| 1522 } | 1349 } |
| 1523 | 1350 |
| 1524 STDMETHODIMP BrowserAccessibilityComWin::unselectRow(long row) { | 1351 STDMETHODIMP BrowserAccessibilityComWin::unselectRow(long row) { |
| 1525 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_UNSELECT_ROW); | 1352 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_UNSELECT_ROW); |
| 1526 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1353 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1527 return E_NOTIMPL; | 1354 if (!owner()) |
| 1355 return E_FAIL; |
| 1356 |
| 1357 return AXPlatformNodeWin::unselectRow(row); |
| 1528 } | 1358 } |
| 1529 | 1359 |
| 1530 STDMETHODIMP BrowserAccessibilityComWin::unselectColumn(long column) { | 1360 STDMETHODIMP BrowserAccessibilityComWin::unselectColumn(long column) { |
| 1531 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_UNSELECT_COLUMN); | 1361 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_UNSELECT_COLUMN); |
| 1532 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1362 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1533 return E_NOTIMPL; | 1363 if (!owner()) |
| 1364 return E_FAIL; |
| 1365 |
| 1366 return AXPlatformNodeWin::unselectColumn(column); |
| 1534 } | 1367 } |
| 1535 | 1368 |
| 1536 STDMETHODIMP | 1369 STDMETHODIMP |
| 1537 BrowserAccessibilityComWin::get_modelChange(IA2TableModelChange* model_change) { | 1370 BrowserAccessibilityComWin::get_modelChange(IA2TableModelChange* model_change) { |
| 1538 return E_NOTIMPL; | 1371 if (!owner()) |
| 1372 return E_FAIL; |
| 1373 |
| 1374 return AXPlatformNodeWin::get_modelChange(model_change); |
| 1539 } | 1375 } |
| 1540 | 1376 |
| 1541 // | 1377 // |
| 1542 // IAccessibleTable2 methods. | 1378 // IAccessibleTable2 methods. |
| 1543 // | 1379 // |
| 1544 | 1380 |
| 1545 STDMETHODIMP BrowserAccessibilityComWin::get_cellAt(long row, | 1381 STDMETHODIMP BrowserAccessibilityComWin::get_cellAt(long row, |
| 1546 long column, | 1382 long column, |
| 1547 IUnknown** cell) { | 1383 IUnknown** cell) { |
| 1548 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CELL_AT); | 1384 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_CELL_AT); |
| 1549 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); | 1385 AddAccessibilityModeFlags(AccessibilityMode::kScreenReader); |
| 1550 if (!owner()) | 1386 if (!owner()) |
| 1551 return E_FAIL; | 1387 return E_FAIL; |
| 1552 | 1388 |
| 1553 if (!cell) | 1389 return AXPlatformNodeWin::get_cellAt(row, column, cell); |
| 1554 return E_INVALIDARG; | |
| 1555 | |
| 1556 AXPlatformNodeBase* table_cell = | |
| 1557 GetTableCell(static_cast<int>(row), static_cast<int>(column)); | |
| 1558 if (table_cell) { | |
| 1559 auto* node_win = static_cast<AXPlatformNodeWin*>(table_cell); | |
| 1560 node_win->AddRef(); | |
| 1561 *cell = static_cast<IAccessible*>(node_win); | |
| 1562 return S_OK; | |
| 1563 } | |
| 1564 | |
| 1565 *cell = nullptr; | |
| 1566 return E_INVALIDARG; | |
| 1567 } | 1390 } |
| 1568 | 1391 |
| 1569 STDMETHODIMP BrowserAccessibilityComWin::get_nSelectedCells(long* cell_count) { | 1392 STDMETHODIMP BrowserAccessibilityComWin::get_nSelectedCells(long* cell_count) { |
| 1570 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_CELLS); | 1393 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_SELECTED_CELLS); |
| 1571 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1394 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1572 return get_nSelectedChildren(cell_count); | 1395 if (!owner()) |
| 1396 return E_FAIL; |
| 1397 |
| 1398 return AXPlatformNodeWin::get_nSelectedCells(cell_count); |
| 1573 } | 1399 } |
| 1574 | 1400 |
| 1575 STDMETHODIMP BrowserAccessibilityComWin::get_selectedCells( | 1401 STDMETHODIMP BrowserAccessibilityComWin::get_selectedCells( |
| 1576 IUnknown*** cells, | 1402 IUnknown*** cells, |
| 1577 long* n_selected_cells) { | 1403 long* n_selected_cells) { |
| 1578 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_CELLS); | 1404 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_SELECTED_CELLS); |
| 1579 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1405 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1580 if (!owner()) | 1406 if (!owner()) |
| 1581 return E_FAIL; | 1407 return E_FAIL; |
| 1582 | 1408 |
| 1583 if (!cells || !n_selected_cells) | 1409 return AXPlatformNodeWin::get_selectedCells(cells, n_selected_cells); |
| 1584 return E_INVALIDARG; | |
| 1585 | |
| 1586 // TODO(dmazzoni): Implement this. | |
| 1587 *n_selected_cells = 0; | |
| 1588 return S_OK; | |
| 1589 } | 1410 } |
| 1590 | 1411 |
| 1591 STDMETHODIMP BrowserAccessibilityComWin::get_selectedColumns(long** columns, | 1412 STDMETHODIMP BrowserAccessibilityComWin::get_selectedColumns(long** columns, |
| 1592 long* n_columns) { | 1413 long* n_columns) { |
| 1593 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLE2_GET_SELECTED_COLUMNS); | 1414 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLE2_GET_SELECTED_COLUMNS); |
| 1594 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1415 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1595 if (!owner()) | 1416 if (!owner()) |
| 1596 return E_FAIL; | 1417 return E_FAIL; |
| 1597 | 1418 |
| 1598 if (!columns || !n_columns) | 1419 return AXPlatformNodeWin::get_selectedColumns(columns, n_columns); |
| 1599 return E_INVALIDARG; | |
| 1600 | |
| 1601 // TODO(dmazzoni): Implement this. | |
| 1602 *n_columns = 0; | |
| 1603 return S_OK; | |
| 1604 } | 1420 } |
| 1605 | 1421 |
| 1606 STDMETHODIMP BrowserAccessibilityComWin::get_selectedRows(long** rows, | 1422 STDMETHODIMP BrowserAccessibilityComWin::get_selectedRows(long** rows, |
| 1607 long* n_rows) { | 1423 long* n_rows) { |
| 1608 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLE2_GET_SELECTED_ROWS); | 1424 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLE2_GET_SELECTED_ROWS); |
| 1609 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1425 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1610 if (!owner()) | 1426 if (!owner()) |
| 1611 return E_FAIL; | 1427 return E_FAIL; |
| 1612 | 1428 |
| 1613 if (!rows || !n_rows) | 1429 return AXPlatformNodeWin::get_selectedRows(rows, n_rows); |
| 1614 return E_INVALIDARG; | |
| 1615 | |
| 1616 // TODO(dmazzoni): Implement this. | |
| 1617 *n_rows = 0; | |
| 1618 return S_OK; | |
| 1619 } | 1430 } |
| 1620 | 1431 |
| 1621 // | 1432 // |
| 1622 // IAccessibleTableCell methods. | 1433 // IAccessibleTableCell methods. |
| 1623 // | 1434 // |
| 1624 | 1435 |
| 1625 STDMETHODIMP BrowserAccessibilityComWin::get_columnExtent( | 1436 STDMETHODIMP BrowserAccessibilityComWin::get_columnExtent( |
| 1626 long* n_columns_spanned) { | 1437 long* n_columns_spanned) { |
| 1627 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_EXTENT); | 1438 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_EXTENT); |
| 1628 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1439 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1629 if (!owner()) | 1440 if (!owner()) |
| 1630 return E_FAIL; | 1441 return E_FAIL; |
| 1631 | 1442 |
| 1632 if (!n_columns_spanned) | 1443 return AXPlatformNodeWin::get_columnExtent(n_columns_spanned); |
| 1633 return E_INVALIDARG; | |
| 1634 | |
| 1635 *n_columns_spanned = GetTableColumnSpan(); | |
| 1636 return S_OK; | |
| 1637 } | 1444 } |
| 1638 | 1445 |
| 1639 STDMETHODIMP BrowserAccessibilityComWin::get_columnHeaderCells( | 1446 STDMETHODIMP BrowserAccessibilityComWin::get_columnHeaderCells( |
| 1640 IUnknown*** cell_accessibles, | 1447 IUnknown*** cell_accessibles, |
| 1641 long* n_column_header_cells) { | 1448 long* n_column_header_cells) { |
| 1642 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_HEADER_CELLS); | 1449 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_COLUMN_HEADER_CELLS); |
| 1643 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1450 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1644 if (!owner()) | 1451 if (!owner()) |
| 1645 return E_FAIL; | 1452 return E_FAIL; |
| 1646 | 1453 |
| 1647 if (!cell_accessibles || !n_column_header_cells) | 1454 return AXPlatformNodeWin::get_columnHeaderCells(cell_accessibles, |
| 1648 return E_INVALIDARG; | 1455 n_column_header_cells); |
| 1649 | |
| 1650 *n_column_header_cells = 0; | |
| 1651 auto* table = GetTable(); | |
| 1652 if (!table) { | |
| 1653 NOTREACHED(); | |
| 1654 return S_FALSE; | |
| 1655 } | |
| 1656 | |
| 1657 int column = GetTableColumn(); | |
| 1658 int columns = GetTableColumnCount(); | |
| 1659 int rows = GetTableRowCount(); | |
| 1660 if (columns <= 0 || rows <= 0 || column < 0 || column >= columns) | |
| 1661 return S_FALSE; | |
| 1662 | |
| 1663 for (int i = 0; i < rows; ++i) { | |
| 1664 auto* cell = GetTableCell(i, column); | |
| 1665 if (cell && cell->GetData().role == ui::AX_ROLE_COLUMN_HEADER) | |
| 1666 (*n_column_header_cells)++; | |
| 1667 } | |
| 1668 | |
| 1669 *cell_accessibles = static_cast<IUnknown**>( | |
| 1670 CoTaskMemAlloc((*n_column_header_cells) * sizeof(cell_accessibles[0]))); | |
| 1671 int index = 0; | |
| 1672 for (int i = 0; i < rows; ++i) { | |
| 1673 AXPlatformNodeBase* cell = GetTableCell(i, column); | |
| 1674 if (cell && cell->GetData().role == ui::AX_ROLE_COLUMN_HEADER) { | |
| 1675 auto* node_win = static_cast<AXPlatformNodeWin*>(cell); | |
| 1676 node_win->AddRef(); | |
| 1677 | |
| 1678 (*cell_accessibles)[index] = static_cast<IAccessible*>(node_win); | |
| 1679 ++index; | |
| 1680 } | |
| 1681 } | |
| 1682 | |
| 1683 return S_OK; | |
| 1684 } | 1456 } |
| 1685 | 1457 |
| 1686 STDMETHODIMP BrowserAccessibilityComWin::get_columnIndex(long* column_index) { | 1458 STDMETHODIMP BrowserAccessibilityComWin::get_columnIndex(long* column_index) { |
| 1687 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_COLUMN_INDEX); | 1459 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_COLUMN_INDEX); |
| 1688 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1460 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1689 if (!owner()) | 1461 if (!owner()) |
| 1690 return E_FAIL; | 1462 return E_FAIL; |
| 1691 | 1463 |
| 1692 if (!column_index) | 1464 return AXPlatformNodeWin::get_columnIndex(column_index); |
| 1693 return E_INVALIDARG; | |
| 1694 | |
| 1695 *column_index = GetTableColumn(); | |
| 1696 return S_OK; | |
| 1697 } | 1465 } |
| 1698 | 1466 |
| 1699 STDMETHODIMP BrowserAccessibilityComWin::get_rowExtent(long* n_rows_spanned) { | 1467 STDMETHODIMP BrowserAccessibilityComWin::get_rowExtent(long* n_rows_spanned) { |
| 1700 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_EXTENT); | 1468 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_EXTENT); |
| 1701 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1469 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1702 if (!owner()) | 1470 if (!owner()) |
| 1703 return E_FAIL; | 1471 return E_FAIL; |
| 1704 | 1472 |
| 1705 if (!n_rows_spanned) | 1473 return AXPlatformNodeWin::get_rowExtent(n_rows_spanned); |
| 1706 return E_INVALIDARG; | |
| 1707 | |
| 1708 *n_rows_spanned = GetTableRowSpan(); | |
| 1709 return S_OK; | |
| 1710 } | 1474 } |
| 1711 | 1475 |
| 1712 STDMETHODIMP BrowserAccessibilityComWin::get_rowHeaderCells( | 1476 STDMETHODIMP BrowserAccessibilityComWin::get_rowHeaderCells( |
| 1713 IUnknown*** cell_accessibles, | 1477 IUnknown*** cell_accessibles, |
| 1714 long* n_row_header_cells) { | 1478 long* n_row_header_cells) { |
| 1715 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_HEADER_CELLS); | 1479 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_HEADER_CELLS); |
| 1716 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1480 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1717 if (!owner()) | 1481 if (!owner()) |
| 1718 return E_FAIL; | 1482 return E_FAIL; |
| 1719 | 1483 |
| 1720 if (!cell_accessibles || !n_row_header_cells) | 1484 return AXPlatformNodeWin::get_rowHeaderCells(cell_accessibles, |
| 1721 return E_INVALIDARG; | 1485 n_row_header_cells); |
| 1722 | |
| 1723 *n_row_header_cells = 0; | |
| 1724 auto* table = GetTable(); | |
| 1725 if (!table) { | |
| 1726 NOTREACHED(); | |
| 1727 return S_FALSE; | |
| 1728 } | |
| 1729 | |
| 1730 int row = GetTableRow(); | |
| 1731 int columns = GetTableColumnCount(); | |
| 1732 int rows = GetTableRowCount(); | |
| 1733 if (columns <= 0 || rows <= 0 || row < 0 || row >= rows) | |
| 1734 return S_FALSE; | |
| 1735 | |
| 1736 for (int i = 0; i < columns; ++i) { | |
| 1737 auto* cell = GetTableCell(row, i); | |
| 1738 if (cell && cell->GetData().role == ui::AX_ROLE_ROW_HEADER) | |
| 1739 (*n_row_header_cells)++; | |
| 1740 } | |
| 1741 | |
| 1742 *cell_accessibles = static_cast<IUnknown**>( | |
| 1743 CoTaskMemAlloc((*n_row_header_cells) * sizeof(cell_accessibles[0]))); | |
| 1744 int index = 0; | |
| 1745 for (int i = 0; i < columns; ++i) { | |
| 1746 AXPlatformNodeBase* cell = GetTableCell(row, i); | |
| 1747 if (cell && cell->GetData().role == ui::AX_ROLE_ROW_HEADER) { | |
| 1748 auto* node_win = static_cast<AXPlatformNodeWin*>(cell); | |
| 1749 node_win->AddRef(); | |
| 1750 | |
| 1751 (*cell_accessibles)[index] = static_cast<IAccessible*>(node_win); | |
| 1752 ++index; | |
| 1753 } | |
| 1754 } | |
| 1755 | |
| 1756 return S_OK; | |
| 1757 } | 1486 } |
| 1758 | 1487 |
| 1759 STDMETHODIMP BrowserAccessibilityComWin::get_rowIndex(long* row_index) { | 1488 STDMETHODIMP BrowserAccessibilityComWin::get_rowIndex(long* row_index) { |
| 1760 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_ROW_INDEX); | 1489 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_ROW_INDEX); |
| 1761 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1490 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1762 if (!owner()) | 1491 if (!owner()) |
| 1763 return E_FAIL; | 1492 return E_FAIL; |
| 1764 | 1493 |
| 1765 if (!row_index) | 1494 return AXPlatformNodeWin::get_rowIndex(row_index); |
| 1766 return E_INVALIDARG; | |
| 1767 | |
| 1768 *row_index = GetTableRow(); | |
| 1769 return S_OK; | |
| 1770 } | 1495 } |
| 1771 | 1496 |
| 1772 STDMETHODIMP BrowserAccessibilityComWin::get_isSelected(boolean* is_selected) { | 1497 STDMETHODIMP BrowserAccessibilityComWin::get_isSelected(boolean* is_selected) { |
| 1773 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_IS_SELECTED); | 1498 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_TABLECELL_GET_IS_SELECTED); |
| 1774 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1499 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1775 if (!owner()) | 1500 if (!owner()) |
| 1776 return E_FAIL; | 1501 return E_FAIL; |
| 1777 | 1502 |
| 1778 if (!is_selected) | 1503 return AXPlatformNodeWin::get_isSelected(is_selected); |
| 1779 return E_INVALIDARG; | |
| 1780 | |
| 1781 *is_selected = false; | |
| 1782 return S_OK; | |
| 1783 } | 1504 } |
| 1784 | 1505 |
| 1785 STDMETHODIMP BrowserAccessibilityComWin::get_rowColumnExtents( | 1506 STDMETHODIMP BrowserAccessibilityComWin::get_rowColumnExtents( |
| 1786 long* row_index, | 1507 long* row_index, |
| 1787 long* column_index, | 1508 long* column_index, |
| 1788 long* row_extents, | 1509 long* row_extents, |
| 1789 long* column_extents, | 1510 long* column_extents, |
| 1790 boolean* is_selected) { | 1511 boolean* is_selected) { |
| 1791 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_COLUMN_EXTENTS); | 1512 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_ROW_COLUMN_EXTENTS); |
| 1792 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1513 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1793 if (!owner()) | 1514 if (!owner()) |
| 1794 return E_FAIL; | 1515 return E_FAIL; |
| 1795 | 1516 |
| 1796 if (!row_index || !column_index || !row_extents || !column_extents || | 1517 return AXPlatformNodeWin::get_rowColumnExtents( |
| 1797 !is_selected) { | 1518 row_index, column_index, row_extents, column_extents, is_selected); |
| 1798 return E_INVALIDARG; | |
| 1799 } | |
| 1800 | |
| 1801 *row_index = GetTableRow(); | |
| 1802 *column_index = GetTableColumn(); | |
| 1803 *row_extents = GetTableRowSpan(); | |
| 1804 *column_extents = GetTableColumnSpan(); | |
| 1805 *is_selected = false; // Not supported. | |
| 1806 | |
| 1807 return S_OK; | |
| 1808 } | 1519 } |
| 1809 | 1520 |
| 1810 STDMETHODIMP BrowserAccessibilityComWin::get_table(IUnknown** table) { | 1521 STDMETHODIMP BrowserAccessibilityComWin::get_table(IUnknown** table) { |
| 1811 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TABLE); | 1522 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_TABLE); |
| 1812 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); | 1523 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes); |
| 1813 if (!owner()) | 1524 if (!owner()) |
| 1814 return E_FAIL; | 1525 return E_FAIL; |
| 1815 | 1526 |
| 1816 if (!table) | 1527 return AXPlatformNodeWin::get_table(table); |
| 1817 return E_INVALIDARG; | |
| 1818 | |
| 1819 auto* find_table = GetTable(); | |
| 1820 if (!find_table) { | |
| 1821 *table = nullptr; | |
| 1822 return S_FALSE; | |
| 1823 } | |
| 1824 | |
| 1825 // The IAccessibleTable interface is still on the BrowserAccessibilityComWin | |
| 1826 // class. | |
| 1827 auto* node_win = static_cast<BrowserAccessibilityComWin*>(find_table); | |
| 1828 node_win->AddRef(); | |
| 1829 | |
| 1830 *table = static_cast<IAccessibleTable*>(node_win); | |
| 1831 return S_OK; | |
| 1832 } | 1528 } |
| 1833 | 1529 |
| 1834 // | 1530 // |
| 1835 // IAccessibleText methods. | 1531 // IAccessibleText methods. |
| 1836 // | 1532 // |
| 1837 | 1533 |
| 1838 STDMETHODIMP BrowserAccessibilityComWin::get_nCharacters(LONG* n_characters) { | 1534 STDMETHODIMP BrowserAccessibilityComWin::get_nCharacters(LONG* n_characters) { |
| 1839 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_CHARACTERS); | 1535 WIN_ACCESSIBILITY_API_HISTOGRAM(UMA_API_GET_N_CHARACTERS); |
| 1840 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | | 1536 AddAccessibilityModeFlags(kScreenReaderAndHTMLAccessibilityModes | |
| 1841 AccessibilityMode::kInlineTextBoxes); | 1537 AccessibilityMode::kInlineTextBoxes); |
| (...skipping 3534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5376 | 5072 |
| 5377 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( | 5073 BrowserAccessibilityComWin* ToBrowserAccessibilityComWin( |
| 5378 BrowserAccessibility* obj) { | 5074 BrowserAccessibility* obj) { |
| 5379 if (!obj || !obj->IsNative()) | 5075 if (!obj || !obj->IsNative()) |
| 5380 return nullptr; | 5076 return nullptr; |
| 5381 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM(); | 5077 auto* result = static_cast<BrowserAccessibilityWin*>(obj)->GetCOM(); |
| 5382 return result; | 5078 return result; |
| 5383 } | 5079 } |
| 5384 | 5080 |
| 5385 } // namespace content | 5081 } // namespace content |
| OLD | NEW |