LibWeb: Extract ARIA role-attribute checking out from role_or_default()

This change separates the steps for checking the string value of the
ARIA “role” attribute out from the element.role_or_default() function
into a separate function — in order to expose a way to just check if the
ARIA “role” attribute actually has a value, without also then computing
a default role value if no “role” attribute value was found.

Otherwise, without this change, the only available function for
retrieving ARIA role values is the element.role_or_default() function —
which always does the additional step of computing (and returning) a
default role value if no “role” attribute is found.
This commit is contained in:
sideshowbarker 2024-12-06 18:41:38 +09:00 committed by Tim Ledbetter
commit 7a4a9cc7bc
Notes: github-actions[bot] 2024-12-06 18:32:48 +00:00
2 changed files with 10 additions and 2 deletions

View file

@ -28,6 +28,7 @@ public:
// https://www.w3.org/TR/html-aria/#docconformance
virtual Optional<Role> default_role() const { return {}; }
Optional<Role> role_from_role_attribute_value() const;
Optional<Role> role_or_default() const;
// https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion