diff options
author | Linus Groh <mail@linusgroh.de> | 2023-01-28 22:23:16 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-01-29 00:02:55 +0000 |
commit | 8556d472400605d23d326816f497f4164b620b1d (patch) | |
tree | 424375c6ac5d6c6408540535f890132a0792aea3 /Userland/Libraries/LibWeb/HTML/HTMLElement.cpp | |
parent | 8414734a2dcc57813bf27d596fc7abc32d7ab308 (diff) | |
download | serenity-8556d472400605d23d326816f497f4164b620b1d.zip |
LibWeb: Move ARIA-related code into the Web::ARIA namespace
ARIA has its own spec and is not part of the DOM spec, which is what the
Web::DOM namespace is for (https://www.w3.org/TR/wai-aria-1.2/).
This allows us to stay closer to the spec with function names and don't
have to add the word "ARIA" to identifiers constantly - the namespace
now provides that clarity.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/HTMLElement.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLElement.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 3924eff662..f66365a99d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -6,7 +6,7 @@ #include <AK/StringBuilder.h> #include <LibJS/Interpreter.h> -#include <LibWeb/DOM/ARIARoles.h> +#include <LibWeb/ARIA/Roles.h> #include <LibWeb/DOM/Document.h> #include <LibWeb/DOM/IDLEventListener.h> #include <LibWeb/DOM/ShadowRoot.h> @@ -331,86 +331,86 @@ void HTMLElement::blur() // User agents may selectively or uniformly ignore calls to this method for usability reasons. } -Optional<DOM::ARIARoles::Role> HTMLElement::default_role() const +Optional<ARIA::Role> HTMLElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-article if (local_name() == TagNames::article) - return DOM::ARIARoles::Role::article; + return ARIA::Role::article; // https://www.w3.org/TR/html-aria/#el-aside if (local_name() == TagNames::aside) - return DOM::ARIARoles::Role::complementary; + return ARIA::Role::complementary; // https://www.w3.org/TR/html-aria/#el-b if (local_name() == TagNames::b) - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; // https://www.w3.org/TR/html-aria/#el-bdi if (local_name() == TagNames::bdi) - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; // https://www.w3.org/TR/html-aria/#el-bdo if (local_name() == TagNames::bdo) - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; // https://www.w3.org/TR/html-aria/#el-code if (local_name() == TagNames::code) - return DOM::ARIARoles::Role::code; + return ARIA::Role::code; // https://www.w3.org/TR/html-aria/#el-dfn if (local_name() == TagNames::dfn) - return DOM::ARIARoles::Role::term; + return ARIA::Role::term; // https://www.w3.org/TR/html-aria/#el-em if (local_name() == TagNames::em) - return DOM::ARIARoles::Role::emphasis; + return ARIA::Role::emphasis; // https://www.w3.org/TR/html-aria/#el-figure if (local_name() == TagNames::figure) - return DOM::ARIARoles::Role::figure; + return ARIA::Role::figure; // https://www.w3.org/TR/html-aria/#el-footer if (local_name() == TagNames::footer) { // TODO: If not a descendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, navigation or region then role=contentinfo // Otherwise, role=generic - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; } // https://www.w3.org/TR/html-aria/#el-header if (local_name() == TagNames::header) { // TODO: If not a descendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, navigation or region then role=banner // Otherwise, role=generic - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; } // https://www.w3.org/TR/html-aria/#el-hgroup if (local_name() == TagNames::hgroup) - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; // https://www.w3.org/TR/html-aria/#el-i if (local_name() == TagNames::i) - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; // https://www.w3.org/TR/html-aria/#el-main if (local_name() == TagNames::main) - return DOM::ARIARoles::Role::main; + return ARIA::Role::main; // https://www.w3.org/TR/html-aria/#el-nav if (local_name() == TagNames::nav) - return DOM::ARIARoles::Role::navigation; + return ARIA::Role::navigation; // https://www.w3.org/TR/html-aria/#el-samp if (local_name() == TagNames::samp) - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; // https://www.w3.org/TR/html-aria/#el-section if (local_name() == TagNames::section) { // TODO: role=region if the section element has an accessible name // Otherwise, no corresponding role - return DOM::ARIARoles::Role::region; + return ARIA::Role::region; } // https://www.w3.org/TR/html-aria/#el-small if (local_name() == TagNames::small) - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; // https://www.w3.org/TR/html-aria/#el-strong if (local_name() == TagNames::strong) - return DOM::ARIARoles::Role::strong; + return ARIA::Role::strong; // https://www.w3.org/TR/html-aria/#el-sub if (local_name() == TagNames::sub) - return DOM::ARIARoles::Role::subscript; + return ARIA::Role::subscript; // https://www.w3.org/TR/html-aria/#el-summary if (local_name() == TagNames::summary) - return DOM::ARIARoles::Role::button; + return ARIA::Role::button; // https://www.w3.org/TR/html-aria/#el-sup if (local_name() == TagNames::sup) - return DOM::ARIARoles::Role::superscript; + return ARIA::Role::superscript; // https://www.w3.org/TR/html-aria/#el-u if (local_name() == TagNames::u) - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; return {}; } |