AccessibilityTableRow.cpp [plain text]
#include "config.h"
#include "AccessibilityTableRow.h"
#include "AXObjectCache.h"
#include "AccessibilityTable.h"
#include "AccessibilityTableCell.h"
#include "HTMLNames.h"
#include "HTMLTableRowElement.h"
#include "RenderObject.h"
#include "RenderTableCell.h"
#include "RenderTableRow.h"
namespace WebCore {
using namespace HTMLNames;
AccessibilityTableRow::AccessibilityTableRow(RenderObject* renderer)
: AccessibilityRenderObject(renderer)
{
}
AccessibilityTableRow::~AccessibilityTableRow()
{
}
PassRefPtr<AccessibilityTableRow> AccessibilityTableRow::create(RenderObject* renderer)
{
return adoptRef(new AccessibilityTableRow(renderer));
}
AccessibilityRole AccessibilityTableRow::determineAccessibilityRole()
{
if (!isTableRow())
return AccessibilityRenderObject::determineAccessibilityRole();
m_ariaRole = determineAriaRoleAttribute();
AccessibilityRole ariaRole = ariaRoleAttribute();
if (ariaRole != UnknownRole)
return ariaRole;
return RowRole;
}
bool AccessibilityTableRow::isTableRow() const
{
AccessibilityObject* table = parentTable();
if (!table || !table->isAccessibilityTable())
return false;
return true;
}
AccessibilityObject* AccessibilityTableRow::observableObject() const
{
return parentTable();
}
bool AccessibilityTableRow::computeAccessibilityIsIgnored() const
{
AccessibilityObjectInclusion decision = defaultObjectInclusion();
if (decision == IncludeObject)
return false;
if (decision == IgnoreObject)
return true;
if (!isTableRow())
return AccessibilityRenderObject::computeAccessibilityIsIgnored();
return false;
}
AccessibilityTable* AccessibilityTableRow::parentTable() const
{
for (AccessibilityObject* parent = parentObject(); parent; parent = parent->parentObject()) {
if (parent->isTable())
return parent->isAccessibilityTable() ? toAccessibilityTable(parent) : 0;
}
return 0;
}
AccessibilityObject* AccessibilityTableRow::headerObject()
{
if (!m_renderer || !m_renderer->isTableRow())
return 0;
const auto& rowChildren = children();
if (!rowChildren.size())
return 0;
AccessibilityObject* cell = rowChildren[0].get();
if (!cell->isTableCell())
return 0;
RenderObject* cellRenderer = toAccessibilityTableCell(cell)->renderer();
if (!cellRenderer)
return 0;
Node* cellNode = cellRenderer->node();
if (!cellNode || !cellNode->hasTagName(thTag))
return 0;
return cell;
}
}