mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-13 03:29:49 +00:00
LibWeb: Add support for ARIA Graphics roles
This change adds support for the graphics-document, graphics-object, and graphics-symbol ARIA roles from the WAI-ARIA Graphics Module spec at https://w3c.github.io/graphics-aria/#role_definitions
This commit is contained in:
parent
fc956080e2
commit
8961d5d2ce
Notes:
github-actions[bot]
2024-12-28 01:17:20 +00:00
Author: https://github.com/sideshowbarker
Commit: 8961d5d2ce
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3043
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/trflynn89
6 changed files with 287 additions and 110 deletions
|
@ -13,11 +13,11 @@ StringView role_name(Role role)
|
|||
{
|
||||
// Note: Role::switch_ is mapped to "switch" (due to C++ keyword clash)
|
||||
switch (role) {
|
||||
#define __ENUMERATE_ARIA_ROLE(name) \
|
||||
#define __ENUMERATE_ARIA_ROLE(name, attribute) \
|
||||
case Role::name: \
|
||||
if constexpr (Role::name == Role::switch_) \
|
||||
return "switch"sv; \
|
||||
return #name##sv;
|
||||
return attribute##sv;
|
||||
ENUMERATE_ARIA_ROLES
|
||||
#undef __ENUMERATE_ARIA_ROLE
|
||||
default:
|
||||
|
@ -28,13 +28,13 @@ StringView role_name(Role role)
|
|||
Optional<Role> role_from_string(StringView role_name)
|
||||
{
|
||||
// Note: "switch" is mapped to Role::switch_ (due to C++ keyword clash)
|
||||
#define __ENUMERATE_ARIA_ROLE(name) \
|
||||
if constexpr (Role::name == Role::switch_) { \
|
||||
if (role_name.equals_ignoring_ascii_case("switch"sv)) \
|
||||
return Role::switch_; \
|
||||
} else { \
|
||||
if (role_name.equals_ignoring_ascii_case(#name##sv)) \
|
||||
return Role::name; \
|
||||
#define __ENUMERATE_ARIA_ROLE(name, attribute) \
|
||||
if constexpr (Role::name == Role::switch_) { \
|
||||
if (role_name.equals_ignoring_ascii_case("switch"sv)) \
|
||||
return Role::switch_; \
|
||||
} else { \
|
||||
if (role_name.equals_ignoring_ascii_case(attribute##sv)) \
|
||||
return Role::name; \
|
||||
}
|
||||
ENUMERATE_ARIA_ROLES
|
||||
#undef __ENUMERATE_ARIA_ROLE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue