NS_IMETHODIMP nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex) { NS_ENSURE_ARG_POINTER(aColumnIndex); *aColumnIndex = -1; if (IsDefunct()) return NS_ERROR_FAILURE; *aColumnIndex = 0; nsCOMPtr<nsIAccessible> prevCell, tmpAcc; GetPreviousSibling(getter_AddRefs(prevCell)); while (prevCell) { PRUint32 role = nsAccUtils::Role(prevCell); if (role == nsIAccessibleRole::ROLE_GRID_CELL || role == nsIAccessibleRole::ROLE_ROWHEADER || role == nsIAccessibleRole::ROLE_COLUMNHEADER) (*aColumnIndex)++; prevCell->GetPreviousSibling(getter_AddRefs(tmpAcc)); tmpAcc.swap(prevCell); } return NS_OK; }
already_AddRefed<Element> BoxObject::GetPreviousSibling() { nsCOMPtr<nsIDOMElement> el; GetPreviousSibling(getter_AddRefs(el)); nsCOMPtr<Element> ret(do_QueryInterface(el)); return ret.forget(); }
NS_IMETHODIMP BoxObject::GetLastChild(nsIDOMElement * *aLastVisibleChild) { *aLastVisibleChild = nullptr; nsIFrame* frame = GetFrame(false); if (!frame) return NS_OK; return GetPreviousSibling(frame, nullptr, aLastVisibleChild); }
NS_IMETHODIMP nsBoxObject::GetLastChild(nsIDOMElement * *aLastVisibleChild) { *aLastVisibleChild = nsnull; nsIFrame* frame = GetFrame(PR_FALSE); if (!frame) return NS_OK; return GetPreviousSibling(frame, nsnull, aLastVisibleChild); }
NS_IMETHODIMP BoxObject::GetPreviousSibling(nsIDOMElement **aPreviousOrdinalSibling) { *aPreviousOrdinalSibling = nullptr; nsIFrame* frame = GetFrame(false); if (!frame) return NS_OK; nsIFrame* parentFrame = frame->GetParent(); if (!parentFrame) return NS_OK; return GetPreviousSibling(parentFrame, frame, aPreviousOrdinalSibling); }