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

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: Separated tableHeaders into rowHeaders and columnHeaders. Created 6 years 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
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 1094 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 { 1105 {
1106 if (isDetached()) 1106 if (isDetached())
1107 return WebAXObject(); 1107 return WebAXObject();
1108 1108
1109 if (!m_private->isTableRow()) 1109 if (!m_private->isTableRow())
1110 return WebAXObject(); 1110 return WebAXObject();
1111 1111
1112 return WebAXObject(toAXTableRow(m_private.get())->headerObject()); 1112 return WebAXObject(toAXTableRow(m_private.get())->headerObject());
1113 } 1113 }
1114 1114
1115 void WebAXObject::rowHeaders(WebVector<WebAXObject>& rowHeaderElements) const
1116 {
1117 if (isDetached())
1118 return;
1119
1120 if (!m_private->isAXTable())
1121 return;
1122
1123 AXObject::AccessibilityChildrenVector headers;
1124 toAXTable(m_private.get())->rowHeaders(headers);
1125
1126 size_t headerCount = headers.size();
1127 WebVector<WebAXObject> result(headerCount);
1128
1129 for (size_t i = 0; i < headerCount; i++)
1130 result[i] = WebAXObject(headers[i]);
1131
1132 rowHeaderElements.swap(result);
1133 }
1134
1115 unsigned WebAXObject::columnIndex() const 1135 unsigned WebAXObject::columnIndex() const
1116 { 1136 {
1117 if (isDetached()) 1137 if (isDetached())
1118 return 0; 1138 return 0;
1119 1139
1120 if (m_private->roleValue() != ColumnRole) 1140 if (m_private->roleValue() != ColumnRole)
1121 return 0; 1141 return 0;
1122 1142
1123 return toAXTableColumn(m_private.get())->columnIndex(); 1143 return toAXTableColumn(m_private.get())->columnIndex();
1124 } 1144 }
1125 1145
1126 WebAXObject WebAXObject::columnHeader() const 1146 WebAXObject WebAXObject::columnHeader() const
1127 { 1147 {
1128 if (isDetached()) 1148 if (isDetached())
1129 return WebAXObject(); 1149 return WebAXObject();
1130 1150
1131 if (m_private->roleValue() != ColumnRole) 1151 if (m_private->roleValue() != ColumnRole)
1132 return WebAXObject(); 1152 return WebAXObject();
1133 1153
1134 return WebAXObject(toAXTableColumn(m_private.get())->headerObject()); 1154 return WebAXObject(toAXTableColumn(m_private.get())->headerObject());
1135 } 1155 }
1136 1156
1157 void WebAXObject::columnHeaders(WebVector<WebAXObject>& columnHeaderElements) co nst
1158 {
1159 if (isDetached())
1160 return;
1161
1162 if (!m_private->isAXTable())
1163 return;
1164
1165 AXObject::AccessibilityChildrenVector headers;
1166 toAXTable(m_private.get())->columnHeaders(headers);
1167
1168 size_t headerCount = headers.size();
1169 WebVector<WebAXObject> result(headerCount);
1170
1171 for (size_t i = 0; i < headerCount; i++)
1172 result[i] = WebAXObject(headers[i]);
1173
1174 columnHeaderElements.swap(result);
1175 }
1176
1137 unsigned WebAXObject::cellColumnIndex() const 1177 unsigned WebAXObject::cellColumnIndex() const
1138 { 1178 {
1139 if (isDetached()) 1179 if (isDetached())
1140 return 0; 1180 return 0;
1141 1181
1142 if (!m_private->isTableCell()) 1182 if (!m_private->isTableCell())
1143 return 0; 1183 return 0;
1144 1184
1145 pair<unsigned, unsigned> columnRange; 1185 pair<unsigned, unsigned> columnRange;
1146 toAXTableCell(m_private.get())->columnIndexRange(columnRange); 1186 toAXTableCell(m_private.get())->columnIndexRange(columnRange);
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 m_private = object; 1303 m_private = object;
1264 return *this; 1304 return *this;
1265 } 1305 }
1266 1306
1267 WebAXObject::operator WTF::PassRefPtr<AXObject>() const 1307 WebAXObject::operator WTF::PassRefPtr<AXObject>() const
1268 { 1308 {
1269 return m_private.get(); 1309 return m_private.get();
1270 } 1310 }
1271 1311
1272 } // namespace blink 1312 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698