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

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

Issue 862543003: Table headers are not retrieved properly by Accessibility API (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Minor fixes, correct comment and very small refactoring Created 5 years, 11 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/AXTableColumn.h ('k') | Source/modules/accessibility/AXTableRow.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/accessibility/AXTableColumn.cpp
diff --git a/Source/modules/accessibility/AXTableColumn.cpp b/Source/modules/accessibility/AXTableColumn.cpp
index 3c37232dfd693c63c7c9e17af3610a4710dcb6c0..2f8d5c7161d2337c782abd5952002b29300006fc 100644
--- a/Source/modules/accessibility/AXTableColumn.cpp
+++ b/Source/modules/accessibility/AXTableColumn.cpp
@@ -52,6 +52,7 @@ PassRefPtr<AXTableColumn> AXTableColumn::create(AXObjectCacheImpl* axObjectCache
return adoptRef(new AXTableColumn(axObjectCache));
}
+
void AXTableColumn::setParent(AXObject* parent)
{
AXMockObject::setParent(parent);
@@ -65,6 +66,39 @@ LayoutRect AXTableColumn::elementRect() const
return m_columnRect;
}
+void AXTableColumn::headerObjectsForColumn(AccessibilityChildrenVector& headers)
+{
+ if (!m_parent)
+ return;
+
+ RenderObject* renderer = m_parent->renderer();
+ if (!renderer || !renderer->isTable())
+ return;
+
+ RenderTable* table = toRenderTable(renderer);
+ RenderTableSection* tableSection = table->topSection();
+ for (; tableSection; tableSection = table->sectionBelow(tableSection, SkipEmptySections)) {
+ unsigned numRows = tableSection->numRows();
+ for (unsigned r = 0; r < numRows; r++) {
+ RenderTableCell* renderCell = tableSection->primaryCellAt(r, m_columnIndex);
+ if (!renderCell)
+ continue;
+
+ // Whenever cell's col is less then current column index, we've found the cell with colspan.
+ // We do not need to add this cell, it's already been added.
+ if (renderCell->col() < m_columnIndex)
+ continue;
+
+ AXObject* cell = axObjectCache()->getOrCreate(renderCell->node());
+ if (!cell)
+ continue;
+
+ if (toAXTableCell(cell)->scanToDecideHeaderRole() == ColumnHeaderRole)
+ headers.append(cell);
+ }
+ }
+}
+
AXObject* AXTableColumn::headerObject()
{
if (!m_parent)
« no previous file with comments | « Source/modules/accessibility/AXTableColumn.h ('k') | Source/modules/accessibility/AXTableRow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698