mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-15 13:09:14 +00:00
Bug 1887789 part 1: Fixes to Accessible::LandmarkRole. r=morgan
1. The ARIA role should take precedence over the HTML tag. 2. The ARIA region role should only be conditionally treated as a landmark. Use the Gecko role to determine this. 3. Change some other cases to use the Gecko role instead of directly checking the name for consistency and to avoid duplicated logic. These fixes are tested in the next patch. Differential Revision: https://phabricator.services.mozilla.com/D209099
This commit is contained in:
parent
c34cf367c2
commit
94794e02dc
@ -508,6 +508,24 @@ const Accessible* Accessible::ActionAncestor() const {
|
||||
}
|
||||
|
||||
nsStaticAtom* Accessible::LandmarkRole() const {
|
||||
// For certain cases below (e.g. ARIA region, HTML <header>), whether it is
|
||||
// actually a landmark is conditional. Rather than duplicating that
|
||||
// conditional logic here, we check the Gecko role.
|
||||
if (const nsRoleMapEntry* roleMapEntry = ARIARoleMap()) {
|
||||
// Explicit ARIA role should take precedence.
|
||||
if (roleMapEntry->Is(nsGkAtoms::region)) {
|
||||
if (Role() == roles::REGION) {
|
||||
return nsGkAtoms::region;
|
||||
}
|
||||
} else if (roleMapEntry->Is(nsGkAtoms::form)) {
|
||||
if (Role() == roles::FORM) {
|
||||
return nsGkAtoms::form;
|
||||
}
|
||||
} else if (roleMapEntry->IsOfType(eLandmark)) {
|
||||
return roleMapEntry->roleAtom;
|
||||
}
|
||||
}
|
||||
|
||||
nsAtom* tagName = TagName();
|
||||
if (!tagName) {
|
||||
// Either no associated content, or no cache.
|
||||
@ -539,13 +557,13 @@ nsStaticAtom* Accessible::LandmarkRole() const {
|
||||
}
|
||||
|
||||
if (tagName == nsGkAtoms::section) {
|
||||
if (!NameIsEmpty()) {
|
||||
if (Role() == roles::REGION) {
|
||||
return nsGkAtoms::region;
|
||||
}
|
||||
}
|
||||
|
||||
if (tagName == nsGkAtoms::form) {
|
||||
if (!NameIsEmpty()) {
|
||||
if (Role() == roles::FORM_LANDMARK) {
|
||||
return nsGkAtoms::form;
|
||||
}
|
||||
}
|
||||
@ -554,10 +572,7 @@ nsStaticAtom* Accessible::LandmarkRole() const {
|
||||
return nsGkAtoms::search;
|
||||
}
|
||||
|
||||
const nsRoleMapEntry* roleMapEntry = ARIARoleMap();
|
||||
return roleMapEntry && roleMapEntry->IsOfType(eLandmark)
|
||||
? roleMapEntry->roleAtom
|
||||
: nullptr;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsStaticAtom* Accessible::ComputedARIARole() const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user