Bug 154196 nsIAccessible's accState returns wrong value for XUL Treeitem node

r=aaronl, sr=jag
override acctakefocus, acctakeselection, accremoveselection for treeitem
This commit is contained in:
kyle.yuan%sun.com 2002-07-02 02:01:00 +00:00
Родитель ca5e36350c
Коммит e6eca412ac
2 изменённых файлов: 50 добавлений и 5 удалений

Просмотреть файл

@ -62,9 +62,6 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsXULTreeAccessible, nsXULSelectableAccessible)
NS_IMETHODIMP nsXULTreeAccessible::GetAccState(PRUint32 *_retval)
{
// Get focus status from base class
nsAccessible::GetAccState(_retval);
// see if we are multiple select if so set ourselves as such
nsCOMPtr<nsIDOMElement> element (do_QueryInterface(mDOMNode));
if (element) {
@ -75,7 +72,7 @@ NS_IMETHODIMP nsXULTreeAccessible::GetAccState(PRUint32 *_retval)
*_retval |= STATE_MULTISELECTABLE;
}
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
*_retval |= STATE_READONLY;
return NS_OK;
}
@ -414,7 +411,7 @@ NS_IMETHODIMP nsXULTreeitemAccessible::GetAccState(PRUint32 *_retval)
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
*_retval = STATE_FOCUSABLE;
*_retval = STATE_FOCUSABLE | STATE_SELECTABLE;
// get expanded/collapsed state
PRBool isContainer, isContainerOpen;
@ -597,6 +594,51 @@ NS_IMETHODIMP nsXULTreeitemAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRIn
return NS_OK;
}
NS_IMETHODIMP nsXULTreeitemAccessible::AccRemoveSelection()
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
nsCOMPtr<nsITreeSelection> selection;
mTree->GetSelection(getter_AddRefs(selection));
if (selection) {
PRBool isSelected;
selection->IsSelected(mRow, &isSelected);
if (isSelected)
selection->ToggleSelect(mRow);
}
return NS_OK;
}
NS_IMETHODIMP nsXULTreeitemAccessible::AccTakeSelection()
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
nsCOMPtr<nsITreeSelection> selection;
mTree->GetSelection(getter_AddRefs(selection));
if (selection) {
PRBool isSelected;
selection->IsSelected(mRow, &isSelected);
if (! isSelected)
selection->ToggleSelect(mRow);
}
return NS_OK;
}
NS_IMETHODIMP nsXULTreeitemAccessible::AccTakeFocus()
{
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
nsCOMPtr<nsITreeSelection> selection;
mTree->GetSelection(getter_AddRefs(selection));
if (selection)
selection->SetCurrentIndex(mRow);
// focus event will be fired here
return nsAccessible::AccTakeFocus();
}
// ---------- nsXULTreeColumnsAccessible ----------
nsXULTreeColumnsAccessible::nsXULTreeColumnsAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):

Просмотреть файл

@ -104,6 +104,9 @@ public:
NS_IMETHOD AccDoAction(PRUint8 index);
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
NS_IMETHOD AccRemoveSelection(void);
NS_IMETHOD AccTakeSelection(void);
NS_IMETHOD AccTakeFocus(void);
private:
nsCOMPtr<nsITreeBoxObject> mTree;