void
XULListCellAccessible::ColHeaderCells(nsTArray<Accessible*>* aCells)
{
  TableAccessible* table = Table();
  NS_ASSERTION(table, "cell not in a table!");
  if (!table)
    return;

  // Get column header cell from XUL listhead.
  Accessible* list = nullptr;

  Accessible* tableAcc = table->AsAccessible();
  uint32_t tableChildCount = tableAcc->ChildCount();
  for (uint32_t childIdx = 0; childIdx < tableChildCount; childIdx++) {
    Accessible* child = tableAcc->GetChildAt(childIdx);
    if (child->Role() == roles::LIST) {
      list = child;
      break;
    }
  }

  if (list) {
    Accessible* headerCell = list->GetChildAt(ColIdx());
    if (headerCell) {
      aCells->AppendElement(headerCell);
      return;
    }
  }

  // No column header cell from XUL markup, try to get it from ARIA markup.
  TableCellAccessible::ColHeaderCells(aCells);
}
GroupPos ARIAGridCellAccessible::GroupPosition() {
  int32_t count = 0, index = 0;
  TableAccessible* table = Table();
  if (table &&
      nsCoreUtils::GetUIntAttr(table->AsAccessible()->GetContent(),
                               nsGkAtoms::aria_colcount, &count) &&
      nsCoreUtils::GetUIntAttr(mContent, nsGkAtoms::aria_colindex, &index)) {
    return GroupPos(0, index, count);
  }

  return GroupPos();
}
NS_IMETHODIMP
xpcAccessibleTableCell::GetTable(nsIAccessibleTable** aTable)
{
  NS_ENSURE_ARG_POINTER(aTable);
  *aTable = nullptr;

  if (!Intl())
    return NS_ERROR_FAILURE;

  TableAccessible* table = Intl()->Table();
  if (!table)
    return NS_ERROR_FAILURE;

  nsCOMPtr<nsIAccessibleTable> xpcTable =
    do_QueryInterface(static_cast<nsIAccessible*>(ToXPC(table->AsAccessible())));
  xpcTable.forget(aTable);
  return NS_OK;
}