AccessibilityObject* AccessibilityARIAGridRow::parentTable() const
{
    // The parent table might not be the direct ancestor of the row unfortunately. ARIA states that role="grid" should
    // only have "row" elements, but if not, we still should handle it gracefully by finding the right table.
    for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
        // The parent table for an ARIA grid row should be an ARIA table.
        if (parent->isTable() && parent->isAccessibilityTable() && toAccessibilityTable(parent)->isAriaTable())
            return parent;
    }
    
        return 0;
}
void AccessibilityTableHeaderContainer::addChildren()
{
    ASSERT(!m_haveChildren); 
    
    m_haveChildren = true;
    if (!m_parent || !m_parent->isAccessibilityTable())
        return;
    
    toAccessibilityTable(m_parent)->columnHeaders(m_children);
    
    for (const auto& child : m_children)
        m_headerRect.unite(child->elementRect());
}