Bug 1787284: [Part 3] Use cached name to compute MEMBER_OF rel for HTML radio buttons r=eeejay

Differential Revision: https://phabricator.services.mozilla.com/D159119
This commit is contained in:
Morgan Rae Reschenberg 2022-10-20 21:40:06 +00:00
Родитель 91b749da9e
Коммит af39c3b5c0
1 изменённых файлов: 22 добавлений и 0 удалений

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

@ -726,6 +726,28 @@ Relation RemoteAccessibleBase<Derived>::RelationByType(
if (aType == RelationType::MEMBER_OF) {
Relation rel = Relation();
// HTML radio buttons with cached names should be grouped.
if (IsHTMLRadioButton()) {
auto maybeName =
mCachedFields->GetAttribute<nsString>(nsGkAtoms::radioLabel);
if (!maybeName) {
return rel;
}
RemoteAccessible* ancestor = RemoteParent();
while (ancestor && ancestor->Role() != roles::FORM && ancestor != mDoc) {
ancestor = ancestor->RemoteParent();
}
Pivot p = Pivot(ancestor);
PivotRadioNameRule rule(*maybeName);
Accessible* match = p.Next(ancestor, rule);
while (match) {
rel.AppendTarget(match->AsRemote());
match = p.Next(match, rule);
}
return rel;
}
if (IsARIARole(nsGkAtoms::radio)) {
// ARIA radio buttons should be grouped by their radio group
// parent, if one exists.