зеркало из https://github.com/mozilla/pjs.git
Bug 390154. Prune subtrees consistently across platform accessibility APIs for a number of widgets that we will impose a 'must be leaf' rule, to simplify compatibility across a number of assistive technologies which expect that. r=ginn.chen, a=dsicore
This commit is contained in:
Родитель
42c7f1c4aa
Коммит
77ef333b0c
|
@ -1550,8 +1550,3 @@ nsAccessibleWrap::FireAtkShowHideEvent(nsIAccessibleEvent *aEvent,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
PRBool nsAccessibleWrap::MustPrune(nsIAccessible *aAccessible)
|
||||
{
|
||||
PRUint32 role = Role(aAccessible);
|
||||
return role == nsIAccessibleRole::ROLE_GRAPHIC;
|
||||
}
|
||||
|
|
|
@ -115,9 +115,6 @@ public:
|
|||
return returnedString.get();
|
||||
}
|
||||
|
||||
// Should this accessible be allowed to have any ATK children
|
||||
static PRBool MustPrune(nsIAccessible *aAccessible);
|
||||
|
||||
protected:
|
||||
nsresult FireAtkStateChangeEvent(nsIAccessibleEvent *aEvent,
|
||||
AtkObject *aObject);
|
||||
|
|
|
@ -3273,3 +3273,16 @@ nsAccessible::GetAttrValue(PRUint32 aNameSpaceID, nsIAtom *aName,
|
|||
return result;
|
||||
}
|
||||
|
||||
PRBool nsAccessible::MustPrune(nsIAccessible *aAccessible)
|
||||
{
|
||||
PRUint32 role = Role(aAccessible);
|
||||
return role == nsIAccessibleRole::ROLE_MENUITEM ||
|
||||
role == nsIAccessibleRole::ROLE_ENTRY ||
|
||||
role == nsIAccessibleRole::ROLE_PASSWORD_TEXT ||
|
||||
role == nsIAccessibleRole::ROLE_PUSHBUTTON ||
|
||||
role == nsIAccessibleRole::ROLE_TOGGLE_BUTTON ||
|
||||
role == nsIAccessibleRole::ROLE_GRAPHIC ||
|
||||
role == nsIAccessibleRole::ROLE_SLIDER ||
|
||||
role == nsIAccessibleRole::ROLE_PROGRESSBAR ||
|
||||
role == nsIAccessibleRole::ROLE_SEPARATOR;
|
||||
}
|
||||
|
|
|
@ -155,6 +155,10 @@ public:
|
|||
static PRInt32 TextLength(nsIAccessible *aAccessible); // Returns -1 on failure
|
||||
static PRBool IsLeaf(nsIAccessible *aAcc) { PRInt32 numChildren; aAcc->GetChildCount(&numChildren); return numChildren > 0; }
|
||||
static PRBool IsNodeRelevant(nsIDOMNode *aNode); // Is node something that could have an attached accessible
|
||||
/**
|
||||
* When exposing to platform accessibility APIs, should the children be pruned off?
|
||||
*/
|
||||
static PRBool MustPrune(nsIAccessible *aAccessible);
|
||||
|
||||
already_AddRefed<nsIAccessible> GetParent() {
|
||||
nsIAccessible *parent = nsnull;
|
||||
|
|
|
@ -79,19 +79,6 @@ class nsAccessibleWrap : public nsAccessible
|
|||
|
||||
NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent);
|
||||
|
||||
// we'll flatten buttons and checkboxes. usually they have a text node
|
||||
// child, that is their title. Works in conjunction with IsPruned() below.
|
||||
// XXX There is no IsPruned() method, so what does that comment mean?
|
||||
PRBool IsFlat() {
|
||||
PRUint32 role = Role(this);
|
||||
return (role == nsIAccessibleRole::ROLE_CHECKBUTTON ||
|
||||
role == nsIAccessibleRole::ROLE_PUSHBUTTON ||
|
||||
role == nsIAccessibleRole::ROLE_TOGGLE_BUTTON ||
|
||||
role == nsIAccessibleRole::ROLE_SPLITBUTTON ||
|
||||
role == nsIAccessibleRole::ROLE_ENTRY ||
|
||||
role == nsIAccessibleRole::ROLE_GRAPHIC);
|
||||
}
|
||||
|
||||
// ignored means that the accessible might still have children, but is not displayed
|
||||
// to the user. it also has no native accessible object represented for it.
|
||||
PRBool IsIgnored();
|
||||
|
@ -119,10 +106,11 @@ class nsAccessibleWrap : public nsAccessible
|
|||
|
||||
nsCOMPtr<nsIAccessible> curParent = GetParent();
|
||||
while (curParent) {
|
||||
nsAccessibleWrap *ancestorWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)curParent.get());
|
||||
if (ancestorWrap->IsFlat())
|
||||
if (MustPrune(curParent))
|
||||
return PR_TRUE;
|
||||
curParent = static_cast<nsAccessibleWrap*>((nsIAccessible*)curParent.get())->GetParent();
|
||||
nsCOMPtr<nsIAccessible> newParent;
|
||||
curParent->GetParent(getter_AddRefs(newParent));
|
||||
curParent.swap(newParent);
|
||||
}
|
||||
// no parent was flat
|
||||
return PR_FALSE;
|
||||
|
|
|
@ -1715,14 +1715,3 @@ void nsAccessibleWrap::UpdateSystemCaret()
|
|||
::DeleteObject(caretBitMap);
|
||||
}
|
||||
}
|
||||
|
||||
PRBool nsAccessibleWrap::MustPrune(nsIAccessible *aAccessible)
|
||||
{
|
||||
PRUint32 role = Role(aAccessible);
|
||||
return role == nsIAccessibleRole::ROLE_MENUITEM ||
|
||||
role == nsIAccessibleRole::ROLE_ENTRY ||
|
||||
role == nsIAccessibleRole::ROLE_PASSWORD_TEXT ||
|
||||
role == nsIAccessibleRole::ROLE_PUSHBUTTON ||
|
||||
role == nsIAccessibleRole::ROLE_TOGGLE_BUTTON ||
|
||||
role == nsIAccessibleRole::ROLE_GRAPHIC;
|
||||
}
|
||||
|
|
|
@ -322,9 +322,6 @@ protected:
|
|||
// nsIEnumVariant::Reset(), Skip() and Next().
|
||||
PRUint16 mEnumVARIANTPosition;
|
||||
|
||||
// Should this accessible be allowed to have any MSAA children
|
||||
static PRBool MustPrune(nsIAccessible *aAccessible);
|
||||
|
||||
enum navRelations {
|
||||
NAVRELATION_CONTROLLED_BY = 0x1000,
|
||||
NAVRELATION_CONTROLLER_FOR = 0x1001,
|
||||
|
|
Загрузка…
Ссылка в новой задаче