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

Unified Diff: third_party/WebKit/Source/modules/accessibility/AXTableRow.cpp

Issue 2539503003: ARIA 1.1: implementation for aria-col-* and aria-row-*. (Closed)
Patch Set: Address feedback Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/accessibility/AXTableRow.cpp
diff --git a/third_party/WebKit/Source/modules/accessibility/AXTableRow.cpp b/third_party/WebKit/Source/modules/accessibility/AXTableRow.cpp
index 48a180ea9f5bf0ebf6b15414443ca24dc5598ba0..72778a7ecf075c56b6654e855cc5bec89da15d01 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXTableRow.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXTableRow.cpp
@@ -47,6 +47,23 @@ AXTableRow* AXTableRow::create(LayoutObject* layoutObject,
return new AXTableRow(layoutObject, axObjectCache);
}
+void AXTableRow::addChildren() {
+ AXLayoutObject::addChildren();
+
+ // A row is allowed to have a column index that's then applied to all
aboxhall 2016/12/02 17:39:26 nit: this explanation may give the impression that
dmazzoni 2016/12/14 17:41:03 Done.
+ // cells within that row, if they're all contiguous.
+ int colIndex = ariaColumnIndex();
+ if (!colIndex)
+ return;
+
+ unsigned index = 0;
+ for (const auto& cell : children()) {
+ if (cell->isTableCell())
+ toAXTableCell(cell.get())->setARIAColIndexFromRow(colIndex + index);
+ index++;
+ }
+}
+
AccessibilityRole AXTableRow::determineAccessibilityRole() {
if (!isTableRow())
return AXLayoutObject::determineAccessibilityRole();
@@ -96,6 +113,22 @@ AXObject* AXTableRow::headerObject() {
return headers[0].get();
}
+unsigned AXTableRow::ariaColumnIndex() const {
+ const AtomicString& colIndexValue = getAttribute(aria_colindexAttr);
+ if (colIndexValue.toInt() >= 1)
+ return colIndexValue.toInt();
+
+ return 0;
+}
+
+unsigned AXTableRow::ariaRowIndex() const {
+ const AtomicString& rowIndexValue = getAttribute(aria_rowindexAttr);
+ if (rowIndexValue.toInt() >= 1)
+ return rowIndexValue.toInt();
+
+ return 0;
+}
+
void AXTableRow::headerObjectsForRow(AXObjectVector& headers) {
if (!m_layoutObject || !m_layoutObject->isTableRow())
return;
« no previous file with comments | « third_party/WebKit/Source/modules/accessibility/AXTableRow.h ('k') | third_party/WebKit/Source/web/WebAXObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698