Closed Bug 155866 Opened 22 years ago Closed 22 years ago

Implementation the nsIAccessibleTable for XUL tree table

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: zhayupeng, Assigned: zhayupeng)

References

Details

Attachments

(1 file, 5 obsolete files)

Since tree look like a table, we could implement nsIAccessibleTable interface
for it.
I will do this soon.
Blocks: 136513
Blocks: 136315
No longer blocks: 136513
Attached patch patch (obsolete) — Splinter Review
need r=
Kyle, I modified something in nsXULTreeitemAccessible to make it work for given
row and column index. Please check those changes are proper. Thanks
Summary: Implementation the nsIAccessibleTable for tree table → Implementation the nsIAccessibleTable for XUL tree table
Attached patch patch (minor change) (obsolete) — Splinter Review
Only change following mistakd:
"nsXULTreeAccessible::GetSelectionCount"
could be "GetSelectionCount" directly
Attachment #90914 - Attachment is obsolete: true
- In nsXULTreeAccessible::GetSelectedColumns
+  PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) * sizeof(PRInt32));
what will happen when (*aNumColumns) == 0 ?

- IsCellSelected() and IsRowSelected()
are totally same

- Please use nsString instead of nsAutoString as the class member

- In nsXULTreeAccessible::GetCaption
+  if (*aCaption) {
+    NS_IF_ADDREF(*aCaption);
+  }
redundant if ()

- Why don't use a default argument for nsXULTreeitemAccessible's constructor
instead of write two of them?

- Since the columns of tree are dynamic, how do you guarantee the each treecell
has an unique and constant id?
Status: NEW → ASSIGNED
QA Contact: dsirnapalli → jessie.li
>- In nsXULTreeAccessible::GetSelectedColumns
>+  PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) *
>sizeof(PRInt32));
>what will happen when (*aNumColumns) == 0 ?
I think outArray will be null

>- IsCellSelected() and IsRowSelected()
>are totally same
I will change code in IsCellSelected to call IsRowSelected. Because only one row
selected, the cell can be selected.

>- Please use nsString instead of nsAutoString as the class member
OK

>- In nsXULTreeAccessible::GetCaption
>+  if (*aCaption) {
>+    NS_IF_ADDREF(*aCaption);
>+  }
>redundant if ()
NS_IF_ADDREF is null safe? If so, I will remove the if.

>- Why don't use a default argument for nsXULTreeitemAccessible's constructor
>instead of write two of them?
Good idea, I will change.

>- Since the columns of tree are dynamic, how do you guarantee the each treecell
>has an unique and constant id?
I just use rowIndex and columnIndex, not ID. If the table changed, it should
file event to notify. And the caller can update the rowIndex and columnIndex for
the cell.

Thanks Kyle
> I think outArray will be null
then we shouldn't return NS_ERROR_OUT_OF_MEMORY for that case. return earlier 
if *aNumColumns == 0

> NS_IF_ADDREF is null safe? If so, I will remove the if.
NS_IF_ADDREF is null safe, but NS_ADDREF isn't.
>> I think outArray will be null
>then we shouldn't return NS_ERROR_OUT_OF_MEMORY for that case. return earlier 
>if *aNumColumns == 0
Sorry, I was wrong. If *aNumColumn is zero, outArray will not be null. I just
checked it.
Attached patch patch2 (obsolete) — Splinter Review
Add kyle's suggestion
Attachment #90916 - Attachment is obsolete: true
+  nsAutoString mSummary;
still wrong with nsAutoString.

+    *aNumColumns = 0;
+  }
+
+  PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) * sizeof
(PRInt32));
should return NS_OK after *aNumColumns = 0;
Attached patch patch(revise) (obsolete) — Splinter Review
>still wrong with nsAutoString.
Sorry, I corrected it in this version

>should return NS_OK after *aNumColumns = 0;
return earlier could be fine. more fast. But will not effect the result since
outArray will not be null if *aNumColumns is 0, so the function will not return
NS_ERROR_OUT_OF_MEMORY. But I added it in this patch anyway.
Attachment #91060 - Attachment is obsolete: true
Attachment #91071 - Flags: review+
Comment on attachment 91071 [details] [diff] [review]
patch(revise)

r=kyle
I found previou patch can't be applied on most recently trunk because the base
version I made the patch is old. So, this patch is based on most updated
version and you can patch it successful to local workspace.
Attachment #91071 - Attachment is obsolete: true
jst, could give sr=? Thanks
Comment on attachment 91321 [details] [diff] [review]
patch (no changes, just based on most updated version)

- In nsXULTreeAccessible::GetColumnHeader():

...
+  nsCOMPtr<nsIAccessible> acc;
+  rv = nsAccessible::GetAccFirstChild(getter_AddRefs(acc));
+  NS_ENSURE_TRUE(acc, NS_ERROR_FAILURE);
+
+  nsCOMPtr<nsIAccessibleTable> accTable(do_QueryInterface(acc, &rv));

Since you're not using rv after assigning into it when calling
GetAccFirstChild() there's no need to assign the return value into rv.

- In nsXULTreeAccessible::IsColumnSelected():

+  *_retval = PR_FALSE;
+  if (rows == selectedRows) {
+    *_retval = PR_TRUE;
+  }

How about *_retval = rows == selectedRows; to avoid double assignment?

- In nsXULTreeitemAccessible::GetAccNextSibling():

+  *aAccNextSibling = new nsXULTreeitemAccessible(...);
+  NS_ENSURE_TRUE(aAccNextSibling, NS_ERROR_OUT_OF_MEMORY);

You need an '*' in there, i.e. NS_ENSURE_TRUE(*aAccNext...), and for constency
you could do if (!*aAccNext...) return NS_ERR...; in stead...

Same problem in ::GetAccPreviousSibline().

sr=jst with the above fixed.

>+NS_IMETHODIMP nsXULTreeAccessible::GetRows(PRInt32 *aRows)
>+{
>+  NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
>+
>+  return mTreeView->GetRowCount(aRows);
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::GetRowHeader(nsIAccessibleTable **aRowHeader)
>+{
>+  // Row header not supported
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::GetSelectedColumns(PRUint32 *aNumColumns, PRInt32 **aColumns)
>+{
>+  // If all the row has been selected, then all the columns are selected.
>+  // Because we can't select a column alone.
>+  NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
>+  NS_ENSURE_ARG_POINTER(aNumColumns);
>+
>+  nsresult rv = NS_OK;
>+
>+  PRInt32 rows;
>+  rv = GetRows(&rows);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  PRInt32 selectedRows;
>+  rv = GetSelectionCount(&selectedRows);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  if (rows == selectedRows) {
>+    PRInt32 columns;
>+    rv = GetColumns(&columns);
>+    NS_ENSURE_SUCCESS(rv, rv);
>+
>+    *aNumColumns = columns;
>+  } else {
>+    *aNumColumns = 0;
>+    return rv;
>+  }
>+
>+  PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumColumns) * sizeof(PRInt32));
>+  NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
>+
>+  for (PRUint32 index = 0; index < *aNumColumns; index++) {
>+    outArray[index] = index;
>+  }
>+
>+  *aColumns = outArray;
>+  return rv;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::GetSelectedRows(PRUint32 *aNumRows, PRInt32 **aRows)
>+{
>+  NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
>+  NS_ENSURE_ARG_POINTER(aNumRows);
>+
>+  nsresult rv = NS_OK;
>+
>+  rv = GetSelectionCount((PRInt32 *)aNumRows);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  PRInt32 *outArray = (PRInt32 *)nsMemory::Alloc((*aNumRows) * sizeof(PRInt32));
>+  NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
>+
>+  nsCOMPtr<nsITreeSelection> selection;
>+  rv = mTree->GetSelection(getter_AddRefs(selection));
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  PRInt32 rowCount;
>+  rv = GetRows(&rowCount);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  PRBool isSelected;
>+  PRInt32 index, curr = 0;
>+  for (index = 0; index < rowCount; index++) {
>+    selection->IsSelected(index, &isSelected);
>+    if (isSelected) {
>+      outArray[curr++] = index;
>+    }
>+  }
>+
>+  *aRows = outArray;
>+  return rv;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::CellRefAt(PRInt32 aRow, PRInt32 aColumn, nsIAccessible **_retval)
>+{
>+  NS_ENSURE_TRUE(mDOMNode && mTree, NS_ERROR_FAILURE);
>+
>+  nsresult rv = NS_OK;
>+
>+  nsCOMPtr<nsIAccessibleTable> header;
>+  rv = GetColumnHeader(getter_AddRefs(header));
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  nsCOMPtr<nsIAccessible> column;
>+  rv = header->CellRefAt(0, aColumn, getter_AddRefs(column));
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  nsCOMPtr<nsIDOMNode> columnNode;
>+  rv = column->AccGetDOMNode(getter_AddRefs(columnNode));
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  nsCOMPtr<nsIDOMElement> columnElement(do_QueryInterface(columnNode, &rv));
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  nsAutoString id;
>+  rv = columnElement->GetAttribute(NS_LITERAL_STRING("id"), id);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  PRInt32 realColumn;
>+  rv = mTree->GetColumnIndex(id.get(), &realColumn);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  *_retval = new nsXULTreeitemAccessible(this, mDOMNode, mPresShell, aRow, realColumn);
>+  NS_ENSURE_TRUE(*_retval, NS_ERROR_OUT_OF_MEMORY);
>+
>+  NS_IF_ADDREF(*_retval);
>+
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::GetIndexAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
>+{
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  nsresult rv = NS_OK;
>+
>+  PRInt32 columns;
>+  rv = GetColumns(&columns);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  *_retval = aRow * columns + aColumn;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *_retval)
>+{
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  nsresult rv = NS_OK;
>+
>+  PRInt32 columns;
>+  rv = GetColumns(&columns);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  *_retval = aIndex % columns;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::GetRowAtIndex(PRInt32 aIndex, PRInt32 *_retval)
>+{
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  nsresult rv = NS_OK;
>+
>+  PRInt32 columns;
>+  rv = GetColumns(&columns);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  *_retval = aIndex / columns;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
>+{
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  *_retval = 1;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
>+{
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  *_retval = 1;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::GetColumnDescription(PRInt32 aColumn, nsAString & _retval)
>+{
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::GetRowDescription(PRInt32 aRow, nsAString & _retval)
>+{
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *_retval)
>+{
>+  // If all the row has been selected, then all the columns are selected.
>+  // Because we can't select a column alone.
>+  NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  nsresult rv = NS_OK;
>+
>+  PRInt32 rows;
>+  rv = GetRows(&rows);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  PRInt32 selectedRows;
>+  rv = GetSelectionCount(&selectedRows);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  *_retval = PR_FALSE;
>+  if (rows == selectedRows) {
>+    *_retval = PR_TRUE;
>+  }
>+
>+  return rv;
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::IsRowSelected(PRInt32 aRow, PRBool *_retval)
>+{
>+  NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
>+
>+  nsresult rv = NS_OK;
>+
>+  nsCOMPtr<nsITreeSelection> selection;
>+  rv = mTree->GetSelection(getter_AddRefs(selection));
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  return selection->IsSelected(aRow, _retval);
>+}
>+
>+NS_IMETHODIMP nsXULTreeAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn, PRBool *_retval)
>+{
>+  return IsRowSelected(aRow, _retval);
>+}
>+/* End Implementation of nsIAccessibleTable for nsXULTreeAccessible */
>+
> // ---------- nsXULTreeitemAccessible ---------- 
> 
>-nsXULTreeitemAccessible::nsXULTreeitemAccessible(nsIAccessible *aParent, nsIDOMNode *aDOMNode, nsIWeakReference *aShell, PRInt32 aRow):
>+nsXULTreeitemAccessible::nsXULTreeitemAccessible(nsIAccessible *aParent, nsIDOMNode *aDOMNode, nsIWeakReference *aShell, PRInt32 aRow, PRInt32 aColumn):
> nsLeafAccessible(aDOMNode, aShell)
> {
>   mParent = aParent;
>@@ -363,10 +654,15 @@
> 
>   // Since the real tree item does not correspond to any DOMNode, use the row index to distinguish each item
>   mRow = aRow;
>+  mColumnIndex = aColumn;
>   if (mTree) {
>-    PRInt32 keyColumn;
>-    mTree->GetKeyColumnIndex(&keyColumn);
>-    mTree->GetColumnID(keyColumn, mColumn);
>+    if (mColumnIndex < 0) {
>+      PRInt32 keyColumn;
>+      mTree->GetKeyColumnIndex(&keyColumn);
>+      mTree->GetColumnID(keyColumn, mColumn);
>+    } else {
>+      mTree->GetColumnID(aColumn, mColumn);
>+    }
>   }
> }
> 
>@@ -495,7 +791,8 @@
>   return NS_OK;
> }
> 
>-// Return the next row of tree (if any)
>+// Return the next row of tree if mColumnIndex < 0 (if any),
>+// otherwise return the next cell.
> NS_IMETHODIMP nsXULTreeitemAccessible::GetAccNextSibling(nsIAccessible **aAccNextSibling)
> {
>   *aAccNextSibling = nsnull;
>@@ -505,31 +802,76 @@
>   PRInt32 rowCount;
>   mTreeView->GetRowCount(&rowCount);
> 
>-  if (mRow < rowCount - 1) {
>+  if (mRow < rowCount - 1 && mColumnIndex < 0) {
>     *aAccNextSibling = new nsXULTreeitemAccessible(mParent, mDOMNode, mPresShell, mRow + 1);
>     if (! *aAccNextSibling)
>       return NS_ERROR_OUT_OF_MEMORY;
>     NS_ADDREF(*aAccNextSibling);
>+
>+    return NS_OK;
>   }
> 
>-  return NS_OK;
>+  nsresult rv = NS_OK;
>+  nsCOMPtr<nsIAccessibleTable> table(do_QueryInterface(mParent, &rv));
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  PRInt32 columnCount, row = mRow, column = mColumnIndex;
>+  rv = table->GetColumns(&columnCount);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  if (mColumnIndex < columnCount - 1) {
>+    column++;
>+  } else if (mRow < rowCount - 1) {
>+    column = 0;
>+    row++;
>+  }
>+
>+  *aAccNextSibling = new nsXULTreeitemAccessible(mParent, mDOMNode, mPresShell, row, column);
>+  NS_ENSURE_TRUE(aAccNextSibling, NS_ERROR_OUT_OF_MEMORY);
>+
>+  NS_ADDREF(*aAccNextSibling);
>+  
>+  return rv;
> }
> 
>-// Return the previous row of tree (if any)
>+// Return the previou row of tree if mColumnIndex < 0 (if any),
>+// otherwise return the previou cell.
> NS_IMETHODIMP nsXULTreeitemAccessible::GetAccPreviousSibling(nsIAccessible **aAccPreviousSibling)
> {
>   *aAccPreviousSibling = nsnull;
> 
>   NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
> 
>-  if (mRow > 0) {
>+  if (mRow > 0 && mColumnIndex < 0) {
>     *aAccPreviousSibling = new nsXULTreeitemAccessible(mParent, mDOMNode, mPresShell, mRow - 1);
>     if (! *aAccPreviousSibling)
>       return NS_ERROR_OUT_OF_MEMORY;
>     NS_ADDREF(*aAccPreviousSibling);
>+
>+    return NS_OK;
>   }
> 
>-  return NS_OK;
>+  nsresult rv = NS_OK;
>+  nsCOMPtr<nsIAccessibleTable> table(do_QueryInterface(mParent, &rv));
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  PRInt32 columnCount, row = mRow, column = mColumnIndex;
>+  rv = table->GetColumns(&columnCount);
>+  NS_ENSURE_SUCCESS(rv, rv);
>+
>+  if (mColumnIndex > 0) {
>+    column--;
>+  } else if (mRow > 0) {
>+    column = columnCount - 1;
>+    row--;
>+  }
>+
>+  *aAccPreviousSibling = new nsXULTreeitemAccessible(mParent, mDOMNode, mPresShell, row, column);
>+  NS_ENSURE_TRUE(aAccPreviousSibling, NS_ERROR_OUT_OF_MEMORY);
>+
>+  NS_ADDREF(*aAccPreviousSibling);
>+  
>+  return rv;
> }
> 
> NS_IMETHODIMP nsXULTreeitemAccessible::AccDoAction(PRUint8 index)
>@@ -644,9 +986,10 @@
> nsXULTreeColumnsAccessible::nsXULTreeColumnsAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
> nsAccessible(aDOMNode, aShell)
> {
>+  mCaption = nsnull;
> }
> 
>-NS_IMPL_ISUPPORTS_INHERITED0(nsXULTreeColumnsAccessible, nsAccessible)
>+NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeColumnsAccessible, nsAccessible, nsIAccessibleTable)
> 
> NS_IMETHODIMP nsXULTreeColumnsAccessible::GetAccState(PRUint32 *_retval)
> {
>@@ -716,6 +1059,156 @@
> 
>   return NS_ERROR_INVALID_ARG;
> }
>+
>+// Implementation of nsIAccessibleTable for nsXULTreeColumnsAccessible
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetCaption(nsIAccessible **aCaption)
>+{
>+  *aCaption = mCaption;
>+  NS_IF_ADDREF(*aCaption);
>+
>+  return NS_OK;
>+}
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::SetCaption(nsIAccessible *aCaption)
>+{
>+  mCaption = aCaption;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetSummary(nsAString &aSummary)
>+{
>+  aSummary = mSummary;
>+  return NS_OK;
>+}
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::SetSummary(const nsAString &aSummary)
>+{
>+  mSummary = aSummary;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetColumns(PRInt32 *aColumns)
>+{
>+  return GetAccChildCount(aColumns);
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetColumnHeader(nsIAccessibleTable * *aColumnHeader)
>+{
>+  // Column header not supported.
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetRows(PRInt32 *aRows)
>+{
>+  NS_ENSURE_ARG_POINTER(aRows);
>+
>+  *aRows = 1;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetRowHeader(nsIAccessibleTable * *aRowHeader)
>+{
>+  // Row header not supported.
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetSelectedColumns(PRUint32 *columnsSize, PRInt32 **columns)
>+{
>+  // Header can not be selected.
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetSelectedRows(PRUint32 *rowsSize, PRInt32 **rows)
>+{
>+  // Header can not be selected.
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::CellRefAt(PRInt32 aRow, PRInt32 aColumn, nsIAccessible **_retval)
>+{
>+  nsCOMPtr<nsIAccessible> next, temp;
>+  GetAccFirstChild(getter_AddRefs(next));
>+  NS_ENSURE_TRUE(next, NS_ERROR_FAILURE);
>+
>+  for (PRInt32 col = 0; col < aColumn; col++) {
>+    next->GetAccNextSibling(getter_AddRefs(temp));
>+    NS_ENSURE_TRUE(temp, NS_ERROR_FAILURE);
>+
>+    next = temp;
>+  }
>+
>+  *_retval = next;
>+  NS_IF_ADDREF(*_retval);
>+
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetIndexAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
>+{
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  *_retval = aColumn;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *_retval)
>+{
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  *_retval = aIndex;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetRowAtIndex(PRInt32 aIndex, PRInt32 *_retval)
>+{
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  *_retval = 0;
>
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
>+{
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  *_retval = 1;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
>+{
>+  NS_ENSURE_ARG_POINTER(_retval);
>+
>+  *_retval = 1;
>+  return NS_OK;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetColumnDescription(PRInt32 aColumn, nsAString & _retval)
>+{
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::GetRowDescription(PRInt32 aRow, nsAString & _retval)
>+{
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *_retval)
>+{
>+  // Header can not be selected.
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::IsRowSelected(PRInt32 aRow, PRBool *_retval)
>+{
>+  // Header can not be selected.
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+
>+NS_IMETHODIMP nsXULTreeColumnsAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn, PRBool *_retval)
>+{
>+  // Header can not be selected.
>+  return NS_ERROR_NOT_IMPLEMENTED;
>+}
>+// End Implementation of nsIAccessibleTable for nsXULTreeColumnsAccessible
> 
> // ---------- nsXULTreeColumnitemAccessible ----------
> 
>Index: nsXULTreeAccessible.h
>===================================================================
>RCS file: /cvsroot/mozilla/accessible/src/xul/nsXULTreeAccessible.h,v
>retrieving revision 1.3
>diff -u -r1.3 nsXULTreeAccessible.h
>--- nsXULTreeAccessible.h	2 Jul 2002 02:01:00 -0000	1.3
>+++ nsXULTreeAccessible.h	15 Jul 2002 06:27:30 -0000
>@@ -47,15 +47,18 @@
> #include "nsITreeBoxObject.h"
> #include "nsITreeView.h"
> #include "nsXULSelectAccessible.h"
>+#include "nsIAccessibleTable.h"
> 
> /*
>  * A class the represents the XUL Tree widget.
>  */
>-class nsXULTreeAccessible : public nsXULSelectableAccessible
>+class nsXULTreeAccessible : public nsXULSelectableAccessible,
>+                            public nsIAccessibleTable
> {
> public:
>   NS_DECL_ISUPPORTS_INHERITED
>   NS_DECL_NSIACCESSIBLESELECTABLE
>+  NS_DECL_NSIACCESSIBLETABLE
> 
>   nsXULTreeAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
>   virtual ~nsXULTreeAccessible() {}
>@@ -74,6 +77,8 @@
> private:
>   nsCOMPtr<nsITreeBoxObject> mTree;
>   nsCOMPtr<nsITreeView> mTreeView;
>+  nsCOMPtr<nsIAccessible> mCaption;
>+  nsString mSummary;
> 
>   NS_IMETHOD ChangeSelection(PRInt32 aIndex, PRUint8 aMethod, PRBool *aSelState);
> };
>@@ -86,7 +91,7 @@
> public:
>   NS_DECL_ISUPPORTS_INHERITED
> 
>-  nsXULTreeitemAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell, PRInt32 aRow);
>+  nsXULTreeitemAccessible(nsIAccessible *aParent, nsIDOMNode *aDOMNode, nsIWeakReference *aShell, PRInt32 aRow, PRInt32 aColumn = -1);
>   virtual ~nsXULTreeitemAccessible() {}
> 
>   /* ----- nsIAccessible ----- */
>@@ -111,14 +116,16 @@
> private:
>   nsCOMPtr<nsITreeBoxObject> mTree;
>   nsCOMPtr<nsITreeView> mTreeView;
>-  PRInt32  mRow;
>+  PRInt32  mRow, mColumnIndex;
>   nsString mColumn;
> };
> 
>-class nsXULTreeColumnsAccessible : public nsAccessible
>+class nsXULTreeColumnsAccessible : public nsAccessible,
>+                                   public nsIAccessibleTable
> {
> public:
>   NS_DECL_ISUPPORTS_INHERITED
>+  NS_DECL_NSIACCESSIBLETABLE
> 
>   nsXULTreeColumnsAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
>   virtual ~nsXULTreeColumnsAccessible() {}
>@@ -133,6 +140,10 @@
>   NS_IMETHOD GetAccPreviousSibling(nsIAccessible **_retval); 
> 
>   NS_IMETHOD AccDoAction(PRUint8 index);
>+
>+private:
>+  nsCOMPtr<nsIAccessible> mCaption;
>+  nsString mSummary;
> };
> 
> class nsXULTreeColumnitemAccessible : public nsLeafAccessible
Attachment #91321 - Flags: superreview+
Thanks!, jst
Attachment #91321 - Attachment is obsolete: true
Comment on attachment 91446 [details] [diff] [review]
patch with jst's comments

carry r,sr
Attachment #91446 - Flags: superreview+
Attachment #91446 - Flags: review+
Comment on attachment 91446 [details] [diff] [review]
patch with jst's comments

a=asa (on behalf of drivers) for checkin to 1.1
Attachment #91446 - Flags: approval+
checked in
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: