diff --git a/accessible/src/atk/nsXULTreeAccessibleWrap.cpp b/accessible/src/atk/nsXULTreeAccessibleWrap.cpp index 2fa0a60557f8..a506874759c7 100644 --- a/accessible/src/atk/nsXULTreeAccessibleWrap.cpp +++ b/accessible/src/atk/nsXULTreeAccessibleWrap.cpp @@ -217,43 +217,23 @@ NS_IMETHODIMP nsXULTreeAccessibleWrap::GetSelectedRows(PRUint32 *aNumRows, PRInt return rv; } -NS_IMETHODIMP nsXULTreeAccessibleWrap::CellRefAt(PRInt32 aRow, PRInt32 aColumn, nsIAccessible **_retval) +NS_IMETHODIMP nsXULTreeAccessibleWrap::CellRefAt(PRInt32 aRow, PRInt32 aColumn, nsIAccessible **aAccessibleCell) { NS_ENSURE_TRUE(mDOMNode && mTree, NS_ERROR_FAILURE); nsresult rv = NS_OK; - nsCOMPtr header; - rv = GetColumnHeader(getter_AddRefs(header)); + PRInt32 index; + rv = GetIndexAt(aRow, aColumn, &index); NS_ENSURE_SUCCESS(rv, rv); - nsCOMPtr column; - rv = header->CellRefAt(0, aColumn, getter_AddRefs(column)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr accessNode(do_QueryInterface(column)); - NS_ASSERTION(accessNode, "Unable to QI to nsIAccessNode"); - nsCOMPtr columnNode; - rv = accessNode->GetDOMNode(getter_AddRefs(columnNode)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr columnElement(do_QueryInterface(columnNode, &rv)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr treeColumns; - rv = mTree->GetColumns(getter_AddRefs(treeColumns)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr treeColumn; - rv = treeColumns->GetColumnFor(columnElement, getter_AddRefs(treeColumn)); - NS_ENSURE_SUCCESS(rv, rv); - - return GetCachedTreeitemAccessible(aRow, treeColumn, _retval); + return GetChildAt(index, aAccessibleCell); } -NS_IMETHODIMP nsXULTreeAccessibleWrap::GetIndexAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval) +NS_IMETHODIMP nsXULTreeAccessibleWrap::GetIndexAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *aIndex) { - NS_ENSURE_ARG_POINTER(_retval); + NS_ENSURE_TRUE(mDOMNode, NS_ERROR_FAILURE); + NS_ENSURE_ARG_POINTER(aIndex); nsresult rv = NS_OK; @@ -261,7 +241,9 @@ NS_IMETHODIMP nsXULTreeAccessibleWrap::GetIndexAt(PRInt32 aRow, PRInt32 aColumn, rv = GetColumns(&columns); NS_ENSURE_SUCCESS(rv, rv); - *_retval = aRow * columns + aColumn; + PRInt32 treeCols; + nsAccessible::GetChildCount(&treeCols); + *aIndex = aRow * columns + aColumn + treeCols; return NS_OK; }