From 8556d472400605d23d326816f497f4164b620b1d Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sat, 28 Jan 2023 22:23:16 +0000 Subject: 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. --- Userland/Libraries/LibWeb/ARIA/ARIAMixin.cpp | 64 ++++++++ Userland/Libraries/LibWeb/ARIA/ARIAMixin.h | 152 ++++++++++++++++++ Userland/Libraries/LibWeb/ARIA/ARIAMixin.idl | 53 +++++++ Userland/Libraries/LibWeb/ARIA/Roles.cpp | 172 +++++++++++++++++++++ Userland/Libraries/LibWeb/ARIA/Roles.h | 127 +++++++++++++++ Userland/Libraries/LibWeb/CMakeLists.txt | 6 +- Userland/Libraries/LibWeb/DOM/ARIAMixin.cpp | 64 -------- Userland/Libraries/LibWeb/DOM/ARIAMixin.h | 152 ------------------ Userland/Libraries/LibWeb/DOM/ARIAMixin.idl | 53 ------- Userland/Libraries/LibWeb/DOM/ARIARoles.cpp | 172 --------------------- Userland/Libraries/LibWeb/DOM/ARIARoles.h | 127 --------------- .../Libraries/LibWeb/DOM/AccessibilityTreeNode.cpp | 4 +- Userland/Libraries/LibWeb/DOM/Element.cpp | 2 +- Userland/Libraries/LibWeb/DOM/Element.h | 4 +- Userland/Libraries/LibWeb/DOM/Element.idl | 2 +- Userland/Libraries/LibWeb/DOM/Node.h | 1 - .../Libraries/LibWeb/HTML/HTMLAnchorElement.cpp | 8 +- Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h | 2 +- Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp | 8 +- Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h | 2 +- Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLDataElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLDataListElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLDetailsElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLDivElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLElement.cpp | 50 +++--- Userland/Libraries/LibWeb/HTML/HTMLElement.h | 2 +- .../Libraries/LibWeb/HTML/HTMLFieldSetElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLFormElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLHRElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLHeadingElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLImageElement.cpp | 8 +- Userland/Libraries/LibWeb/HTML/HTMLImageElement.h | 2 +- .../Libraries/LibWeb/HTML/HTMLInputElement.cpp | 30 ++-- Userland/Libraries/LibWeb/HTML/HTMLInputElement.h | 2 +- Userland/Libraries/LibWeb/HTML/HTMLLIElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp | 6 +- Userland/Libraries/LibWeb/HTML/HTMLModElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLOListElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLOptGroupElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLOptionElement.cpp | 6 +- Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h | 2 +- Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLParagraphElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLPreElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLProgressElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLQuoteElement.cpp | 8 +- Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h | 2 +- .../Libraries/LibWeb/HTML/HTMLSelectElement.cpp | 8 +- Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h | 2 +- Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h | 4 +- .../LibWeb/HTML/HTMLTableCaptionElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLTableCellElement.cpp | 2 +- .../Libraries/LibWeb/HTML/HTMLTableCellElement.h | 2 +- Userland/Libraries/LibWeb/HTML/HTMLTableElement.h | 2 +- .../Libraries/LibWeb/HTML/HTMLTableRowElement.h | 4 +- .../LibWeb/HTML/HTMLTableSectionElement.h | 4 +- .../Libraries/LibWeb/HTML/HTMLTextAreaElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h | 4 +- Userland/Libraries/LibWeb/HTML/HTMLUListElement.h | 4 +- .../Services/WebContent/WebDriverConnection.cpp | 2 +- 66 files changed, 713 insertions(+), 714 deletions(-) create mode 100644 Userland/Libraries/LibWeb/ARIA/ARIAMixin.cpp create mode 100644 Userland/Libraries/LibWeb/ARIA/ARIAMixin.h create mode 100644 Userland/Libraries/LibWeb/ARIA/ARIAMixin.idl create mode 100644 Userland/Libraries/LibWeb/ARIA/Roles.cpp create mode 100644 Userland/Libraries/LibWeb/ARIA/Roles.h delete mode 100644 Userland/Libraries/LibWeb/DOM/ARIAMixin.cpp delete mode 100644 Userland/Libraries/LibWeb/DOM/ARIAMixin.h delete mode 100644 Userland/Libraries/LibWeb/DOM/ARIAMixin.idl delete mode 100644 Userland/Libraries/LibWeb/DOM/ARIARoles.cpp delete mode 100644 Userland/Libraries/LibWeb/DOM/ARIARoles.h diff --git a/Userland/Libraries/LibWeb/ARIA/ARIAMixin.cpp b/Userland/Libraries/LibWeb/ARIA/ARIAMixin.cpp new file mode 100644 index 0000000000..448855eefd --- /dev/null +++ b/Userland/Libraries/LibWeb/ARIA/ARIAMixin.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2022, Jonah Shafran + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include +#include + +namespace Web::ARIA { + +// https://www.w3.org/TR/wai-aria-1.2/#introroles +Optional ARIAMixin::role_or_default() const +{ + // 1. Use the rules of the host language to detect that an element has a role attribute and to identify the attribute value string for it. + auto role_string = role(); + + // 2. Separate the attribute value string for that attribute into a sequence of whitespace-free substrings by separating on whitespace. + auto role_list = role_string.split_view(Infra::is_ascii_whitespace); + + // 3. Compare the substrings to all the names of the non-abstract WAI-ARIA roles. Case-sensitivity of the comparison inherits from the case-sensitivity of the host language. + for (auto const& role_name : role_list) { + // 4. Use the first such substring in textual order that matches the name of a non-abstract WAI-ARIA role. + auto role = role_from_string(role_name); + if (!role.has_value()) + continue; + if (is_non_abstract_role(*role)) + return *role; + } + + // https://www.w3.org/TR/wai-aria-1.2/#document-handling_author-errors_roles + // If the role attribute contains no tokens matching the name of a non-abstract WAI-ARIA role, the user agent MUST treat the element as if no role had been provided. + // https://www.w3.org/TR/wai-aria-1.2/#implicit_semantics + return default_role(); +} + +// https://www.w3.org/TR/wai-aria-1.2/#global_states +bool ARIAMixin::has_global_aria_attribute() const +{ + return !aria_atomic().is_null() + || !aria_busy().is_null() + || !aria_controls().is_null() + || !aria_current().is_null() + || !aria_described_by().is_null() + || !aria_details().is_null() + || !aria_disabled().is_null() + || !aria_drop_effect().is_null() + || !aria_error_message().is_null() + || !aria_flow_to().is_null() + || !aria_grabbed().is_null() + || !aria_has_popup().is_null() + || !aria_hidden().is_null() + || !aria_invalid().is_null() + || !aria_key_shortcuts().is_null() + || !aria_label().is_null() + || !aria_labelled_by().is_null() + || !aria_live().is_null() + || !aria_owns().is_null() + || !aria_relevant().is_null() + || !aria_role_description().is_null(); +} + +} diff --git a/Userland/Libraries/LibWeb/ARIA/ARIAMixin.h b/Userland/Libraries/LibWeb/ARIA/ARIAMixin.h new file mode 100644 index 0000000000..45b097f96a --- /dev/null +++ b/Userland/Libraries/LibWeb/ARIA/ARIAMixin.h @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2022, Jonah Shafran + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include +#include +#include + +namespace Web::ARIA { + +class ARIAMixin { + +public: + virtual ~ARIAMixin() = default; + + virtual DeprecatedString role() const = 0; + virtual WebIDL::ExceptionOr set_role(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_active_descendant() const = 0; + virtual WebIDL::ExceptionOr set_aria_active_descendant(DeprecatedString const&) = 0; + virtual DeprecatedString aria_atomic() const = 0; + virtual WebIDL::ExceptionOr set_aria_atomic(DeprecatedString const&) = 0; + virtual DeprecatedString aria_auto_complete() const = 0; + virtual WebIDL::ExceptionOr set_aria_auto_complete(DeprecatedString const&) = 0; + virtual DeprecatedString aria_busy() const = 0; + virtual WebIDL::ExceptionOr set_aria_busy(DeprecatedString const&) = 0; + virtual DeprecatedString aria_checked() const = 0; + virtual WebIDL::ExceptionOr set_aria_checked(DeprecatedString const&) = 0; + virtual DeprecatedString aria_col_count() const = 0; + virtual WebIDL::ExceptionOr set_aria_col_count(DeprecatedString const&) = 0; + virtual DeprecatedString aria_col_index() const = 0; + virtual WebIDL::ExceptionOr set_aria_col_index(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_col_span() const = 0; + virtual WebIDL::ExceptionOr set_aria_col_span(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_controls() const = 0; + virtual WebIDL::ExceptionOr set_aria_controls(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_current() const = 0; + virtual WebIDL::ExceptionOr set_aria_current(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_described_by() const = 0; + virtual WebIDL::ExceptionOr set_aria_described_by(DeprecatedString const&) = 0; + virtual DeprecatedString aria_details() const = 0; + virtual WebIDL::ExceptionOr set_aria_details(DeprecatedString const&) = 0; + virtual DeprecatedString aria_drop_effect() const = 0; + virtual WebIDL::ExceptionOr set_aria_drop_effect(DeprecatedString const&) = 0; + virtual DeprecatedString aria_error_message() const = 0; + virtual WebIDL::ExceptionOr set_aria_error_message(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_disabled() const = 0; + virtual WebIDL::ExceptionOr set_aria_disabled(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_expanded() const = 0; + virtual WebIDL::ExceptionOr set_aria_expanded(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_flow_to() const = 0; + virtual WebIDL::ExceptionOr set_aria_flow_to(DeprecatedString const&) = 0; + virtual DeprecatedString aria_grabbed() const = 0; + virtual WebIDL::ExceptionOr set_aria_grabbed(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_has_popup() const = 0; + virtual WebIDL::ExceptionOr set_aria_has_popup(DeprecatedString const&) = 0; + virtual DeprecatedString aria_hidden() const = 0; + virtual WebIDL::ExceptionOr set_aria_hidden(DeprecatedString const&) = 0; + virtual DeprecatedString aria_invalid() const = 0; + virtual WebIDL::ExceptionOr set_aria_invalid(DeprecatedString const&) = 0; + virtual DeprecatedString aria_key_shortcuts() const = 0; + virtual WebIDL::ExceptionOr set_aria_key_shortcuts(DeprecatedString const&) = 0; + virtual DeprecatedString aria_label() const = 0; + virtual WebIDL::ExceptionOr set_aria_label(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_labelled_by() const = 0; + virtual WebIDL::ExceptionOr set_aria_labelled_by(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_level() const = 0; + virtual WebIDL::ExceptionOr set_aria_level(DeprecatedString const&) = 0; + virtual DeprecatedString aria_live() const = 0; + virtual WebIDL::ExceptionOr set_aria_live(DeprecatedString const&) = 0; + virtual DeprecatedString aria_modal() const = 0; + virtual WebIDL::ExceptionOr set_aria_modal(DeprecatedString const&) = 0; + virtual DeprecatedString aria_multi_line() const = 0; + virtual WebIDL::ExceptionOr set_aria_multi_line(DeprecatedString const&) = 0; + virtual DeprecatedString aria_multi_selectable() const = 0; + virtual WebIDL::ExceptionOr set_aria_multi_selectable(DeprecatedString const&) = 0; + virtual DeprecatedString aria_orientation() const = 0; + virtual WebIDL::ExceptionOr set_aria_orientation(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_owns() const = 0; + virtual WebIDL::ExceptionOr set_aria_owns(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_placeholder() const = 0; + virtual WebIDL::ExceptionOr set_aria_placeholder(DeprecatedString const&) = 0; + virtual DeprecatedString aria_pos_in_set() const = 0; + virtual WebIDL::ExceptionOr set_aria_pos_in_set(DeprecatedString const&) = 0; + virtual DeprecatedString aria_pressed() const = 0; + virtual WebIDL::ExceptionOr set_aria_pressed(DeprecatedString const&) = 0; + virtual DeprecatedString aria_read_only() const = 0; + virtual WebIDL::ExceptionOr set_aria_read_only(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_relevant() const = 0; + virtual WebIDL::ExceptionOr set_aria_relevant(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_required() const = 0; + virtual WebIDL::ExceptionOr set_aria_required(DeprecatedString const&) = 0; + virtual DeprecatedString aria_role_description() const = 0; + virtual WebIDL::ExceptionOr set_aria_role_description(DeprecatedString const&) = 0; + virtual DeprecatedString aria_row_count() const = 0; + virtual WebIDL::ExceptionOr set_aria_row_count(DeprecatedString const&) = 0; + virtual DeprecatedString aria_row_index() const = 0; + virtual WebIDL::ExceptionOr set_aria_row_index(DeprecatedString const&) = 0; + + virtual DeprecatedString aria_row_span() const = 0; + virtual WebIDL::ExceptionOr set_aria_row_span(DeprecatedString const&) = 0; + virtual DeprecatedString aria_selected() const = 0; + virtual WebIDL::ExceptionOr set_aria_selected(DeprecatedString const&) = 0; + virtual DeprecatedString aria_set_size() const = 0; + virtual WebIDL::ExceptionOr set_aria_set_size(DeprecatedString const&) = 0; + virtual DeprecatedString aria_sort() const = 0; + virtual WebIDL::ExceptionOr set_aria_sort(DeprecatedString const&) = 0; + virtual DeprecatedString aria_value_max() const = 0; + virtual WebIDL::ExceptionOr set_aria_value_max(DeprecatedString const&) = 0; + virtual DeprecatedString aria_value_min() const = 0; + virtual WebIDL::ExceptionOr set_aria_value_min(DeprecatedString const&) = 0; + virtual DeprecatedString aria_value_now() const = 0; + virtual WebIDL::ExceptionOr set_aria_value_now(DeprecatedString const&) = 0; + virtual DeprecatedString aria_value_text() const = 0; + virtual WebIDL::ExceptionOr set_aria_value_text(DeprecatedString const&) = 0; + + // https://www.w3.org/TR/html-aria/#docconformance + virtual Optional default_role() const { return {}; }; + + Optional role_or_default() const; + + // https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion + virtual bool exclude_from_accessibility_tree() const = 0; + + // https://www.w3.org/TR/wai-aria-1.2/#tree_inclusion + virtual bool include_in_accessibility_tree() const = 0; + + bool has_global_aria_attribute() const; + +protected: + ARIAMixin() = default; +}; + +} diff --git a/Userland/Libraries/LibWeb/ARIA/ARIAMixin.idl b/Userland/Libraries/LibWeb/ARIA/ARIAMixin.idl new file mode 100644 index 0000000000..f608e238a9 --- /dev/null +++ b/Userland/Libraries/LibWeb/ARIA/ARIAMixin.idl @@ -0,0 +1,53 @@ +// https://www.w3.org/TR/wai-aria-1.2/#ARIAMixin +interface mixin ARIAMixin { + attribute DOMString? role; + + attribute DOMString? ariaAtomic; + attribute DOMString? ariaAutoComplete; + attribute DOMString? ariaBusy; + attribute DOMString? ariaChecked; + attribute DOMString? ariaColCount; + attribute DOMString? ariaColIndex; + + attribute DOMString? ariaColSpan; + + attribute DOMString? ariaCurrent; + + + + attribute DOMString? ariaDisabled; + + attribute DOMString? ariaExpanded; + + attribute DOMString? ariaHasPopup; + attribute DOMString? ariaHidden; + attribute DOMString? ariaInvalid; + attribute DOMString? ariaKeyShortcuts; + attribute DOMString? ariaLabel; + + attribute DOMString? ariaLevel; + attribute DOMString? ariaLive; + attribute DOMString? ariaModal; + attribute DOMString? ariaMultiLine; + attribute DOMString? ariaMultiSelectable; + attribute DOMString? ariaOrientation; + + attribute DOMString? ariaPlaceholder; + attribute DOMString? ariaPosInSet; + attribute DOMString? ariaPressed; + attribute DOMString? ariaReadOnly; + + attribute DOMString? ariaRequired; + attribute DOMString? ariaRoleDescription; + attribute DOMString? ariaRowCount; + attribute DOMString? ariaRowIndex; + + attribute DOMString? ariaRowSpan; + attribute DOMString? ariaSelected; + attribute DOMString? ariaSetSize; + attribute DOMString? ariaSort; + attribute DOMString? ariaValueMax; + attribute DOMString? ariaValueMin; + attribute DOMString? ariaValueNow; + attribute DOMString? ariaValueText; +}; diff --git a/Userland/Libraries/LibWeb/ARIA/Roles.cpp b/Userland/Libraries/LibWeb/ARIA/Roles.cpp new file mode 100644 index 0000000000..061194191e --- /dev/null +++ b/Userland/Libraries/LibWeb/ARIA/Roles.cpp @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2022, Jonah Shafran + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include + +namespace Web::ARIA { + +StringView role_name(Role role) +{ + switch (role) { +#define __ENUMERATE_ARIA_ROLE(name) \ + case Role::name: \ + return #name##sv; + ENUMERATE_ARIA_ROLES +#undef __ENUMERATE_ARIA_ROLE + default: + VERIFY_NOT_REACHED(); + } +} + +Optional role_from_string(StringView role_name) +{ +#define __ENUMERATE_ARIA_ROLE(name) \ + if (role_name.equals_ignoring_case(#name##sv)) \ + return Role::name; + ENUMERATE_ARIA_ROLES +#undef __ENUMERATE_ARIA_ROLE + return {}; +} + +// https://www.w3.org/TR/wai-aria-1.2/#abstract_roles +bool is_abstract_role(Role role) +{ + return first_is_one_of(role, + Role::command, + Role::composite, + Role::input, + Role::landmark, + Role::range, + Role::roletype, + Role::section, + Role::sectionhead, + Role::select, + Role::structure, + Role::widget, + Role::window); +} + +// https://www.w3.org/TR/wai-aria-1.2/#widget_roles +bool is_widget_role(Role role) +{ + return first_is_one_of(role, + Role::button, + Role::checkbox, + Role::gridcell, + Role::link, + Role::menuitem, + Role::menuitemcheckbox, + Role::option, + Role::progressbar, + Role::radio, + Role::scrollbar, + Role::searchbox, + Role::separator, // TODO: Only when focusable + Role::slider, + Role::spinbutton, + Role::switch_, + Role::tab, + Role::tabpanel, + Role::textbox, + Role::treeitem, + Role::combobox, + Role::grid, + Role::listbox, + Role::menu, + Role::menubar, + Role::radiogroup, + Role::tablist, + Role::tree, + Role::treegrid); +} + +// https://www.w3.org/TR/wai-aria-1.2/#document_structure_roles +bool is_document_structure_role(Role role) +{ + return first_is_one_of(role, + Role::application, + Role::article, + Role::blockquote, + Role::caption, + Role::cell, + Role::columnheader, + Role::definition, + Role::deletion, + Role::directory, + Role::document, + Role::emphasis, + Role::feed, + Role::figure, + Role::generic, + Role::group, + Role::heading, + Role::img, + Role::insertion, + Role::list, + Role::listitem, + Role::math, + Role::meter, + Role::none, + Role::note, + Role::paragraph, + Role::presentation, + Role::row, + Role::rowgroup, + Role::rowheader, + Role::separator, // TODO: Only when not focusable + Role::strong, + Role::subscript, + Role::table, + Role::term, + Role::time, + Role::toolbar, + Role::tooltip); +} + +// https://www.w3.org/TR/wai-aria-1.2/#landmark_roles +bool is_landmark_role(Role role) +{ + return first_is_one_of(role, + Role::banner, + Role::complementary, + Role::contentinfo, + Role::form, + Role::main, + Role::navigation, + Role::region, + Role::search); +} + +// https://www.w3.org/TR/wai-aria-1.2/#live_region_roles +bool is_live_region_role(Role role) +{ + return first_is_one_of(role, + Role::alert, + Role::log, + Role::marquee, + Role::status, + Role::timer); +} + +// https://www.w3.org/TR/wai-aria-1.2/#window_roles +bool is_windows_role(Role role) +{ + return first_is_one_of(role, + Role::alertdialog, + Role::dialog); +} + +bool is_non_abstract_role(Role role) +{ + return is_widget_role(role) + || is_document_structure_role(role) + || is_landmark_role(role) + || is_live_region_role(role) + || is_windows_role(role); +} + +} diff --git a/Userland/Libraries/LibWeb/ARIA/Roles.h b/Userland/Libraries/LibWeb/ARIA/Roles.h new file mode 100644 index 0000000000..734e3b7f17 --- /dev/null +++ b/Userland/Libraries/LibWeb/ARIA/Roles.h @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2022, Jonah Shafran + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#pragma once + +#include + +namespace Web::ARIA { + +#define ENUMERATE_ARIA_ROLES \ + __ENUMERATE_ARIA_ROLE(alert) \ + __ENUMERATE_ARIA_ROLE(alertdialog) \ + __ENUMERATE_ARIA_ROLE(application) \ + __ENUMERATE_ARIA_ROLE(article) \ + __ENUMERATE_ARIA_ROLE(banner) \ + __ENUMERATE_ARIA_ROLE(blockquote) \ + __ENUMERATE_ARIA_ROLE(button) \ + __ENUMERATE_ARIA_ROLE(caption) \ + __ENUMERATE_ARIA_ROLE(cell) \ + __ENUMERATE_ARIA_ROLE(checkbox) \ + __ENUMERATE_ARIA_ROLE(code) \ + __ENUMERATE_ARIA_ROLE(columnheader) \ + __ENUMERATE_ARIA_ROLE(combobox) \ + __ENUMERATE_ARIA_ROLE(command) \ + __ENUMERATE_ARIA_ROLE(complementary) \ + __ENUMERATE_ARIA_ROLE(composite) \ + __ENUMERATE_ARIA_ROLE(contentinfo) \ + __ENUMERATE_ARIA_ROLE(definition) \ + __ENUMERATE_ARIA_ROLE(deletion) \ + __ENUMERATE_ARIA_ROLE(dialog) \ + __ENUMERATE_ARIA_ROLE(directory) \ + __ENUMERATE_ARIA_ROLE(document) \ + __ENUMERATE_ARIA_ROLE(emphasis) \ + __ENUMERATE_ARIA_ROLE(feed) \ + __ENUMERATE_ARIA_ROLE(figure) \ + __ENUMERATE_ARIA_ROLE(form) \ + __ENUMERATE_ARIA_ROLE(generic) \ + __ENUMERATE_ARIA_ROLE(grid) \ + __ENUMERATE_ARIA_ROLE(gridcell) \ + __ENUMERATE_ARIA_ROLE(group) \ + __ENUMERATE_ARIA_ROLE(heading) \ + __ENUMERATE_ARIA_ROLE(img) \ + __ENUMERATE_ARIA_ROLE(input) \ + __ENUMERATE_ARIA_ROLE(insertion) \ + __ENUMERATE_ARIA_ROLE(landmark) \ + __ENUMERATE_ARIA_ROLE(link) \ + __ENUMERATE_ARIA_ROLE(list) \ + __ENUMERATE_ARIA_ROLE(listbox) \ + __ENUMERATE_ARIA_ROLE(listitem) \ + __ENUMERATE_ARIA_ROLE(log) \ + __ENUMERATE_ARIA_ROLE(main) \ + __ENUMERATE_ARIA_ROLE(marquee) \ + __ENUMERATE_ARIA_ROLE(math) \ + __ENUMERATE_ARIA_ROLE(meter) \ + __ENUMERATE_ARIA_ROLE(menu) \ + __ENUMERATE_ARIA_ROLE(menubar) \ + __ENUMERATE_ARIA_ROLE(menuitem) \ + __ENUMERATE_ARIA_ROLE(menuitemcheckbox) \ + __ENUMERATE_ARIA_ROLE(menuitemradio) \ + __ENUMERATE_ARIA_ROLE(navigation) \ + __ENUMERATE_ARIA_ROLE(none) \ + __ENUMERATE_ARIA_ROLE(note) \ + __ENUMERATE_ARIA_ROLE(option) \ + __ENUMERATE_ARIA_ROLE(paragraph) \ + __ENUMERATE_ARIA_ROLE(presentation) \ + __ENUMERATE_ARIA_ROLE(progressbar) \ + __ENUMERATE_ARIA_ROLE(radio) \ + __ENUMERATE_ARIA_ROLE(radiogroup) \ + __ENUMERATE_ARIA_ROLE(range) \ + __ENUMERATE_ARIA_ROLE(region) \ + __ENUMERATE_ARIA_ROLE(roletype) \ + __ENUMERATE_ARIA_ROLE(row) \ + __ENUMERATE_ARIA_ROLE(rowgroup) \ + __ENUMERATE_ARIA_ROLE(rowheader) \ + __ENUMERATE_ARIA_ROLE(scrollbar) \ + __ENUMERATE_ARIA_ROLE(search) \ + __ENUMERATE_ARIA_ROLE(searchbox) \ + __ENUMERATE_ARIA_ROLE(section) \ + __ENUMERATE_ARIA_ROLE(sectionhead) \ + __ENUMERATE_ARIA_ROLE(select) \ + __ENUMERATE_ARIA_ROLE(separator) \ + __ENUMERATE_ARIA_ROLE(slider) \ + __ENUMERATE_ARIA_ROLE(spinbutton) \ + __ENUMERATE_ARIA_ROLE(status) \ + __ENUMERATE_ARIA_ROLE(strong) \ + __ENUMERATE_ARIA_ROLE(structure) \ + __ENUMERATE_ARIA_ROLE(subscript) \ + __ENUMERATE_ARIA_ROLE(superscript) \ + __ENUMERATE_ARIA_ROLE(switch_) \ + __ENUMERATE_ARIA_ROLE(tab) \ + __ENUMERATE_ARIA_ROLE(table) \ + __ENUMERATE_ARIA_ROLE(tablist) \ + __ENUMERATE_ARIA_ROLE(tabpanel) \ + __ENUMERATE_ARIA_ROLE(term) \ + __ENUMERATE_ARIA_ROLE(textbox) \ + __ENUMERATE_ARIA_ROLE(time) \ + __ENUMERATE_ARIA_ROLE(timer) \ + __ENUMERATE_ARIA_ROLE(toolbar) \ + __ENUMERATE_ARIA_ROLE(tooltip) \ + __ENUMERATE_ARIA_ROLE(tree) \ + __ENUMERATE_ARIA_ROLE(treegrid) \ + __ENUMERATE_ARIA_ROLE(treeitem) \ + __ENUMERATE_ARIA_ROLE(widget) \ + __ENUMERATE_ARIA_ROLE(window) + +enum class Role { +#define __ENUMERATE_ARIA_ROLE(name) name, + ENUMERATE_ARIA_ROLES +#undef __ENUMERATE_ARIA_ROLE +}; + +StringView role_name(Role); +Optional role_from_string(StringView role_name); + +bool is_abstract_role(Role); +bool is_widget_role(Role); +bool is_document_structure_role(Role); +bool is_landmark_role(Role); +bool is_live_region_role(Role); +bool is_windows_role(Role); + +bool is_non_abstract_role(Role); + +} diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 7d731441a4..a9cb0fc2e9 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -1,6 +1,9 @@ include(libweb_generators) set(SOURCES + ARIA/ARIAMixin.cpp + ARIA/ARIAMixin.idl + ARIA/Roles.cpp Bindings/AudioConstructor.cpp Bindings/CSSNamespace.cpp Bindings/FetchMethod.cpp @@ -75,9 +78,6 @@ set(SOURCES DOM/AccessibilityTreeNode.cpp DOM/Attr.cpp DOM/Attr.idl - DOM/ARIAMixin.cpp - DOM/ARIAMixin.idl - DOM/ARIARoles.cpp DOM/CDATASection.cpp DOM/CharacterData.cpp DOM/CharacterData.idl diff --git a/Userland/Libraries/LibWeb/DOM/ARIAMixin.cpp b/Userland/Libraries/LibWeb/DOM/ARIAMixin.cpp deleted file mode 100644 index 533ae17464..0000000000 --- a/Userland/Libraries/LibWeb/DOM/ARIAMixin.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2022, Jonah Shafran - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include -#include - -namespace Web::DOM { - -// https://www.w3.org/TR/wai-aria-1.2/#introroles -Optional ARIAMixin::role_or_default() const -{ - // 1. Use the rules of the host language to detect that an element has a role attribute and to identify the attribute value string for it. - auto role_string = role(); - - // 2. Separate the attribute value string for that attribute into a sequence of whitespace-free substrings by separating on whitespace. - auto role_list = role_string.split_view(Infra::is_ascii_whitespace); - - // 3. Compare the substrings to all the names of the non-abstract WAI-ARIA roles. Case-sensitivity of the comparison inherits from the case-sensitivity of the host language. - for (auto const& role_name : role_list) { - // 4. Use the first such substring in textual order that matches the name of a non-abstract WAI-ARIA role. - auto role = ARIARoles::from_string(role_name); - if (!role.has_value()) - continue; - if (ARIARoles::is_non_abstract_aria_role(*role)) - return *role; - } - - // https://www.w3.org/TR/wai-aria-1.2/#document-handling_author-errors_roles - // If the role attribute contains no tokens matching the name of a non-abstract WAI-ARIA role, the user agent MUST treat the element as if no role had been provided. - // https://www.w3.org/TR/wai-aria-1.2/#implicit_semantics - return default_role(); -} - -// https://www.w3.org/TR/wai-aria-1.2/#global_states -bool ARIAMixin::has_global_aria_attribute() const -{ - return !aria_atomic().is_null() - || !aria_busy().is_null() - || !aria_controls().is_null() - || !aria_current().is_null() - || !aria_described_by().is_null() - || !aria_details().is_null() - || !aria_disabled().is_null() - || !aria_drop_effect().is_null() - || !aria_error_message().is_null() - || !aria_flow_to().is_null() - || !aria_grabbed().is_null() - || !aria_has_popup().is_null() - || !aria_hidden().is_null() - || !aria_invalid().is_null() - || !aria_key_shortcuts().is_null() - || !aria_label().is_null() - || !aria_labelled_by().is_null() - || !aria_live().is_null() - || !aria_owns().is_null() - || !aria_relevant().is_null() - || !aria_role_description().is_null(); -} - -} diff --git a/Userland/Libraries/LibWeb/DOM/ARIAMixin.h b/Userland/Libraries/LibWeb/DOM/ARIAMixin.h deleted file mode 100644 index f9c3934fdb..0000000000 --- a/Userland/Libraries/LibWeb/DOM/ARIAMixin.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2022, Jonah Shafran - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include -#include -#include - -namespace Web::DOM { - -class ARIAMixin { - -public: - virtual ~ARIAMixin() = default; - - virtual DeprecatedString role() const = 0; - virtual WebIDL::ExceptionOr set_role(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_active_descendant() const = 0; - virtual WebIDL::ExceptionOr set_aria_active_descendant(DeprecatedString const&) = 0; - virtual DeprecatedString aria_atomic() const = 0; - virtual WebIDL::ExceptionOr set_aria_atomic(DeprecatedString const&) = 0; - virtual DeprecatedString aria_auto_complete() const = 0; - virtual WebIDL::ExceptionOr set_aria_auto_complete(DeprecatedString const&) = 0; - virtual DeprecatedString aria_busy() const = 0; - virtual WebIDL::ExceptionOr set_aria_busy(DeprecatedString const&) = 0; - virtual DeprecatedString aria_checked() const = 0; - virtual WebIDL::ExceptionOr set_aria_checked(DeprecatedString const&) = 0; - virtual DeprecatedString aria_col_count() const = 0; - virtual WebIDL::ExceptionOr set_aria_col_count(DeprecatedString const&) = 0; - virtual DeprecatedString aria_col_index() const = 0; - virtual WebIDL::ExceptionOr set_aria_col_index(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_col_span() const = 0; - virtual WebIDL::ExceptionOr set_aria_col_span(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_controls() const = 0; - virtual WebIDL::ExceptionOr set_aria_controls(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_current() const = 0; - virtual WebIDL::ExceptionOr set_aria_current(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_described_by() const = 0; - virtual WebIDL::ExceptionOr set_aria_described_by(DeprecatedString const&) = 0; - virtual DeprecatedString aria_details() const = 0; - virtual WebIDL::ExceptionOr set_aria_details(DeprecatedString const&) = 0; - virtual DeprecatedString aria_drop_effect() const = 0; - virtual WebIDL::ExceptionOr set_aria_drop_effect(DeprecatedString const&) = 0; - virtual DeprecatedString aria_error_message() const = 0; - virtual WebIDL::ExceptionOr set_aria_error_message(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_disabled() const = 0; - virtual WebIDL::ExceptionOr set_aria_disabled(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_expanded() const = 0; - virtual WebIDL::ExceptionOr set_aria_expanded(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_flow_to() const = 0; - virtual WebIDL::ExceptionOr set_aria_flow_to(DeprecatedString const&) = 0; - virtual DeprecatedString aria_grabbed() const = 0; - virtual WebIDL::ExceptionOr set_aria_grabbed(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_has_popup() const = 0; - virtual WebIDL::ExceptionOr set_aria_has_popup(DeprecatedString const&) = 0; - virtual DeprecatedString aria_hidden() const = 0; - virtual WebIDL::ExceptionOr set_aria_hidden(DeprecatedString const&) = 0; - virtual DeprecatedString aria_invalid() const = 0; - virtual WebIDL::ExceptionOr set_aria_invalid(DeprecatedString const&) = 0; - virtual DeprecatedString aria_key_shortcuts() const = 0; - virtual WebIDL::ExceptionOr set_aria_key_shortcuts(DeprecatedString const&) = 0; - virtual DeprecatedString aria_label() const = 0; - virtual WebIDL::ExceptionOr set_aria_label(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_labelled_by() const = 0; - virtual WebIDL::ExceptionOr set_aria_labelled_by(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_level() const = 0; - virtual WebIDL::ExceptionOr set_aria_level(DeprecatedString const&) = 0; - virtual DeprecatedString aria_live() const = 0; - virtual WebIDL::ExceptionOr set_aria_live(DeprecatedString const&) = 0; - virtual DeprecatedString aria_modal() const = 0; - virtual WebIDL::ExceptionOr set_aria_modal(DeprecatedString const&) = 0; - virtual DeprecatedString aria_multi_line() const = 0; - virtual WebIDL::ExceptionOr set_aria_multi_line(DeprecatedString const&) = 0; - virtual DeprecatedString aria_multi_selectable() const = 0; - virtual WebIDL::ExceptionOr set_aria_multi_selectable(DeprecatedString const&) = 0; - virtual DeprecatedString aria_orientation() const = 0; - virtual WebIDL::ExceptionOr set_aria_orientation(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_owns() const = 0; - virtual WebIDL::ExceptionOr set_aria_owns(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_placeholder() const = 0; - virtual WebIDL::ExceptionOr set_aria_placeholder(DeprecatedString const&) = 0; - virtual DeprecatedString aria_pos_in_set() const = 0; - virtual WebIDL::ExceptionOr set_aria_pos_in_set(DeprecatedString const&) = 0; - virtual DeprecatedString aria_pressed() const = 0; - virtual WebIDL::ExceptionOr set_aria_pressed(DeprecatedString const&) = 0; - virtual DeprecatedString aria_read_only() const = 0; - virtual WebIDL::ExceptionOr set_aria_read_only(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_relevant() const = 0; - virtual WebIDL::ExceptionOr set_aria_relevant(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_required() const = 0; - virtual WebIDL::ExceptionOr set_aria_required(DeprecatedString const&) = 0; - virtual DeprecatedString aria_role_description() const = 0; - virtual WebIDL::ExceptionOr set_aria_role_description(DeprecatedString const&) = 0; - virtual DeprecatedString aria_row_count() const = 0; - virtual WebIDL::ExceptionOr set_aria_row_count(DeprecatedString const&) = 0; - virtual DeprecatedString aria_row_index() const = 0; - virtual WebIDL::ExceptionOr set_aria_row_index(DeprecatedString const&) = 0; - - virtual DeprecatedString aria_row_span() const = 0; - virtual WebIDL::ExceptionOr set_aria_row_span(DeprecatedString const&) = 0; - virtual DeprecatedString aria_selected() const = 0; - virtual WebIDL::ExceptionOr set_aria_selected(DeprecatedString const&) = 0; - virtual DeprecatedString aria_set_size() const = 0; - virtual WebIDL::ExceptionOr set_aria_set_size(DeprecatedString const&) = 0; - virtual DeprecatedString aria_sort() const = 0; - virtual WebIDL::ExceptionOr set_aria_sort(DeprecatedString const&) = 0; - virtual DeprecatedString aria_value_max() const = 0; - virtual WebIDL::ExceptionOr set_aria_value_max(DeprecatedString const&) = 0; - virtual DeprecatedString aria_value_min() const = 0; - virtual WebIDL::ExceptionOr set_aria_value_min(DeprecatedString const&) = 0; - virtual DeprecatedString aria_value_now() const = 0; - virtual WebIDL::ExceptionOr set_aria_value_now(DeprecatedString const&) = 0; - virtual DeprecatedString aria_value_text() const = 0; - virtual WebIDL::ExceptionOr set_aria_value_text(DeprecatedString const&) = 0; - - // https://www.w3.org/TR/html-aria/#docconformance - virtual Optional default_role() const { return {}; }; - - Optional role_or_default() const; - - // https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion - virtual bool exclude_from_accessibility_tree() const = 0; - - // https://www.w3.org/TR/wai-aria-1.2/#tree_inclusion - virtual bool include_in_accessibility_tree() const = 0; - - bool has_global_aria_attribute() const; - -protected: - ARIAMixin() = default; -}; - -} diff --git a/Userland/Libraries/LibWeb/DOM/ARIAMixin.idl b/Userland/Libraries/LibWeb/DOM/ARIAMixin.idl deleted file mode 100644 index f608e238a9..0000000000 --- a/Userland/Libraries/LibWeb/DOM/ARIAMixin.idl +++ /dev/null @@ -1,53 +0,0 @@ -// https://www.w3.org/TR/wai-aria-1.2/#ARIAMixin -interface mixin ARIAMixin { - attribute DOMString? role; - - attribute DOMString? ariaAtomic; - attribute DOMString? ariaAutoComplete; - attribute DOMString? ariaBusy; - attribute DOMString? ariaChecked; - attribute DOMString? ariaColCount; - attribute DOMString? ariaColIndex; - - attribute DOMString? ariaColSpan; - - attribute DOMString? ariaCurrent; - - - - attribute DOMString? ariaDisabled; - - attribute DOMString? ariaExpanded; - - attribute DOMString? ariaHasPopup; - attribute DOMString? ariaHidden; - attribute DOMString? ariaInvalid; - attribute DOMString? ariaKeyShortcuts; - attribute DOMString? ariaLabel; - - attribute DOMString? ariaLevel; - attribute DOMString? ariaLive; - attribute DOMString? ariaModal; - attribute DOMString? ariaMultiLine; - attribute DOMString? ariaMultiSelectable; - attribute DOMString? ariaOrientation; - - attribute DOMString? ariaPlaceholder; - attribute DOMString? ariaPosInSet; - attribute DOMString? ariaPressed; - attribute DOMString? ariaReadOnly; - - attribute DOMString? ariaRequired; - attribute DOMString? ariaRoleDescription; - attribute DOMString? ariaRowCount; - attribute DOMString? ariaRowIndex; - - attribute DOMString? ariaRowSpan; - attribute DOMString? ariaSelected; - attribute DOMString? ariaSetSize; - attribute DOMString? ariaSort; - attribute DOMString? ariaValueMax; - attribute DOMString? ariaValueMin; - attribute DOMString? ariaValueNow; - attribute DOMString? ariaValueText; -}; diff --git a/Userland/Libraries/LibWeb/DOM/ARIARoles.cpp b/Userland/Libraries/LibWeb/DOM/ARIARoles.cpp deleted file mode 100644 index 01cc21c50a..0000000000 --- a/Userland/Libraries/LibWeb/DOM/ARIARoles.cpp +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2022, Jonah Shafran - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#include -#include - -namespace Web::DOM::ARIARoles { - -StringView role_name(Role role) -{ - switch (role) { -#define __ENUMERATE_ARIA_ROLE(name) \ - case Role::name: \ - return #name##sv; - ENUMERATE_ARIA_ROLES -#undef __ENUMERATE_ARIA_ROLE - default: - VERIFY_NOT_REACHED(); - } -} - -Optional from_string(StringView role_name) -{ -#define __ENUMERATE_ARIA_ROLE(name) \ - if (role_name.equals_ignoring_case(#name##sv)) \ - return Role::name; - ENUMERATE_ARIA_ROLES -#undef __ENUMERATE_ARIA_ROLE - return {}; -} - -// https://www.w3.org/TR/wai-aria-1.2/#abstract_roles -bool is_abstract_aria_role(Role role) -{ - return first_is_one_of(role, - Role::command, - Role::composite, - Role::input, - Role::landmark, - Role::range, - Role::roletype, - Role::section, - Role::sectionhead, - Role::select, - Role::structure, - Role::widget, - Role::window); -} - -// https://www.w3.org/TR/wai-aria-1.2/#widget_roles -bool is_widget_aria_role(Role role) -{ - return first_is_one_of(role, - Role::button, - Role::checkbox, - Role::gridcell, - Role::link, - Role::menuitem, - Role::menuitemcheckbox, - Role::option, - Role::progressbar, - Role::radio, - Role::scrollbar, - Role::searchbox, - Role::separator, // TODO: Only when focusable - Role::slider, - Role::spinbutton, - Role::switch_, - Role::tab, - Role::tabpanel, - Role::textbox, - Role::treeitem, - Role::combobox, - Role::grid, - Role::listbox, - Role::menu, - Role::menubar, - Role::radiogroup, - Role::tablist, - Role::tree, - Role::treegrid); -} - -// https://www.w3.org/TR/wai-aria-1.2/#document_structure_roles -bool is_document_structure_aria_role(Role role) -{ - return first_is_one_of(role, - Role::application, - Role::article, - Role::blockquote, - Role::caption, - Role::cell, - Role::columnheader, - Role::definition, - Role::deletion, - Role::directory, - Role::document, - Role::emphasis, - Role::feed, - Role::figure, - Role::generic, - Role::group, - Role::heading, - Role::img, - Role::insertion, - Role::list, - Role::listitem, - Role::math, - Role::meter, - Role::none, - Role::note, - Role::paragraph, - Role::presentation, - Role::row, - Role::rowgroup, - Role::rowheader, - Role::separator, // TODO: Only when not focusable - Role::strong, - Role::subscript, - Role::table, - Role::term, - Role::time, - Role::toolbar, - Role::tooltip); -} - -// https://www.w3.org/TR/wai-aria-1.2/#landmark_roles -bool is_landmark_aria_role(Role role) -{ - return first_is_one_of(role, - Role::banner, - Role::complementary, - Role::contentinfo, - Role::form, - Role::main, - Role::navigation, - Role::region, - Role::search); -} - -// https://www.w3.org/TR/wai-aria-1.2/#live_region_roles -bool is_live_region_aria_role(Role role) -{ - return first_is_one_of(role, - Role::alert, - Role::log, - Role::marquee, - Role::status, - Role::timer); -} - -// https://www.w3.org/TR/wai-aria-1.2/#window_roles -bool is_windows_aria_role(Role role) -{ - return first_is_one_of(role, - Role::alertdialog, - Role::dialog); -} - -bool is_non_abstract_aria_role(Role role) -{ - return is_widget_aria_role(role) - || is_document_structure_aria_role(role) - || is_landmark_aria_role(role) - || is_live_region_aria_role(role) - || is_windows_aria_role(role); -} - -} diff --git a/Userland/Libraries/LibWeb/DOM/ARIARoles.h b/Userland/Libraries/LibWeb/DOM/ARIARoles.h deleted file mode 100644 index 5efab6dd6c..0000000000 --- a/Userland/Libraries/LibWeb/DOM/ARIARoles.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2022, Jonah Shafran - * - * SPDX-License-Identifier: BSD-2-Clause - */ - -#pragma once - -#include - -namespace Web::DOM::ARIARoles { - -#define ENUMERATE_ARIA_ROLES \ - __ENUMERATE_ARIA_ROLE(alert) \ - __ENUMERATE_ARIA_ROLE(alertdialog) \ - __ENUMERATE_ARIA_ROLE(application) \ - __ENUMERATE_ARIA_ROLE(article) \ - __ENUMERATE_ARIA_ROLE(banner) \ - __ENUMERATE_ARIA_ROLE(blockquote) \ - __ENUMERATE_ARIA_ROLE(button) \ - __ENUMERATE_ARIA_ROLE(caption) \ - __ENUMERATE_ARIA_ROLE(cell) \ - __ENUMERATE_ARIA_ROLE(checkbox) \ - __ENUMERATE_ARIA_ROLE(code) \ - __ENUMERATE_ARIA_ROLE(columnheader) \ - __ENUMERATE_ARIA_ROLE(combobox) \ - __ENUMERATE_ARIA_ROLE(command) \ - __ENUMERATE_ARIA_ROLE(complementary) \ - __ENUMERATE_ARIA_ROLE(composite) \ - __ENUMERATE_ARIA_ROLE(contentinfo) \ - __ENUMERATE_ARIA_ROLE(definition) \ - __ENUMERATE_ARIA_ROLE(deletion) \ - __ENUMERATE_ARIA_ROLE(dialog) \ - __ENUMERATE_ARIA_ROLE(directory) \ - __ENUMERATE_ARIA_ROLE(document) \ - __ENUMERATE_ARIA_ROLE(emphasis) \ - __ENUMERATE_ARIA_ROLE(feed) \ - __ENUMERATE_ARIA_ROLE(figure) \ - __ENUMERATE_ARIA_ROLE(form) \ - __ENUMERATE_ARIA_ROLE(generic) \ - __ENUMERATE_ARIA_ROLE(grid) \ - __ENUMERATE_ARIA_ROLE(gridcell) \ - __ENUMERATE_ARIA_ROLE(group) \ - __ENUMERATE_ARIA_ROLE(heading) \ - __ENUMERATE_ARIA_ROLE(img) \ - __ENUMERATE_ARIA_ROLE(input) \ - __ENUMERATE_ARIA_ROLE(insertion) \ - __ENUMERATE_ARIA_ROLE(landmark) \ - __ENUMERATE_ARIA_ROLE(link) \ - __ENUMERATE_ARIA_ROLE(list) \ - __ENUMERATE_ARIA_ROLE(listbox) \ - __ENUMERATE_ARIA_ROLE(listitem) \ - __ENUMERATE_ARIA_ROLE(log) \ - __ENUMERATE_ARIA_ROLE(main) \ - __ENUMERATE_ARIA_ROLE(marquee) \ - __ENUMERATE_ARIA_ROLE(math) \ - __ENUMERATE_ARIA_ROLE(meter) \ - __ENUMERATE_ARIA_ROLE(menu) \ - __ENUMERATE_ARIA_ROLE(menubar) \ - __ENUMERATE_ARIA_ROLE(menuitem) \ - __ENUMERATE_ARIA_ROLE(menuitemcheckbox) \ - __ENUMERATE_ARIA_ROLE(menuitemradio) \ - __ENUMERATE_ARIA_ROLE(navigation) \ - __ENUMERATE_ARIA_ROLE(none) \ - __ENUMERATE_ARIA_ROLE(note) \ - __ENUMERATE_ARIA_ROLE(option) \ - __ENUMERATE_ARIA_ROLE(paragraph) \ - __ENUMERATE_ARIA_ROLE(presentation) \ - __ENUMERATE_ARIA_ROLE(progressbar) \ - __ENUMERATE_ARIA_ROLE(radio) \ - __ENUMERATE_ARIA_ROLE(radiogroup) \ - __ENUMERATE_ARIA_ROLE(range) \ - __ENUMERATE_ARIA_ROLE(region) \ - __ENUMERATE_ARIA_ROLE(roletype) \ - __ENUMERATE_ARIA_ROLE(row) \ - __ENUMERATE_ARIA_ROLE(rowgroup) \ - __ENUMERATE_ARIA_ROLE(rowheader) \ - __ENUMERATE_ARIA_ROLE(scrollbar) \ - __ENUMERATE_ARIA_ROLE(search) \ - __ENUMERATE_ARIA_ROLE(searchbox) \ - __ENUMERATE_ARIA_ROLE(section) \ - __ENUMERATE_ARIA_ROLE(sectionhead) \ - __ENUMERATE_ARIA_ROLE(select) \ - __ENUMERATE_ARIA_ROLE(separator) \ - __ENUMERATE_ARIA_ROLE(slider) \ - __ENUMERATE_ARIA_ROLE(spinbutton) \ - __ENUMERATE_ARIA_ROLE(status) \ - __ENUMERATE_ARIA_ROLE(strong) \ - __ENUMERATE_ARIA_ROLE(structure) \ - __ENUMERATE_ARIA_ROLE(subscript) \ - __ENUMERATE_ARIA_ROLE(superscript) \ - __ENUMERATE_ARIA_ROLE(switch_) \ - __ENUMERATE_ARIA_ROLE(tab) \ - __ENUMERATE_ARIA_ROLE(table) \ - __ENUMERATE_ARIA_ROLE(tablist) \ - __ENUMERATE_ARIA_ROLE(tabpanel) \ - __ENUMERATE_ARIA_ROLE(term) \ - __ENUMERATE_ARIA_ROLE(textbox) \ - __ENUMERATE_ARIA_ROLE(time) \ - __ENUMERATE_ARIA_ROLE(timer) \ - __ENUMERATE_ARIA_ROLE(toolbar) \ - __ENUMERATE_ARIA_ROLE(tooltip) \ - __ENUMERATE_ARIA_ROLE(tree) \ - __ENUMERATE_ARIA_ROLE(treegrid) \ - __ENUMERATE_ARIA_ROLE(treeitem) \ - __ENUMERATE_ARIA_ROLE(widget) \ - __ENUMERATE_ARIA_ROLE(window) - -enum class Role { -#define __ENUMERATE_ARIA_ROLE(name) name, - ENUMERATE_ARIA_ROLES -#undef __ENUMERATE_ARIA_ROLE -}; - -StringView role_name(Role); -Optional from_string(StringView role_name); - -bool is_abstract_aria_role(Role); -bool is_widget_aria_role(Role); -bool is_document_structure_aria_role(Role); -bool is_landmark_aria_role(Role); -bool is_live_region_aria_role(Role); -bool is_windows_aria_role(Role); - -bool is_non_abstract_aria_role(Role); - -} diff --git a/Userland/Libraries/LibWeb/DOM/AccessibilityTreeNode.cpp b/Userland/Libraries/LibWeb/DOM/AccessibilityTreeNode.cpp index 49c5ccff49..d70f93eb9f 100644 --- a/Userland/Libraries/LibWeb/DOM/AccessibilityTreeNode.cpp +++ b/Userland/Libraries/LibWeb/DOM/AccessibilityTreeNode.cpp @@ -35,10 +35,10 @@ void AccessibilityTreeNode::serialize_tree_as_json(JsonObjectSerializerrole_or_default(); - bool has_role = role.has_value() && !ARIARoles::is_abstract_aria_role(*role); + bool has_role = role.has_value() && !ARIA::is_abstract_role(*role); if (has_role) - MUST(object.add("role"sv, ARIARoles::role_name(*role))); + MUST(object.add("role"sv, ARIA::role_name(*role))); else MUST(object.add("role"sv, ""sv)); } else { diff --git a/Userland/Libraries/LibWeb/DOM/Element.cpp b/Userland/Libraries/LibWeb/DOM/Element.cpp index 9d82cf0a79..e4d952fa30 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.cpp +++ b/Userland/Libraries/LibWeb/DOM/Element.cpp @@ -1285,7 +1285,7 @@ bool Element::exclude_from_accessibility_tree() const // Elements with none or presentation as the first role in the role attribute. However, their exclusion is conditional. In addition, the element's descendants and text content are generally included. These exceptions and conditions are documented in the presentation (role) section. // FIXME: Handle exceptions to excluding presentation role auto role = role_or_default(); - if (role == ARIARoles::Role::none || role == ARIARoles::Role::presentation) + if (role == ARIA::Role::none || role == ARIA::Role::presentation) return true; // TODO: If not already excluded from the accessibility tree per the above rules, user agents SHOULD NOT include the following elements in the accessibility tree: diff --git a/Userland/Libraries/LibWeb/DOM/Element.h b/Userland/Libraries/LibWeb/DOM/Element.h index 3cf48c80cc..48356195f3 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.h +++ b/Userland/Libraries/LibWeb/DOM/Element.h @@ -8,10 +8,10 @@ #include #include +#include #include #include #include -#include #include #include #include @@ -42,7 +42,7 @@ class Element : public ParentNode , public ChildNode , public NonDocumentTypeChildNode - , public ARIAMixin { + , public ARIA::ARIAMixin { WEB_PLATFORM_OBJECT(Element, ParentNode); public: diff --git a/Userland/Libraries/LibWeb/DOM/Element.idl b/Userland/Libraries/LibWeb/DOM/Element.idl index c152206aa2..0417bbb216 100644 --- a/Userland/Libraries/LibWeb/DOM/Element.idl +++ b/Userland/Libraries/LibWeb/DOM/Element.idl @@ -1,6 +1,6 @@ +#import #import #import -#import #import #import #import diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index 8be743194d..6958a7dedf 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp index 3ad875c00d..311236b97e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include @@ -91,13 +91,13 @@ i32 HTMLAnchorElement::default_tab_index_value() const return 0; } -Optional HTMLAnchorElement::default_role() const +Optional HTMLAnchorElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-a-no-href if (!href().is_null()) - return DOM::ARIARoles::Role::link; + return ARIA::Role::link; // https://www.w3.org/TR/html-aria/#el-a - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h index 0f6d9d864b..64a90ca469 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h @@ -53,7 +53,7 @@ private: queue_an_element_task(source, move(steps)); } - virtual Optional default_role() const override; + virtual Optional default_role() const override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp index accb0eb3ee..99a48fd4df 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include #include #include @@ -50,13 +50,13 @@ i32 HTMLAreaElement::default_tab_index_value() const return 0; } -Optional HTMLAreaElement::default_role() const +Optional HTMLAreaElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-area-no-href if (!href().is_null()) - return DOM::ARIARoles::Role::link; + return ARIA::Role::link; // https://www.w3.org/TR/html-aria/#el-area - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h index 2f52e7d8e7..936b207da6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h @@ -42,7 +42,7 @@ private: queue_an_element_task(source, move(steps)); } - virtual Optional default_role() const override; + virtual Optional default_role() const override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h index 39bf51605f..dc3725a3dc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include @@ -24,7 +24,7 @@ public: virtual void apply_presentational_hints(CSS::StyleProperties&) const override; // https://www.w3.org/TR/html-aria/#el-body - virtual Optional default_role() const override { return DOM::ARIARoles::Role::generic; }; + virtual Optional default_role() const override { return ARIA::Role::generic; }; private: HTMLBodyElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h index 3cd9499f86..3992033eca 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include @@ -57,7 +57,7 @@ public: virtual bool is_labelable() const override { return true; } // https://www.w3.org/TR/html-aria/#el-button - virtual Optional default_role() const override { return DOM::ARIARoles::Role::button; } + virtual Optional default_role() const override { return ARIA::Role::button; } private: HTMLButtonElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h index 3266bfc9a1..356659c326 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLDataElement() override; // https://www.w3.org/TR/html-aria/#el-data - virtual Optional default_role() const override { return DOM::ARIARoles::Role::generic; } + virtual Optional default_role() const override { return ARIA::Role::generic; } private: HTMLDataElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h index db0cf827ae..5512d1e978 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -17,7 +17,7 @@ class HTMLDataListElement final : public HTMLElement { public: virtual ~HTMLDataListElement() override; - virtual Optional default_role() const override { return DOM::ARIARoles::Role::listbox; } + virtual Optional default_role() const override { return ARIA::Role::listbox; } private: HTMLDataListElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h index 112e362ed3..9f621f516c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLDetailsElement() override; // https://www.w3.org/TR/html-aria/#el-details - virtual Optional default_role() const override { return DOM::ARIARoles::Role::group; }; + virtual Optional default_role() const override { return ARIA::Role::group; }; private: HTMLDetailsElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h index 78a24fd469..92525425be 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLDialogElement() override; // https://www.w3.org/TR/html-aria/#el-dialog - virtual Optional default_role() const override { return DOM::ARIARoles::Role::dialog; } + virtual Optional default_role() const override { return ARIA::Role::dialog; } private: HTMLDialogElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h index 37348a32e2..4af8c17e41 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLDivElement() override; // https://www.w3.org/TR/html-aria/#el-div - virtual Optional default_role() const override { return DOM::ARIARoles::Role::generic; } + virtual Optional default_role() const override { return ARIA::Role::generic; } private: HTMLDivElement(DOM::Document&, DOM::QualifiedName); 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 #include -#include +#include #include #include #include @@ -331,86 +331,86 @@ void HTMLElement::blur() // User agents may selectively or uniformly ignore calls to this method for usability reasons. } -Optional HTMLElement::default_role() const +Optional 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 {}; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.h b/Userland/Libraries/LibWeb/HTML/HTMLElement.h index 24808802aa..e5a81afd96 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.h @@ -59,7 +59,7 @@ public: // https://html.spec.whatwg.org/multipage/forms.html#category-label virtual bool is_labelable() const { return false; } - virtual Optional default_role() const override; + virtual Optional default_role() const override; protected: HTMLElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h index 2c3af63ed5..d51654f6f4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include @@ -36,7 +36,7 @@ public: // https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize virtual bool is_auto_capitalize_inheriting() const override { return true; } - virtual Optional default_role() const override { return DOM::ARIARoles::Role::group; } + virtual Optional default_role() const override { return ARIA::Role::group; } private: HTMLFieldSetElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h index de93f3629d..3673ba8038 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include #include @@ -38,7 +38,7 @@ public: unsigned length() const; // https://www.w3.org/TR/html-aria/#el-form - virtual Optional default_role() const override { return DOM::ARIARoles::Role::form; } + virtual Optional default_role() const override { return ARIA::Role::form; } private: HTMLFormElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h index ad58320baa..57bc3dd5ad 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLHRElement() override; // https://www.w3.org/TR/html-aria/#el-hr - virtual Optional default_role() const override { return DOM::ARIARoles::Role::separator; } + virtual Optional default_role() const override { return ARIA::Role::separator; } private: HTMLHRElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h index 9f02839b29..1478170599 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -20,7 +20,7 @@ public: virtual void apply_presentational_hints(CSS::StyleProperties&) const override; // https://www.w3.org/TR/html-aria/#el-h1-h6 - virtual Optional default_role() const override { return DOM::ARIARoles::Role::heading; } + virtual Optional default_role() const override { return ARIA::Role::heading; } virtual DeprecatedString aria_level() const override { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h index a11c54da5e..f132e32a62 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -20,7 +20,7 @@ public: bool should_use_body_background_properties() const; // https://www.w3.org/TR/html-aria/#el-html - virtual Optional default_role() const override { return DOM::ARIARoles::Role::document; } + virtual Optional default_role() const override { return ARIA::Role::document; } private: HTMLHtmlElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index aadcf6b51d..fa253d3e9e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -5,9 +5,9 @@ */ #include +#include #include #include -#include #include #include #include @@ -204,14 +204,14 @@ bool HTMLImageElement::complete() const return false; } -Optional HTMLImageElement::default_role() const +Optional HTMLImageElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-img // https://www.w3.org/TR/html-aria/#el-img-no-alt if (alt().is_null() || !alt().is_empty()) - return DOM::ARIARoles::Role::img; + return ARIA::Role::img; // https://www.w3.org/TR/html-aria/#el-img-empty-alt - return DOM::ARIARoles::Role::presentation; + return ARIA::Role::presentation; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h index d300fb4291..b7a3d8f33c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -43,7 +43,7 @@ public: // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete bool complete() const; - virtual Optional default_role() const override; + virtual Optional default_role() const override; private: HTMLImageElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 8fa2fcf654..490f16d660 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -872,32 +872,32 @@ WebIDL::ExceptionOr HTMLInputElement::set_selection_range(u32 start, u32 e return {}; } -Optional HTMLInputElement::default_role() const +Optional HTMLInputElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-input-button if (type_state() == TypeAttributeState::Button) - return DOM::ARIARoles::Role::button; + return ARIA::Role::button; // https://www.w3.org/TR/html-aria/#el-input-checkbox if (type_state() == TypeAttributeState::Checkbox) - return DOM::ARIARoles::Role::checkbox; + return ARIA::Role::checkbox; // https://www.w3.org/TR/html-aria/#el-input-email if (type_state() == TypeAttributeState::Email && attribute("list").is_null()) - return DOM::ARIARoles::Role::textbox; + return ARIA::Role::textbox; // https://www.w3.org/TR/html-aria/#el-input-image if (type_state() == TypeAttributeState::ImageButton) - return DOM::ARIARoles::Role::button; + return ARIA::Role::button; // https://www.w3.org/TR/html-aria/#el-input-number if (type_state() == TypeAttributeState::Number) - return DOM::ARIARoles::Role::spinbutton; + return ARIA::Role::spinbutton; // https://www.w3.org/TR/html-aria/#el-input-radio if (type_state() == TypeAttributeState::RadioButton) - return DOM::ARIARoles::Role::radio; + return ARIA::Role::radio; // https://www.w3.org/TR/html-aria/#el-input-range if (type_state() == TypeAttributeState::Range) - return DOM::ARIARoles::Role::slider; + return ARIA::Role::slider; // https://www.w3.org/TR/html-aria/#el-input-reset if (type_state() == TypeAttributeState::ResetButton) - return DOM::ARIARoles::Role::button; + return ARIA::Role::button; // https://www.w3.org/TR/html-aria/#el-input-text-list if ((type_state() == TypeAttributeState::Text || type_state() == TypeAttributeState::Search @@ -905,22 +905,22 @@ Optional HTMLInputElement::default_role() const || type_state() == TypeAttributeState::URL || type_state() == TypeAttributeState::Email) && !attribute("list").is_null()) - return DOM::ARIARoles::Role::combobox; + return ARIA::Role::combobox; // https://www.w3.org/TR/html-aria/#el-input-search if (type_state() == TypeAttributeState::Search && attribute("list").is_null()) - return DOM::ARIARoles::Role::textbox; + return ARIA::Role::textbox; // https://www.w3.org/TR/html-aria/#el-input-submit if (type_state() == TypeAttributeState::SubmitButton) - return DOM::ARIARoles::Role::button; + return ARIA::Role::button; // https://www.w3.org/TR/html-aria/#el-input-tel if (type_state() == TypeAttributeState::Telephone) - return DOM::ARIARoles::Role::textbox; + return ARIA::Role::textbox; // https://www.w3.org/TR/html-aria/#el-input-text if (type_state() == TypeAttributeState::Text && attribute("list").is_null()) - return DOM::ARIARoles::Role::textbox; + return ARIA::Role::textbox; // https://www.w3.org/TR/html-aria/#el-input-url if (type_state() == TypeAttributeState::URL && attribute("list").is_null()) - return DOM::ARIARoles::Role::textbox; + return ARIA::Role::textbox; // https://www.w3.org/TR/html-aria/#el-input-color // https://www.w3.org/TR/html-aria/#el-input-date diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index cc1dd564e4..41a82ce5ce 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -120,7 +120,7 @@ public: // https://html.spec.whatwg.org/multipage/forms.html#category-label virtual bool is_labelable() const override { return type_state() != TypeAttributeState::Hidden; } - virtual Optional default_role() const override; + virtual Optional default_role() const override; private: HTMLInputElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h index 1295619c3e..445833b557 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLLIElement() override; // https://www.w3.org/TR/html-aria/#el-li - virtual Optional default_role() const override { return DOM::ARIARoles::Role::listitem; }; + virtual Optional default_role() const override { return ARIA::Role::listitem; }; private: HTMLLIElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h index feb831fd67..2daf881fea 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLMenuElement() override; // https://www.w3.org/TR/html-aria/#el-menu - virtual Optional default_role() const override { return DOM::ARIARoles::Role::list; } + virtual Optional default_role() const override { return ARIA::Role::list; } private: HTMLMenuElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h index 50d5c0613f..f690bf992f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -23,7 +23,7 @@ public: virtual bool is_labelable() const override { return true; } // https://www.w3.org/TR/html-aria/#el-meter - virtual Optional default_role() const override { return DOM::ARIARoles::Role::meter; } + virtual Optional default_role() const override { return ARIA::Role::meter; } private: HTMLMeterElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp index 98f2f967f6..9535e10342 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp @@ -25,14 +25,14 @@ JS::ThrowCompletionOr HTMLModElement::initialize(JS::Realm& realm) return {}; } -Optional HTMLModElement::default_role() const +Optional HTMLModElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-del if (local_name() == TagNames::del) - return DOM::ARIARoles::Role::deletion; + return ARIA::Role::deletion; // https://www.w3.org/TR/html-aria/#el-ins if (local_name() == TagNames::ins) - return DOM::ARIARoles::Role::insertion; + return ARIA::Role::insertion; VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.h b/Userland/Libraries/LibWeb/HTML/HTMLModElement.h index b710d0936c..65bb5672a7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLModElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -17,7 +17,7 @@ class HTMLModElement final : public HTMLElement { public: virtual ~HTMLModElement() override; - virtual Optional default_role() const override; + virtual Optional default_role() const override; private: HTMLModElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h index 423251be5d..92e5a18c36 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLOListElement() override; // https://www.w3.org/TR/html-aria/#el-ol - virtual Optional default_role() const override { return DOM::ARIARoles::Role::list; } + virtual Optional default_role() const override { return ARIA::Role::list; } private: HTMLOListElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h index 7e78eb6811..033c2b42b1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLOptGroupElement() override; // https://www.w3.org/TR/html-aria/#el-optgroup - virtual Optional default_role() const override { return DOM::ARIARoles::Role::group; } + virtual Optional default_role() const override { return ARIA::Role::group; } private: HTMLOptGroupElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp index 1f4f64b0f1..72d3f1036d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp @@ -6,8 +6,8 @@ */ #include +#include #include -#include #include #include #include @@ -148,11 +148,11 @@ bool HTMLOptionElement::disabled() const || (parent() && is(parent()) && static_cast(*parent()).has_attribute(AttributeNames::disabled)); } -Optional HTMLOptionElement::default_role() const +Optional HTMLOptionElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-option // TODO: Only an option element that is in a list of options or that represents a suggestion in a datalist should return option - return DOM::ARIARoles::Role::option; + return ARIA::Role::option; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h index fd71690c33..6efbad510b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h @@ -30,7 +30,7 @@ public: bool disabled() const; - virtual Optional default_role() const override; + virtual Optional default_role() const override; private: friend class Bindings::OptionConstructor; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h index 12a19e8820..2beb9a4451 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -45,7 +45,7 @@ public: virtual void reset_algorithm() override; // https://www.w3.org/TR/html-aria/#el-output - virtual Optional default_role() const override { return DOM::ARIARoles::Role::status; } + virtual Optional default_role() const override { return ARIA::Role::status; } private: HTMLOutputElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h index 519dd7cd83..43abe2b14a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -20,7 +20,7 @@ public: virtual void apply_presentational_hints(CSS::StyleProperties&) const override; // https://www.w3.org/TR/html-aria/#el-p - virtual Optional default_role() const override { return DOM::ARIARoles::Role::paragraph; } + virtual Optional default_role() const override { return ARIA::Role::paragraph; } private: HTMLParagraphElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h index db7fd5c8da..0dfee07ea1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLPreElement() override; // https://www.w3.org/TR/html-aria/#el-pre - virtual Optional default_role() const override { return DOM::ARIARoles::Role::generic; } + virtual Optional default_role() const override { return ARIA::Role::generic; } private: HTMLPreElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h index 9ff233211c..5417d3ff50 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -34,7 +34,7 @@ public: bool using_system_appearance() const; // https://www.w3.org/TR/html-aria/#el-progress - virtual Optional default_role() const override { return DOM::ARIARoles::Role::progressbar; } + virtual Optional default_role() const override { return ARIA::Role::progressbar; } private: HTMLProgressElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp index 21dad595a1..97d0de1c5f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp @@ -5,8 +5,8 @@ */ #include +#include #include -#include #include namespace Web::HTML { @@ -26,14 +26,14 @@ JS::ThrowCompletionOr HTMLQuoteElement::initialize(JS::Realm& realm) return {}; } -Optional HTMLQuoteElement::default_role() const +Optional HTMLQuoteElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-blockquote if (local_name() == TagNames::blockquote) - return DOM::ARIARoles::Role::blockquote; + return ARIA::Role::blockquote; // https://www.w3.org/TR/html-aria/#el-q if (local_name() == TagNames::q) - return DOM::ARIARoles::Role::generic; + return ARIA::Role::generic; VERIFY_NOT_REACHED(); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h index ccc80188f9..57e9c99375 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h @@ -16,7 +16,7 @@ class HTMLQuoteElement final : public HTMLElement { public: virtual ~HTMLQuoteElement() override; - virtual Optional default_role() const override; + virtual Optional default_role() const override; private: HTMLQuoteElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp index 60d11670f8..f1fcbfcca8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp @@ -163,18 +163,18 @@ DeprecatedString const& HTMLSelectElement::type() const return select_multiple; } -Optional HTMLSelectElement::default_role() const +Optional HTMLSelectElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-select-multiple-or-size-greater-1 if (has_attribute("multiple")) - return DOM::ARIARoles::Role::listbox; + return ARIA::Role::listbox; if (has_attribute("size")) { auto size_attribute = attribute("size").to_int(); if (size_attribute.has_value() && size_attribute.value() > 1) - return DOM::ARIARoles::Role::listbox; + return ARIA::Role::listbox; } // https://www.w3.org/TR/html-aria/#el-select - return DOM::ARIARoles::Role::combobox; + return ARIA::Role::combobox; } } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h index 2746422ec5..1339ad5356 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h @@ -60,7 +60,7 @@ public: DeprecatedString const& type() const; - virtual Optional default_role() const override; + virtual Optional default_role() const override; private: HTMLSelectElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h index 97d7e7f023..fc4388cf1d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLSpanElement() override; // https://www.w3.org/TR/html-aria/#el-span - virtual Optional default_role() const override { return DOM::ARIARoles::Role::generic; } + virtual Optional default_role() const override { return ARIA::Role::generic; } private: HTMLSpanElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h index e8e24d1e6c..eae99b7cea 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -20,7 +20,7 @@ public: virtual void apply_presentational_hints(CSS::StyleProperties&) const override; // https://www.w3.org/TR/html-aria/#el-caption - virtual Optional default_role() const override { return DOM::ARIARoles::Role::caption; } + virtual Optional default_role() const override { return ARIA::Role::caption; } private: HTMLTableCaptionElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp index 1204a56f9c..f962ebd75c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp @@ -76,7 +76,7 @@ void HTMLTableCellElement::set_row_span(unsigned int value) MUST(set_attribute(HTML::AttributeNames::rowspan, DeprecatedString::number(value))); } -Optional HTMLTableCellElement::default_role() const +Optional HTMLTableCellElement::default_role() const { // TODO: For td: // role=cell if the ancestor table element is exposed as a role=table diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h index b671a7e29b..5e5b681217 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h @@ -22,7 +22,7 @@ public: void set_col_span(unsigned); void set_row_span(unsigned); - virtual Optional default_role() const override; + virtual Optional default_role() const override; private: HTMLTableCellElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h index 2120927207..e4010a15c0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h @@ -43,7 +43,7 @@ public: WebIDL::ExceptionOr delete_row(long index); // https://www.w3.org/TR/html-aria/#el-table - virtual Optional default_role() const override { return DOM::ARIARoles::Role::table; } + virtual Optional default_role() const override { return ARIA::Role::table; } private: HTMLTableElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h index f5cf0b9320..dbef9b6d94 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -25,7 +25,7 @@ public: WebIDL::ExceptionOr delete_cell(i32 index); // https://www.w3.org/TR/html-aria/#el-tr - virtual Optional default_role() const override { return DOM::ARIARoles::Role::row; } + virtual Optional default_role() const override { return ARIA::Role::row; } private: HTMLTableRowElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h index a695de1f61..a53e9100bb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -25,7 +25,7 @@ public: // https://www.w3.org/TR/html-aria/#el-tbody // https://www.w3.org/TR/html-aria/#el-tfoot // https://www.w3.org/TR/html-aria/#el-thead - virtual Optional default_role() const override { return DOM::ARIARoles::Role::rowgroup; } + virtual Optional default_role() const override { return ARIA::Role::rowgroup; } private: HTMLTableSectionElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h index dccef8e876..72f1ca4014 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h @@ -7,7 +7,7 @@ #pragma once -#include +#include #include #include @@ -52,7 +52,7 @@ public: virtual void reset_algorithm() override; // https://www.w3.org/TR/html-aria/#el-textarea - virtual Optional default_role() const override { return DOM::ARIARoles::Role::textbox; } + virtual Optional default_role() const override { return ARIA::Role::textbox; } private: HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h index 573faa6118..208fcac3b7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLTimeElement() override; // https://www.w3.org/TR/html-aria/#el-time - virtual Optional default_role() const override { return DOM::ARIARoles::Role::time; } + virtual Optional default_role() const override { return ARIA::Role::time; } private: HTMLTimeElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h index 52b5fa6c58..180f2f44ab 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h @@ -6,7 +6,7 @@ #pragma once -#include +#include #include namespace Web::HTML { @@ -18,7 +18,7 @@ public: virtual ~HTMLUListElement() override; // https://www.w3.org/TR/html-aria/#el-ul - virtual Optional default_role() const override { return DOM::ARIARoles::Role::list; } + virtual Optional default_role() const override { return ARIA::Role::list; } private: HTMLUListElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Services/WebContent/WebDriverConnection.cpp b/Userland/Services/WebContent/WebDriverConnection.cpp index f45d9b2678..ec4116072d 100644 --- a/Userland/Services/WebContent/WebDriverConnection.cpp +++ b/Userland/Services/WebContent/WebDriverConnection.cpp @@ -1254,7 +1254,7 @@ Messages::WebDriverClient::GetComputedRoleResponse WebDriverConnection::get_comp // 5. Return success with data role. if (role.has_value()) - return Web::DOM::ARIARoles::role_name(*role); + return Web::ARIA::role_name(*role); return ""sv; } -- cgit v1.2.3