Bug 1849160 - Part 1: Implement rowgroup role, r=Jamie

This revision implements the ARIA rowgroup role in Gecko. Previously, Gecko was
using roles::GROUPING for multiple types of groups and disambiguating them
in various places. This revision unwinds that while maintaining present
functionality.

Differential Revision: https://phabricator.services.mozilla.com/D205671
This commit is contained in:
Nathan LaPre 2024-04-10 17:22:12 +00:00
parent 9b640a4811
commit 71fd3eb9cb
8 changed files with 28 additions and 17 deletions

View File

@ -1094,7 +1094,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = {
},
{ // rowgroup
nsGkAtoms::rowgroup,
roles::GROUPING,
roles::ROWGROUP,
kUseMapRole,
eNoValue,
eNoAction,

View File

@ -292,6 +292,7 @@ uint32_t AccGroupInfo::TotalItemCount(Accessible* aContainer,
case roles::MENUPOPUP:
case roles::COMBOBOX:
case roles::GROUPING:
case roles::ROWGROUP:
case roles::TREE_TABLE:
case roles::COMBOBOX_LIST:
case roles::LISTBOX:

View File

@ -35,7 +35,7 @@ class TablePartRule : public PivotRule {
accRole == roles::TEXT || accRole == roles::TEXT_CONTAINER ||
accRole == roles::SECTION ||
// Row groups.
accRole == roles::GROUPING) {
accRole == roles::ROWGROUP) {
// Walk inside these, but don't match them.
return nsIAccessibleTraversalRule::FILTER_IGNORE;
}

View File

@ -376,7 +376,7 @@ MARKUPMAP(
MARKUPMAP(time, New_HyperText, roles::TIME, Attr(xmlroles, time),
AttrFromDOM(datetime, datetime))
MARKUPMAP(tbody, nullptr, roles::GROUPING)
MARKUPMAP(tbody, nullptr, roles::ROWGROUP)
MARKUPMAP(
td,
@ -392,7 +392,7 @@ MARKUPMAP(
},
0)
MARKUPMAP(tfoot, nullptr, roles::GROUPING)
MARKUPMAP(tfoot, nullptr, roles::ROWGROUP)
MARKUPMAP(
th,
@ -404,7 +404,7 @@ MARKUPMAP(
},
0)
MARKUPMAP(thead, nullptr, roles::GROUPING)
MARKUPMAP(thead, nullptr, roles::ROWGROUP)
MARKUPMAP(
tr,

View File

@ -1831,4 +1831,17 @@ ROLE(GRID,
IsAccessibilityElementRule::IfChildlessWithNameAndFocusable,
UIA_DataGridControlTypeId,
eNameFromSubtreeIfReqRule)
ROLE(ROWGROUP,
"rowgroup",
nsGkAtoms::rowgroup,
ATK_ROLE_PANEL,
NSAccessibilityGroupRole,
NSAccessibilityUnknownSubrole,
ROLE_SYSTEM_GROUPING,
ROLE_SYSTEM_GROUPING,
java::SessionAccessibility::CLASSNAME_VIEW,
IsAccessibilityElementRule::IfChildlessWithNameAndFocusable,
UIA_GroupControlTypeId,
eNameFromSubtreeIfReqRule)
// clang-format on

View File

@ -122,7 +122,7 @@ static LocalAccessible* MaybeCreateSpecificARIAAccessible(
if (!parent) {
return nullptr;
}
if (!parent->IsTable() && parent->Role() == roles::GROUPING) {
if (!parent->IsTable() && parent->Role() == roles::ROWGROUP) {
parent = parent->GetNonGenericParent();
if (!parent) {
return nullptr;

View File

@ -569,8 +569,7 @@ nsStaticAtom* Accessible::ComputedARIARole() const {
roleMap->roleAtom != nsGkAtoms::form &&
(roleMap->roleRule == kUseNativeRole || roleMap->IsOfType(eLandmark) ||
roleMap->roleAtom == nsGkAtoms::alertdialog ||
roleMap->roleAtom == nsGkAtoms::feed ||
roleMap->roleAtom == nsGkAtoms::rowgroup)) {
roleMap->roleAtom == nsGkAtoms::feed)) {
// Explicit ARIA role (e.g. specified via the role attribute) which does not
// map to a unique Gecko role.
return roleMap->roleAtom;
@ -583,15 +582,6 @@ nsStaticAtom* Accessible::ComputedARIARole() const {
// Landmark role from native markup; e.g. <main>, <nav>.
return LandmarkRole();
}
if (geckoRole == roles::GROUPING) {
// Gecko doesn't differentiate between group and rowgroup. It uses
// roles::GROUPING for both.
nsAtom* tag = TagName();
if (tag == nsGkAtoms::tbody || tag == nsGkAtoms::tfoot ||
tag == nsGkAtoms::thead) {
return nsGkAtoms::rowgroup;
}
}
// Role from native markup or layout.
#define ROLE(_geckoRole, stringRole, ariaRole, atkRole, macRole, macSubrole, \
msaaRole, ia2Role, androidClass, iosIsElement, uiaControlType, \

View File

@ -806,4 +806,11 @@ interface nsIAccessibleRole : nsISupports
* by using methods of two-dimensional navigation.
*/
const unsigned long ROLE_GRID = 138;
/**
* Represents a structure containing one or more row elements in a tabular
* container. It is the structural equivalent to the thead, tfoot, and tbody
* elements in an HTML table element.
*/
const unsigned long ROLE_ROWGROUP = 139;
};