void AccessibilityARIAGridRow::disclosedRows(AccessibilityChildrenVector& disclosedRows) { // The contiguous disclosed rows will be the rows in the table that // have an aria-level of plus 1 from this row. AccessibilityObject* parent = parentObjectUnignored(); if (!is<AccessibilityTable>(*parent) || !downcast<AccessibilityTable>(*parent).isExposableThroughAccessibility()) return; // Search for rows that match the correct level. // Only take the subsequent rows from this one that are +1 from this row's level. int index = rowIndex(); if (index < 0) return; unsigned level = hierarchicalLevel(); auto& allRows = downcast<AccessibilityTable>(*parent).rows(); int rowCount = allRows.size(); for (int k = index + 1; k < rowCount; ++k) { AccessibilityObject* row = allRows[k].get(); // Stop at the first row that doesn't match the correct level. if (row->hierarchicalLevel() != level + 1) break; disclosedRows.append(row); } }
AccessibilityObject* AccessibilityARIAGridRow::disclosedByRow() const { // The row that discloses this one is the row in the table // that is aria-level subtract 1 from this row. AccessibilityObject* parent = parentObjectUnignored(); if (!is<AccessibilityTable>(*parent) || !downcast<AccessibilityTable>(*parent).isExposableThroughAccessibility()) return nullptr; // If the level is 1 or less, than nothing discloses this row. unsigned level = hierarchicalLevel(); if (level <= 1) return nullptr; // Search for the previous row that matches the correct level. int index = rowIndex(); auto& allRows = downcast<AccessibilityTable>(parent)->rows(); int rowCount = allRows.size(); if (index >= rowCount) return nullptr; for (int k = index - 1; k >= 0; --k) { AccessibilityObject* row = allRows[k].get(); if (row->hierarchicalLevel() == level - 1) return row; } return nullptr; }
AccessibilityObject* AccessibilityARIAGridRow::disclosedByRow() const { // The row that discloses this one is the row in the table // that is aria-level subtract 1 from this row. AccessibilityObject* parent = parentObjectUnignored(); if (!parent || !parent->isDataTable()) return 0; // If the level is 1 or less, than nothing discloses this row. unsigned level = hierarchicalLevel(); if (level <= 1) return 0; // Search for the previous row that matches the correct level. int index = rowIndex(); AccessibilityChildrenVector& allRows = static_cast<AccessibilityTable*>(parent)->rows(); int rowCount = allRows.size(); if (index >= rowCount) return 0; for (int k = index - 1; k >= 0; --k) { AccessibilityObject* row = allRows[k].get(); if (row->hierarchicalLevel() == level - 1) return row; } return 0; }