summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb
diff options
context:
space:
mode:
authorJonah <jonahshafran@gmail.com>2023-02-05 11:20:16 -0600
committerLinus Groh <mail@linusgroh.de>2023-02-19 15:58:20 +0100
commitfc3ee471ed9ce2eb18b6da47953d3918ac534fe3 (patch)
tree99bd3a3e3300d3b3a3f84d91d1d2668d46edeff8 /Userland/Libraries/LibWeb
parent613cfb31b159682e290e4abd8e6538137181fabb (diff)
downloadserenity-fc3ee471ed9ce2eb18b6da47953d3918ac534fe3.zip
LibWeb: Add ARIA::allows_name_from_content
This is required to implement accessible name and description calculation.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r--Userland/Libraries/LibWeb/ARIA/Roles.cpp25
-rw-r--r--Userland/Libraries/LibWeb/ARIA/Roles.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/ARIA/Roles.cpp b/Userland/Libraries/LibWeb/ARIA/Roles.cpp
index b032e0351f..0748563ae0 100644
--- a/Userland/Libraries/LibWeb/ARIA/Roles.cpp
+++ b/Userland/Libraries/LibWeb/ARIA/Roles.cpp
@@ -178,4 +178,29 @@ bool is_non_abstract_role(Role role)
|| is_windows_role(role);
}
+// https://www.w3.org/TR/wai-aria-1.2/#namefromcontent
+bool allows_name_from_content(Role role)
+{
+ return first_is_one_of(role,
+ Role::button,
+ Role::cell,
+ Role::checkbox,
+ Role::columnheader,
+ Role::gridcell,
+ Role::heading,
+ Role::link,
+ Role::menuitem,
+ Role::menuitemcheckbox,
+ Role::menuitemradio,
+ Role::option,
+ Role::radio,
+ Role::row,
+ Role::rowheader,
+ Role::sectionhead,
+ Role::switch_,
+ Role::tab,
+ Role::tooltip,
+ Role::treeitem);
+}
+
}
diff --git a/Userland/Libraries/LibWeb/ARIA/Roles.h b/Userland/Libraries/LibWeb/ARIA/Roles.h
index 630bcdac71..b8562d2560 100644
--- a/Userland/Libraries/LibWeb/ARIA/Roles.h
+++ b/Userland/Libraries/LibWeb/ARIA/Roles.h
@@ -124,5 +124,6 @@ bool is_live_region_role(Role);
bool is_windows_role(Role);
bool is_non_abstract_role(Role);
+bool allows_name_from_content(Role);
}