Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(621)

Side by Side Diff: Source/web/WebAXObject.cpp

Issue 797223002: Provides an API to cope with table headers in Accessibility (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moved declarations to the section labeled "For a table" Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/modules/accessibility/AXTable.cpp ('k') | public/web/WebAXObject.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 { 1113 {
1114 if (isDetached()) 1114 if (isDetached())
1115 return WebAXObject(); 1115 return WebAXObject();
1116 1116
1117 if (!m_private->isTableRow()) 1117 if (!m_private->isTableRow())
1118 return WebAXObject(); 1118 return WebAXObject();
1119 1119
1120 return WebAXObject(toAXTableRow(m_private.get())->headerObject()); 1120 return WebAXObject(toAXTableRow(m_private.get())->headerObject());
1121 } 1121 }
1122 1122
1123 void WebAXObject::rowHeaders(WebVector<WebAXObject>& rowHeaderElements) const
1124 {
1125 if (isDetached())
1126 return;
1127
1128 if (!m_private->isAXTable())
1129 return;
1130
1131 AXObject::AccessibilityChildrenVector headers;
1132 toAXTable(m_private.get())->rowHeaders(headers);
1133
1134 size_t headerCount = headers.size();
1135 WebVector<WebAXObject> result(headerCount);
1136
1137 for (size_t i = 0; i < headerCount; i++)
1138 result[i] = WebAXObject(headers[i]);
1139
1140 rowHeaderElements.swap(result);
1141 }
1142
1123 unsigned WebAXObject::columnIndex() const 1143 unsigned WebAXObject::columnIndex() const
1124 { 1144 {
1125 if (isDetached()) 1145 if (isDetached())
1126 return 0; 1146 return 0;
1127 1147
1128 if (m_private->roleValue() != ColumnRole) 1148 if (m_private->roleValue() != ColumnRole)
1129 return 0; 1149 return 0;
1130 1150
1131 return toAXTableColumn(m_private.get())->columnIndex(); 1151 return toAXTableColumn(m_private.get())->columnIndex();
1132 } 1152 }
1133 1153
1134 WebAXObject WebAXObject::columnHeader() const 1154 WebAXObject WebAXObject::columnHeader() const
1135 { 1155 {
1136 if (isDetached()) 1156 if (isDetached())
1137 return WebAXObject(); 1157 return WebAXObject();
1138 1158
1139 if (m_private->roleValue() != ColumnRole) 1159 if (m_private->roleValue() != ColumnRole)
1140 return WebAXObject(); 1160 return WebAXObject();
1141 1161
1142 return WebAXObject(toAXTableColumn(m_private.get())->headerObject()); 1162 return WebAXObject(toAXTableColumn(m_private.get())->headerObject());
1143 } 1163 }
1144 1164
1165 void WebAXObject::columnHeaders(WebVector<WebAXObject>& columnHeaderElements) co nst
1166 {
1167 if (isDetached())
1168 return;
1169
1170 if (!m_private->isAXTable())
1171 return;
1172
1173 AXObject::AccessibilityChildrenVector headers;
1174 toAXTable(m_private.get())->columnHeaders(headers);
1175
1176 size_t headerCount = headers.size();
1177 WebVector<WebAXObject> result(headerCount);
1178
1179 for (size_t i = 0; i < headerCount; i++)
1180 result[i] = WebAXObject(headers[i]);
1181
1182 columnHeaderElements.swap(result);
1183 }
1184
1145 unsigned WebAXObject::cellColumnIndex() const 1185 unsigned WebAXObject::cellColumnIndex() const
1146 { 1186 {
1147 if (isDetached()) 1187 if (isDetached())
1148 return 0; 1188 return 0;
1149 1189
1150 if (!m_private->isTableCell()) 1190 if (!m_private->isTableCell())
1151 return 0; 1191 return 0;
1152 1192
1153 pair<unsigned, unsigned> columnRange; 1193 pair<unsigned, unsigned> columnRange;
1154 toAXTableCell(m_private.get())->columnIndexRange(columnRange); 1194 toAXTableCell(m_private.get())->columnIndexRange(columnRange);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 m_private = object; 1311 m_private = object;
1272 return *this; 1312 return *this;
1273 } 1313 }
1274 1314
1275 WebAXObject::operator WTF::PassRefPtr<AXObject>() const 1315 WebAXObject::operator WTF::PassRefPtr<AXObject>() const
1276 { 1316 {
1277 return m_private.get(); 1317 return m_private.get();
1278 } 1318 }
1279 1319
1280 } // namespace blink 1320 } // namespace blink
OLDNEW
« no previous file with comments | « Source/modules/accessibility/AXTable.cpp ('k') | public/web/WebAXObject.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698