void AccessibilityTableCell::columnHeaders(AccessibilityChildrenVector& headers) { AccessibilityTable* parent = parentTable(); if (!parent) return; std::pair<unsigned, unsigned> rowRange; rowIndexRange(rowRange); std::pair<unsigned, unsigned> colRange; columnIndexRange(colRange); for (unsigned row = 0; row < rowRange.first; row++) { AccessibilityTableCell* tableCell = parent->cellForColumnAndRow(colRange.first, row); if (tableCell == this || headers.contains(tableCell)) continue; std::pair<unsigned, unsigned> childRowRange; tableCell->rowIndexRange(childRowRange); const AtomicString& scope = tableCell->getAttribute(scopeAttr); if (scope == "col" || tableCell->isTableHeaderCell()) headers.append(tableCell); else if (scope == "colgroup" && isTableCellInSameColGroup(tableCell)) headers.append(tableCell); } }
void AccessibilityTableCell::columnHeaders(AccessibilityChildrenVector& headers) { AccessibilityTable* parent = parentTable(); if (!parent) return; // Choose columnHeaders as the place where the "headers" attribute is reported. ariaElementsFromAttribute(headers, headersAttr); // If the headers attribute returned valid values, then do not further search for column headers. if (!headers.isEmpty()) return; std::pair<unsigned, unsigned> rowRange; rowIndexRange(rowRange); std::pair<unsigned, unsigned> colRange; columnIndexRange(colRange); for (unsigned row = 0; row < rowRange.first; row++) { AccessibilityTableCell* tableCell = parent->cellForColumnAndRow(colRange.first, row); if (!tableCell || tableCell == this || headers.contains(tableCell)) continue; std::pair<unsigned, unsigned> childRowRange; tableCell->rowIndexRange(childRowRange); const AtomicString& scope = tableCell->getAttribute(scopeAttr); if (scope == "col" || tableCell->isTableHeaderCell()) headers.append(tableCell); else if (scope == "colgroup" && isTableCellInSameColGroup(tableCell)) headers.append(tableCell); } }