Bug 396930 - expose defunct state for treeitem accessible, r=aaronlev, a=beltzner
authorsurkov.alexander@gmail.com
Fri, 14 Dec 2007 20:40:57 -0800
changeset 9111 686fb2458df2a8afba1d70df7e4e7debd53c3df9
parent 9110 28d1fc27a9e9cf5ba48534c33049ca0cf83d0672
child 9112 1149fb259443aa0ab44dc498432f92d7e2f0c4a7
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherderautoland@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaaronlev, beltzner
bugs396930
milestone1.9b3pre
Bug 396930 - expose defunct state for treeitem accessible, r=aaronlev, a=beltzner
accessible/src/xul/nsXULTreeAccessible.cpp
--- a/accessible/src/xul/nsXULTreeAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeAccessible.cpp
@@ -710,16 +710,27 @@ nsXULTreeitemAccessible::GetState(PRUint
   NS_ENSURE_ARG_POINTER(aState);
 
   *aState = 0;
   if (aExtraState)
     *aExtraState = 0;
 
   NS_ENSURE_TRUE(mColumn && mTree && mTreeView, NS_ERROR_FAILURE);
 
+  PRInt32 rowCount = 0;
+  rv = mTreeView->GetRowCount(&rowCount);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  if (mRow < 0 || mRow >= rowCount) {
+    if (aExtraState)
+      *aExtraState = nsIAccessibleStates::EXT_STATE_DEFUNCT;
+
+    return NS_OK;
+  }
+
   *aState = nsIAccessibleStates::STATE_FOCUSABLE |
             nsIAccessibleStates::STATE_SELECTABLE;
 
   // get expanded/collapsed state
   if (IsExpandable()) {
     PRBool isContainerOpen;
     mTreeView->IsContainerOpen(mRow, &isContainerOpen);
     *aState |= isContainerOpen? PRUint32(nsIAccessibleStates::STATE_EXPANDED):