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

Unified Diff: Source/modules/accessibility/AXTableCell.cpp

Issue 903833003: Return table headers from the table cell level. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/accessibility/AXTableCell.h ('k') | Source/web/WebAXObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXTableCell.cpp
diff --git a/Source/modules/accessibility/AXTableCell.cpp b/Source/modules/accessibility/AXTableCell.cpp
index e3f42df552b1ae166c10e2e7dd5952428fffa2b6..6c2cb62dcdd21e8b53adc75fe3a34b6b61887ee8 100644
--- a/Source/modules/accessibility/AXTableCell.cpp
+++ b/Source/modules/accessibility/AXTableCell.cpp
@@ -31,7 +31,7 @@
#include "core/layout/LayoutTableCell.h"
#include "modules/accessibility/AXObjectCacheImpl.h"
-
+#include "modules/accessibility/AXTable.h"
namespace blink {
@@ -160,6 +160,52 @@ AccessibilityRole AXTableCell::determineAccessibilityRole()
return scanToDecideHeaderRole();
}
+void AXTableCell::rowHeadersForCell(AccessibilityChildrenVector& headers)
+{
+ AXObject* parent = parentTable();
+ if (!parent || !parent->isAXTable())
+ return;
+
+ AXTable* parentTable = toAXTable(parent);
+
+ pair<unsigned, unsigned> rowRange;
+ rowIndexRange(rowRange);
+
+ pair<unsigned, unsigned> columnRange;
+ columnIndexRange(columnRange);
+
+ for (unsigned i = 0; i < columnRange.first; i++) {
+ AXTableCell* cell = parentTable->cellForColumnAndRow(i, rowRange.first);
+ if (!cell || !cell->isTableCell() || cell == this)
+ continue;
+ if (cell->scanToDecideHeaderRole() == RowHeaderRole)
+ headers.append(cell);
+ }
+}
+
+void AXTableCell::columnHeadersForCell(AccessibilityChildrenVector& headers)
+{
+ AXObject* parent = parentTable();
+ if (!parent || !parent->isAXTable())
+ return;
+
+ AXTable* parentTable = toAXTable(parent);
+
+ pair<unsigned, unsigned> rowRange;
+ rowIndexRange(rowRange);
+
+ pair<unsigned, unsigned> columnRange;
+ columnIndexRange(columnRange);
+
+ for (unsigned i = 0; i < rowRange.first; i++) {
+ AXTableCell* cell = parentTable->cellForColumnAndRow(columnRange.first, i);
+ if (!cell || !cell->isTableCell() || headers.contains(cell) || cell == this)
+ continue;
+ if (cell->scanToDecideHeaderRole() == ColumnHeaderRole)
+ headers.append(cell);
+ }
+}
+
void AXTableCell::rowIndexRange(pair<unsigned, unsigned>& rowRange)
{
if (!m_renderer || !m_renderer->isTableCell())
« no previous file with comments | « Source/modules/accessibility/AXTableCell.h ('k') | Source/web/WebAXObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698