зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
ca5e36350c
Коммит
e6eca412ac
|
@ -62,9 +62,6 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsXULTreeAccessible, nsXULSelectableAccessible)
|
||||||
|
|
||||||
NS_IMETHODIMP nsXULTreeAccessible::GetAccState(PRUint32 *_retval)
|
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
|
// see if we are multiple select if so set ourselves as such
|
||||||
nsCOMPtr<nsIDOMElement> element (do_QueryInterface(mDOMNode));
|
nsCOMPtr<nsIDOMElement> element (do_QueryInterface(mDOMNode));
|
||||||
if (element) {
|
if (element) {
|
||||||
|
@ -75,7 +72,7 @@ NS_IMETHODIMP nsXULTreeAccessible::GetAccState(PRUint32 *_retval)
|
||||||
*_retval |= STATE_MULTISELECTABLE;
|
*_retval |= STATE_MULTISELECTABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
*_retval |= STATE_READONLY | STATE_FOCUSABLE;
|
*_retval |= STATE_READONLY;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -414,7 +411,7 @@ NS_IMETHODIMP nsXULTreeitemAccessible::GetAccState(PRUint32 *_retval)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(mTree && mTreeView, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
*_retval = STATE_FOCUSABLE;
|
*_retval = STATE_FOCUSABLE | STATE_SELECTABLE;
|
||||||
|
|
||||||
// get expanded/collapsed state
|
// get expanded/collapsed state
|
||||||
PRBool isContainer, isContainerOpen;
|
PRBool isContainer, isContainerOpen;
|
||||||
|
@ -597,6 +594,51 @@ NS_IMETHODIMP nsXULTreeitemAccessible::AccGetBounds(PRInt32 *x, PRInt32 *y, PRIn
|
||||||
return NS_OK;
|
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::nsXULTreeColumnsAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
|
nsXULTreeColumnsAccessible::nsXULTreeColumnsAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
|
||||||
|
|
|
@ -104,6 +104,9 @@ public:
|
||||||
|
|
||||||
NS_IMETHOD AccDoAction(PRUint8 index);
|
NS_IMETHOD AccDoAction(PRUint8 index);
|
||||||
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
NS_IMETHOD AccGetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
|
||||||
|
NS_IMETHOD AccRemoveSelection(void);
|
||||||
|
NS_IMETHOD AccTakeSelection(void);
|
||||||
|
NS_IMETHOD AccTakeFocus(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsCOMPtr<nsITreeBoxObject> mTree;
|
nsCOMPtr<nsITreeBoxObject> mTree;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче