Bug 725432 - HTML buttons with aria-pressed not exposing IA2 TOGGLE_BUTTON role, r=tbsaunde, f=surkov

This commit is contained in:
Max Li 2012-03-29 20:04:06 -04:00
parent 0a84303b99
commit f7870ef5e0
3 changed files with 21 additions and 12 deletions

View File

@ -1804,14 +1804,11 @@ nsAccessible::GetKeyBindings(PRUint8 aActionIndex,
}
role
nsAccessible::ARIARoleInternal()
nsAccessible::ARIATransformRole(role aRole)
{
NS_PRECONDITION(mRoleMapEntry && mRoleMapEntry->roleRule == kUseMapRole,
"ARIARoleInternal should only be called when ARIA role overrides!");
// XXX: these unfortunate exceptions don't fit into the ARIA table. This is
// where the accessible role depends on both the role and ARIA state.
if (mRoleMapEntry->role == roles::PUSHBUTTON) {
if (aRole == roles::PUSHBUTTON) {
if (nsAccUtils::HasDefinedARIAToken(mContent, nsGkAtoms::aria_pressed)) {
// For simplicity, any existing pressed attribute except "" or "undefined"
// indicates a toggle.
@ -1826,7 +1823,7 @@ nsAccessible::ARIARoleInternal()
return roles::BUTTONMENU;
}
} else if (mRoleMapEntry->role == roles::LISTBOX) {
} else if (aRole == roles::LISTBOX) {
// A listbox inside of a combobox needs a special role because of ATK
// mapping to menu.
if (mParent && mParent->Role() == roles::COMBOBOX) {
@ -1839,12 +1836,12 @@ nsAccessible::ARIARoleInternal()
return roles::COMBOBOX_LIST;
}
} else if (mRoleMapEntry->role == roles::OPTION) {
} else if (aRole == roles::OPTION) {
if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
return roles::COMBOBOX_OPTION;
}
return mRoleMapEntry->role;
return aRole;
}
role

View File

@ -178,9 +178,9 @@ public:
inline mozilla::a11y::role Role()
{
if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
return NativeRole();
return ARIATransformRole(NativeRole());
return ARIARoleInternal();
return ARIATransformRole(mRoleMapEntry->role);
}
/**
@ -200,7 +200,7 @@ public:
if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
return mozilla::a11y::roles::NOTHING;
return ARIARoleInternal();
return ARIATransformRole(mRoleMapEntry->role);
}
/**
@ -727,7 +727,7 @@ protected:
/**
* Return ARIA role (helper method).
*/
mozilla::a11y::role ARIARoleInternal();
mozilla::a11y::role ARIATransformRole(mozilla::a11y::role aRole);
virtual nsIFrame* GetBoundsFrame();
virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);

View File

@ -67,6 +67,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=529289
for (a in abstract_roles)
testRole(abstract_roles[a], ROLE_SECTION);
//////////////////////////////////////////////////////////////////////////
// roles transformed by ARIA state attributes
testRole("togglebutton", ROLE_TOGGLE_BUTTON);
//////////////////////////////////////////////////////////////////////////
// misc roles
testRole("note", ROLE_NOTE);
@ -94,6 +98,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=529289
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469688">Mozilla Bug 520188</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289">Mozilla Bug 529289</a>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289">Mozilla Bug 607219</a>
<a target="_blank"
title="HTML buttons with aria-pressed not exposing IA2 TOGGLE_BUTTON role"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=725432">
Bug 725432
</a>
<a target="_blank"
title="Map ARIA role FORM"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=735645">
@ -162,6 +171,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=529289
<div role="section" id="section">section</div>
<div role="sectionhead" id="sectionhead">sectionhead</div>
<!-- roles transformed by ARIA state attributes -->
<button aria-pressed="true" id="togglebutton">
<!-- misc roles -->
<div role="note" id="note">note</div>
<div role="scrollbar" id="scrollbar">scrollbar</div>