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:
aaronleventhal%moonset.net 2007-08-15 21:02:32 +00:00
Родитель 42c7f1c4aa
Коммит 77ef333b0c
7 изменённых файлов: 22 добавлений и 39 удалений

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

@ -1550,8 +1550,3 @@ nsAccessibleWrap::FireAtkShowHideEvent(nsIAccessibleEvent *aEvent,
return NS_OK; 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(); return returnedString.get();
} }
// Should this accessible be allowed to have any ATK children
static PRBool MustPrune(nsIAccessible *aAccessible);
protected: protected:
nsresult FireAtkStateChangeEvent(nsIAccessibleEvent *aEvent, nsresult FireAtkStateChangeEvent(nsIAccessibleEvent *aEvent,
AtkObject *aObject); AtkObject *aObject);

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

@ -3273,3 +3273,16 @@ nsAccessible::GetAttrValue(PRUint32 aNameSpaceID, nsIAtom *aName,
return result; 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 PRInt32 TextLength(nsIAccessible *aAccessible); // Returns -1 on failure
static PRBool IsLeaf(nsIAccessible *aAcc) { PRInt32 numChildren; aAcc->GetChildCount(&numChildren); return numChildren > 0; } 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 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() { already_AddRefed<nsIAccessible> GetParent() {
nsIAccessible *parent = nsnull; nsIAccessible *parent = nsnull;

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

@ -79,19 +79,6 @@ class nsAccessibleWrap : public nsAccessible
NS_IMETHOD FireAccessibleEvent(nsIAccessibleEvent *aEvent); 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 // 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. // to the user. it also has no native accessible object represented for it.
PRBool IsIgnored(); PRBool IsIgnored();
@ -119,10 +106,11 @@ class nsAccessibleWrap : public nsAccessible
nsCOMPtr<nsIAccessible> curParent = GetParent(); nsCOMPtr<nsIAccessible> curParent = GetParent();
while (curParent) { while (curParent) {
nsAccessibleWrap *ancestorWrap = static_cast<nsAccessibleWrap*>((nsIAccessible*)curParent.get()); if (MustPrune(curParent))
if (ancestorWrap->IsFlat())
return PR_TRUE; 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 // no parent was flat
return PR_FALSE; return PR_FALSE;

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

@ -1715,14 +1715,3 @@ void nsAccessibleWrap::UpdateSystemCaret()
::DeleteObject(caretBitMap); ::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(). // nsIEnumVariant::Reset(), Skip() and Next().
PRUint16 mEnumVARIANTPosition; PRUint16 mEnumVARIANTPosition;
// Should this accessible be allowed to have any MSAA children
static PRBool MustPrune(nsIAccessible *aAccessible);
enum navRelations { enum navRelations {
NAVRELATION_CONTROLLED_BY = 0x1000, NAVRELATION_CONTROLLED_BY = 0x1000,
NAVRELATION_CONTROLLER_FOR = 0x1001, NAVRELATION_CONTROLLER_FOR = 0x1001,