From 71fd3eb9cb1d108a1630236a82079c7d611acd54 Mon Sep 17 00:00:00 2001 From: Nathan LaPre Date: Wed, 10 Apr 2024 17:22:12 +0000 Subject: [PATCH] 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 --- accessible/base/ARIAMap.cpp | 2 +- accessible/base/AccGroupInfo.cpp | 1 + accessible/base/CachedTableAccessible.cpp | 2 +- accessible/base/HTMLMarkupMap.h | 6 +++--- accessible/base/RoleMap.h | 13 +++++++++++++ accessible/base/nsAccessibilityService.cpp | 2 +- accessible/basetypes/Accessible.cpp | 12 +----------- accessible/interfaces/nsIAccessibleRole.idl | 7 +++++++ 8 files changed, 28 insertions(+), 17 deletions(-) diff --git a/accessible/base/ARIAMap.cpp b/accessible/base/ARIAMap.cpp index bfc41db82e2e..d53592acf025 100644 --- a/accessible/base/ARIAMap.cpp +++ b/accessible/base/ARIAMap.cpp @@ -1094,7 +1094,7 @@ static const nsRoleMapEntry sWAIRoleMaps[] = { }, { // rowgroup nsGkAtoms::rowgroup, - roles::GROUPING, + roles::ROWGROUP, kUseMapRole, eNoValue, eNoAction, diff --git a/accessible/base/AccGroupInfo.cpp b/accessible/base/AccGroupInfo.cpp index c3501dc36e76..336ce9ecf504 100644 --- a/accessible/base/AccGroupInfo.cpp +++ b/accessible/base/AccGroupInfo.cpp @@ -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: diff --git a/accessible/base/CachedTableAccessible.cpp b/accessible/base/CachedTableAccessible.cpp index e780bd2a8922..8f56352acd89 100644 --- a/accessible/base/CachedTableAccessible.cpp +++ b/accessible/base/CachedTableAccessible.cpp @@ -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; } diff --git a/accessible/base/HTMLMarkupMap.h b/accessible/base/HTMLMarkupMap.h index c60761651818..3b422ac09c2a 100644 --- a/accessible/base/HTMLMarkupMap.h +++ b/accessible/base/HTMLMarkupMap.h @@ -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, diff --git a/accessible/base/RoleMap.h b/accessible/base/RoleMap.h index 780361f9b0ca..6008dc4bbfd5 100644 --- a/accessible/base/RoleMap.h +++ b/accessible/base/RoleMap.h @@ -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 diff --git a/accessible/base/nsAccessibilityService.cpp b/accessible/base/nsAccessibilityService.cpp index 95d54a8b865e..615af596a7b0 100644 --- a/accessible/base/nsAccessibilityService.cpp +++ b/accessible/base/nsAccessibilityService.cpp @@ -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; diff --git a/accessible/basetypes/Accessible.cpp b/accessible/basetypes/Accessible.cpp index 0ad1454e4212..8b433a0ddd28 100644 --- a/accessible/basetypes/Accessible.cpp +++ b/accessible/basetypes/Accessible.cpp @@ -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.
,