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

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

Issue 1547643002: ARIA 1.1: implementation for aria-col-* and aria-row-*. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds MODULES_EXPORT Created 5 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 18a59e8c14cc7fff136a023fc3dc5ac2587c6e93..7db69894aa8444c7df50ae562124c314e881bda1 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXTableRow.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXTableRow.cpp
@@ -51,6 +51,21 @@ AXTableRow* AXTableRow::create(LayoutObject* layoutObject, AXObjectCacheImpl& ax
return new AXTableRow(layoutObject, axObjectCache);
}
+void AXTableRow::addChildren()
+{
+ AXLayoutObject::addChildren();
+ 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())
@@ -104,6 +119,24 @@ 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())

Powered by Google App Engine
This is Rietveld 408576698