AXObject* AXTableColumn::headerObject() { AXObjectVector headers; headerObjectsForColumn(headers); if (!headers.size()) return 0; return headers[0].get(); }
void AXTableColumn::headerObjectsForColumn(AXObjectVector& headers) { if (!m_parent) return; LayoutObject* layoutObject = m_parent->getLayoutObject(); if (!layoutObject) return; if (!m_parent->isAXTable()) return; if (toAXTable(m_parent)->isAriaTable()) { for (const auto& cell : children()) { if (cell->roleValue() == ColumnHeaderRole) headers.append(cell); } return; } if (!layoutObject->isTable()) return; LayoutTable* table = toLayoutTable(layoutObject); LayoutTableSection* tableSection = table->topSection(); for (; tableSection; tableSection = table->sectionBelow(tableSection, SkipEmptySections)) { unsigned numCols = tableSection->numEffectiveColumns(); if (m_columnIndex >= numCols) continue; unsigned numRows = tableSection->numRows(); for (unsigned r = 0; r < numRows; r++) { LayoutTableCell* layoutCell = tableSection->primaryCellAt(r, m_columnIndex); if (!layoutCell) continue; AXObject* cell = axObjectCache().getOrCreate(layoutCell->node()); if (!cell || !cell->isTableCell() || headers.contains(cell)) continue; if (toAXTableCell(cell)->scanToDecideHeaderRole() == ColumnHeaderRole) headers.append(cell); } } }
void AXObject::ariaTreeRows(AXObjectVector& result) { for (const auto& child : children()) { // Add tree items as the rows. if (child->roleValue() == TreeItemRole) result.append(child); // Now see if this item also has rows hiding inside of it. child->ariaTreeRows(result); } }