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

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: Created 4 years, 1 month 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..d84abd4507ed8164a7e1a416e44d9e1dc95c0aeb 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXTableRow.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXTableRow.cpp
@@ -47,9 +47,25 @@ AXTableRow* AXTableRow::create(LayoutObject* layoutObject,
return new AXTableRow(layoutObject, axObjectCache);
}
-AccessibilityRole AXTableRow::determineAccessibilityRole() {
+void AXTableRow::addChildren()
+{
+ AXLayoutObject::addChildren();
+ int colIndex = ariaColumnIndex();
aboxhall 2016/11/29 17:36:54 An explanation of what is going on here would be h
dmazzoni 2016/11/30 22:48:17 I added a comment to clarify. It's so you don't ne
+ 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();
+ return AXLayoutObject::determineAccessibilityRole();
aboxhall 2016/11/29 17:36:54 Formatting weirdness?
dmazzoni 2016/11/30 22:48:17 Done.
if ((m_ariaRole = determineAriaRoleAttribute()) != UnknownRole)
return m_ariaRole;
@@ -96,6 +112,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())
return;

Powered by Google App Engine
This is Rietveld 408576698