mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:58:11 +00:00
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.
This commit is contained in:
parent
8414734a2d
commit
8556d47240
61 changed files with 179 additions and 180 deletions
|
@ -4,14 +4,14 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIAMixin.h>
|
#include <LibWeb/ARIA/ARIAMixin.h>
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/Infra/CharacterTypes.h>
|
#include <LibWeb/Infra/CharacterTypes.h>
|
||||||
|
|
||||||
namespace Web::DOM {
|
namespace Web::ARIA {
|
||||||
|
|
||||||
// https://www.w3.org/TR/wai-aria-1.2/#introroles
|
// https://www.w3.org/TR/wai-aria-1.2/#introroles
|
||||||
Optional<ARIARoles::Role> ARIAMixin::role_or_default() const
|
Optional<Role> 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.
|
// 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();
|
auto role_string = role();
|
||||||
|
@ -22,10 +22,10 @@ Optional<ARIARoles::Role> ARIAMixin::role_or_default() const
|
||||||
// 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.
|
// 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) {
|
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.
|
// 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);
|
auto role = role_from_string(role_name);
|
||||||
if (!role.has_value())
|
if (!role.has_value())
|
||||||
continue;
|
continue;
|
||||||
if (ARIARoles::is_non_abstract_aria_role(*role))
|
if (is_non_abstract_role(*role))
|
||||||
return *role;
|
return *role;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/DeprecatedFlyString.h>
|
#include <AK/DeprecatedFlyString.h>
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||||
|
|
||||||
namespace Web::DOM {
|
namespace Web::ARIA {
|
||||||
|
|
||||||
class ARIAMixin {
|
class ARIAMixin {
|
||||||
|
|
||||||
|
@ -133,9 +133,9 @@ public:
|
||||||
virtual WebIDL::ExceptionOr<void> set_aria_value_text(DeprecatedString const&) = 0;
|
virtual WebIDL::ExceptionOr<void> set_aria_value_text(DeprecatedString const&) = 0;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#docconformance
|
// https://www.w3.org/TR/html-aria/#docconformance
|
||||||
virtual Optional<ARIARoles::Role> default_role() const { return {}; };
|
virtual Optional<Role> default_role() const { return {}; };
|
||||||
|
|
||||||
Optional<ARIARoles::Role> role_or_default() const;
|
Optional<Role> role_or_default() const;
|
||||||
|
|
||||||
// https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion
|
// https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion
|
||||||
virtual bool exclude_from_accessibility_tree() const = 0;
|
virtual bool exclude_from_accessibility_tree() const = 0;
|
|
@ -5,9 +5,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/GenericShorthands.h>
|
#include <AK/GenericShorthands.h>
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
|
|
||||||
namespace Web::DOM::ARIARoles {
|
namespace Web::ARIA {
|
||||||
|
|
||||||
StringView role_name(Role role)
|
StringView role_name(Role role)
|
||||||
{
|
{
|
||||||
|
@ -22,7 +22,7 @@ StringView role_name(Role role)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<Role> from_string(StringView role_name)
|
Optional<Role> role_from_string(StringView role_name)
|
||||||
{
|
{
|
||||||
#define __ENUMERATE_ARIA_ROLE(name) \
|
#define __ENUMERATE_ARIA_ROLE(name) \
|
||||||
if (role_name.equals_ignoring_case(#name##sv)) \
|
if (role_name.equals_ignoring_case(#name##sv)) \
|
||||||
|
@ -33,7 +33,7 @@ Optional<Role> from_string(StringView role_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.w3.org/TR/wai-aria-1.2/#abstract_roles
|
// https://www.w3.org/TR/wai-aria-1.2/#abstract_roles
|
||||||
bool is_abstract_aria_role(Role role)
|
bool is_abstract_role(Role role)
|
||||||
{
|
{
|
||||||
return first_is_one_of(role,
|
return first_is_one_of(role,
|
||||||
Role::command,
|
Role::command,
|
||||||
|
@ -51,7 +51,7 @@ bool is_abstract_aria_role(Role role)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.w3.org/TR/wai-aria-1.2/#widget_roles
|
// https://www.w3.org/TR/wai-aria-1.2/#widget_roles
|
||||||
bool is_widget_aria_role(Role role)
|
bool is_widget_role(Role role)
|
||||||
{
|
{
|
||||||
return first_is_one_of(role,
|
return first_is_one_of(role,
|
||||||
Role::button,
|
Role::button,
|
||||||
|
@ -85,7 +85,7 @@ bool is_widget_aria_role(Role role)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.w3.org/TR/wai-aria-1.2/#document_structure_roles
|
// https://www.w3.org/TR/wai-aria-1.2/#document_structure_roles
|
||||||
bool is_document_structure_aria_role(Role role)
|
bool is_document_structure_role(Role role)
|
||||||
{
|
{
|
||||||
return first_is_one_of(role,
|
return first_is_one_of(role,
|
||||||
Role::application,
|
Role::application,
|
||||||
|
@ -128,7 +128,7 @@ bool is_document_structure_aria_role(Role role)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.w3.org/TR/wai-aria-1.2/#landmark_roles
|
// https://www.w3.org/TR/wai-aria-1.2/#landmark_roles
|
||||||
bool is_landmark_aria_role(Role role)
|
bool is_landmark_role(Role role)
|
||||||
{
|
{
|
||||||
return first_is_one_of(role,
|
return first_is_one_of(role,
|
||||||
Role::banner,
|
Role::banner,
|
||||||
|
@ -142,7 +142,7 @@ bool is_landmark_aria_role(Role role)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.w3.org/TR/wai-aria-1.2/#live_region_roles
|
// https://www.w3.org/TR/wai-aria-1.2/#live_region_roles
|
||||||
bool is_live_region_aria_role(Role role)
|
bool is_live_region_role(Role role)
|
||||||
{
|
{
|
||||||
return first_is_one_of(role,
|
return first_is_one_of(role,
|
||||||
Role::alert,
|
Role::alert,
|
||||||
|
@ -153,20 +153,20 @@ bool is_live_region_aria_role(Role role)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://www.w3.org/TR/wai-aria-1.2/#window_roles
|
// https://www.w3.org/TR/wai-aria-1.2/#window_roles
|
||||||
bool is_windows_aria_role(Role role)
|
bool is_windows_role(Role role)
|
||||||
{
|
{
|
||||||
return first_is_one_of(role,
|
return first_is_one_of(role,
|
||||||
Role::alertdialog,
|
Role::alertdialog,
|
||||||
Role::dialog);
|
Role::dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_non_abstract_aria_role(Role role)
|
bool is_non_abstract_role(Role role)
|
||||||
{
|
{
|
||||||
return is_widget_aria_role(role)
|
return is_widget_role(role)
|
||||||
|| is_document_structure_aria_role(role)
|
|| is_document_structure_role(role)
|
||||||
|| is_landmark_aria_role(role)
|
|| is_landmark_role(role)
|
||||||
|| is_live_region_aria_role(role)
|
|| is_live_region_role(role)
|
||||||
|| is_windows_aria_role(role);
|
|| is_windows_role(role);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
#include <AK/DeprecatedFlyString.h>
|
#include <AK/DeprecatedFlyString.h>
|
||||||
|
|
||||||
namespace Web::DOM::ARIARoles {
|
namespace Web::ARIA {
|
||||||
|
|
||||||
#define ENUMERATE_ARIA_ROLES \
|
#define ENUMERATE_ARIA_ROLES \
|
||||||
__ENUMERATE_ARIA_ROLE(alert) \
|
__ENUMERATE_ARIA_ROLE(alert) \
|
||||||
|
@ -113,15 +113,15 @@ enum class Role {
|
||||||
};
|
};
|
||||||
|
|
||||||
StringView role_name(Role);
|
StringView role_name(Role);
|
||||||
Optional<Role> from_string(StringView role_name);
|
Optional<Role> role_from_string(StringView role_name);
|
||||||
|
|
||||||
bool is_abstract_aria_role(Role);
|
bool is_abstract_role(Role);
|
||||||
bool is_widget_aria_role(Role);
|
bool is_widget_role(Role);
|
||||||
bool is_document_structure_aria_role(Role);
|
bool is_document_structure_role(Role);
|
||||||
bool is_landmark_aria_role(Role);
|
bool is_landmark_role(Role);
|
||||||
bool is_live_region_aria_role(Role);
|
bool is_live_region_role(Role);
|
||||||
bool is_windows_aria_role(Role);
|
bool is_windows_role(Role);
|
||||||
|
|
||||||
bool is_non_abstract_aria_role(Role);
|
bool is_non_abstract_role(Role);
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,6 +1,9 @@
|
||||||
include(libweb_generators)
|
include(libweb_generators)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
|
ARIA/ARIAMixin.cpp
|
||||||
|
ARIA/ARIAMixin.idl
|
||||||
|
ARIA/Roles.cpp
|
||||||
Bindings/AudioConstructor.cpp
|
Bindings/AudioConstructor.cpp
|
||||||
Bindings/CSSNamespace.cpp
|
Bindings/CSSNamespace.cpp
|
||||||
Bindings/FetchMethod.cpp
|
Bindings/FetchMethod.cpp
|
||||||
|
@ -75,9 +78,6 @@ set(SOURCES
|
||||||
DOM/AccessibilityTreeNode.cpp
|
DOM/AccessibilityTreeNode.cpp
|
||||||
DOM/Attr.cpp
|
DOM/Attr.cpp
|
||||||
DOM/Attr.idl
|
DOM/Attr.idl
|
||||||
DOM/ARIAMixin.cpp
|
|
||||||
DOM/ARIAMixin.idl
|
|
||||||
DOM/ARIARoles.cpp
|
|
||||||
DOM/CDATASection.cpp
|
DOM/CDATASection.cpp
|
||||||
DOM/CharacterData.cpp
|
DOM/CharacterData.cpp
|
||||||
DOM/CharacterData.idl
|
DOM/CharacterData.idl
|
||||||
|
|
|
@ -35,10 +35,10 @@ void AccessibilityTreeNode::serialize_tree_as_json(JsonObjectSerializer<StringBu
|
||||||
MUST(object.add("type"sv, "element"sv));
|
MUST(object.add("type"sv, "element"sv));
|
||||||
|
|
||||||
auto role = element->role_or_default();
|
auto role = element->role_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)
|
if (has_role)
|
||||||
MUST(object.add("role"sv, ARIARoles::role_name(*role)));
|
MUST(object.add("role"sv, ARIA::role_name(*role)));
|
||||||
else
|
else
|
||||||
MUST(object.add("role"sv, ""sv));
|
MUST(object.add("role"sv, ""sv));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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.
|
// 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
|
// FIXME: Handle exceptions to excluding presentation role
|
||||||
auto role = role_or_default();
|
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;
|
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:
|
// 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:
|
||||||
|
|
|
@ -8,10 +8,10 @@
|
||||||
|
|
||||||
#include <AK/DeprecatedFlyString.h>
|
#include <AK/DeprecatedFlyString.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/DeprecatedString.h>
|
||||||
|
#include <LibWeb/ARIA/ARIAMixin.h>
|
||||||
#include <LibWeb/Bindings/ElementPrototype.h>
|
#include <LibWeb/Bindings/ElementPrototype.h>
|
||||||
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
#include <LibWeb/CSS/CSSStyleDeclaration.h>
|
||||||
#include <LibWeb/CSS/StyleComputer.h>
|
#include <LibWeb/CSS/StyleComputer.h>
|
||||||
#include <LibWeb/DOM/ARIAMixin.h>
|
|
||||||
#include <LibWeb/DOM/Attr.h>
|
#include <LibWeb/DOM/Attr.h>
|
||||||
#include <LibWeb/DOM/ChildNode.h>
|
#include <LibWeb/DOM/ChildNode.h>
|
||||||
#include <LibWeb/DOM/NamedNodeMap.h>
|
#include <LibWeb/DOM/NamedNodeMap.h>
|
||||||
|
@ -42,7 +42,7 @@ class Element
|
||||||
: public ParentNode
|
: public ParentNode
|
||||||
, public ChildNode<Element>
|
, public ChildNode<Element>
|
||||||
, public NonDocumentTypeChildNode<Element>
|
, public NonDocumentTypeChildNode<Element>
|
||||||
, public ARIAMixin {
|
, public ARIA::ARIAMixin {
|
||||||
WEB_PLATFORM_OBJECT(Element, ParentNode);
|
WEB_PLATFORM_OBJECT(Element, ParentNode);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
#import <ARIA/ARIAMixin.idl>
|
||||||
#import <CSS/CSSStyleDeclaration.idl>
|
#import <CSS/CSSStyleDeclaration.idl>
|
||||||
#import <DOM/Attr.idl>
|
#import <DOM/Attr.idl>
|
||||||
#import <DOM/ARIAMixin.idl>
|
|
||||||
#import <DOM/ChildNode.idl>
|
#import <DOM/ChildNode.idl>
|
||||||
#import <DOM/DOMTokenList.idl>
|
#import <DOM/DOMTokenList.idl>
|
||||||
#import <DOM/InnerHTML.idl>
|
#import <DOM/InnerHTML.idl>
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#include <AK/RefPtr.h>
|
#include <AK/RefPtr.h>
|
||||||
#include <AK/TypeCasts.h>
|
#include <AK/TypeCasts.h>
|
||||||
#include <AK/Vector.h>
|
#include <AK/Vector.h>
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
|
||||||
#include <LibWeb/DOM/AccessibilityTreeNode.h>
|
#include <LibWeb/DOM/AccessibilityTreeNode.h>
|
||||||
#include <LibWeb/DOM/EventTarget.h>
|
#include <LibWeb/DOM/EventTarget.h>
|
||||||
#include <LibWeb/DOMParsing/XMLSerializer.h>
|
#include <LibWeb/DOMParsing/XMLSerializer.h>
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
||||||
#include <LibWeb/HTML/Window.h>
|
#include <LibWeb/HTML/Window.h>
|
||||||
|
|
||||||
|
@ -91,13 +91,13 @@ i32 HTMLAnchorElement::default_tab_index_value() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DOM::ARIARoles::Role> HTMLAnchorElement::default_role() const
|
Optional<ARIA::Role> HTMLAnchorElement::default_role() const
|
||||||
{
|
{
|
||||||
// https://www.w3.org/TR/html-aria/#el-a-no-href
|
// https://www.w3.org/TR/html-aria/#el-a-no-href
|
||||||
if (!href().is_null())
|
if (!href().is_null())
|
||||||
return DOM::ARIARoles::Role::link;
|
return ARIA::Role::link;
|
||||||
// https://www.w3.org/TR/html-aria/#el-a
|
// https://www.w3.org/TR/html-aria/#el-a
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ private:
|
||||||
queue_an_element_task(source, move(steps));
|
queue_an_element_task(source, move(steps));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLAreaElement.h>
|
#include <LibWeb/HTML/HTMLAreaElement.h>
|
||||||
#include <LibWeb/HTML/Window.h>
|
#include <LibWeb/HTML/Window.h>
|
||||||
|
|
||||||
|
@ -50,13 +50,13 @@ i32 HTMLAreaElement::default_tab_index_value() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DOM::ARIARoles::Role> HTMLAreaElement::default_role() const
|
Optional<ARIA::Role> HTMLAreaElement::default_role() const
|
||||||
{
|
{
|
||||||
// https://www.w3.org/TR/html-aria/#el-area-no-href
|
// https://www.w3.org/TR/html-aria/#el-area-no-href
|
||||||
if (!href().is_null())
|
if (!href().is_null())
|
||||||
return DOM::ARIARoles::Role::link;
|
return ARIA::Role::link;
|
||||||
// https://www.w3.org/TR/html-aria/#el-area
|
// https://www.w3.org/TR/html-aria/#el-area
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ private:
|
||||||
queue_an_element_task(source, move(steps));
|
queue_an_element_task(source, move(steps));
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
#include <LibWeb/HTML/WindowEventHandlers.h>
|
#include <LibWeb/HTML/WindowEventHandlers.h>
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ public:
|
||||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-body
|
// https://www.w3.org/TR/html-aria/#el-body
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::generic; };
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::generic; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLBodyElement(DOM::Document&, DOM::QualifiedName);
|
HTMLBodyElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/FormAssociatedElement.h>
|
#include <LibWeb/HTML/FormAssociatedElement.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
virtual bool is_labelable() const override { return true; }
|
virtual bool is_labelable() const override { return true; }
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-button
|
// https://www.w3.org/TR/html-aria/#el-button
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::button; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::button; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLButtonElement(DOM::Document&, DOM::QualifiedName);
|
HTMLButtonElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLDataElement() override;
|
virtual ~HTMLDataElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-data
|
// https://www.w3.org/TR/html-aria/#el-data
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::generic; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::generic; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLDataElement(DOM::Document&, DOM::QualifiedName);
|
HTMLDataElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -17,7 +17,7 @@ class HTMLDataListElement final : public HTMLElement {
|
||||||
public:
|
public:
|
||||||
virtual ~HTMLDataListElement() override;
|
virtual ~HTMLDataListElement() override;
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::listbox; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::listbox; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLDataListElement(DOM::Document&, DOM::QualifiedName);
|
HTMLDataListElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLDetailsElement() override;
|
virtual ~HTMLDetailsElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-details
|
// https://www.w3.org/TR/html-aria/#el-details
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::group; };
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::group; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLDetailsElement(DOM::Document&, DOM::QualifiedName);
|
HTMLDetailsElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLDialogElement() override;
|
virtual ~HTMLDialogElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-dialog
|
// https://www.w3.org/TR/html-aria/#el-dialog
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::dialog; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::dialog; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLDialogElement(DOM::Document&, DOM::QualifiedName);
|
HTMLDialogElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLDivElement() override;
|
virtual ~HTMLDivElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-div
|
// https://www.w3.org/TR/html-aria/#el-div
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::generic; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::generic; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLDivElement(DOM::Document&, DOM::QualifiedName);
|
HTMLDivElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibJS/Interpreter.h>
|
#include <LibJS/Interpreter.h>
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/DOM/IDLEventListener.h>
|
#include <LibWeb/DOM/IDLEventListener.h>
|
||||||
#include <LibWeb/DOM/ShadowRoot.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.
|
// 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
|
// https://www.w3.org/TR/html-aria/#el-article
|
||||||
if (local_name() == TagNames::article)
|
if (local_name() == TagNames::article)
|
||||||
return DOM::ARIARoles::Role::article;
|
return ARIA::Role::article;
|
||||||
// https://www.w3.org/TR/html-aria/#el-aside
|
// https://www.w3.org/TR/html-aria/#el-aside
|
||||||
if (local_name() == TagNames::aside)
|
if (local_name() == TagNames::aside)
|
||||||
return DOM::ARIARoles::Role::complementary;
|
return ARIA::Role::complementary;
|
||||||
// https://www.w3.org/TR/html-aria/#el-b
|
// https://www.w3.org/TR/html-aria/#el-b
|
||||||
if (local_name() == TagNames::b)
|
if (local_name() == TagNames::b)
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
// https://www.w3.org/TR/html-aria/#el-bdi
|
// https://www.w3.org/TR/html-aria/#el-bdi
|
||||||
if (local_name() == TagNames::bdi)
|
if (local_name() == TagNames::bdi)
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
// https://www.w3.org/TR/html-aria/#el-bdo
|
// https://www.w3.org/TR/html-aria/#el-bdo
|
||||||
if (local_name() == TagNames::bdo)
|
if (local_name() == TagNames::bdo)
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
// https://www.w3.org/TR/html-aria/#el-code
|
// https://www.w3.org/TR/html-aria/#el-code
|
||||||
if (local_name() == TagNames::code)
|
if (local_name() == TagNames::code)
|
||||||
return DOM::ARIARoles::Role::code;
|
return ARIA::Role::code;
|
||||||
// https://www.w3.org/TR/html-aria/#el-dfn
|
// https://www.w3.org/TR/html-aria/#el-dfn
|
||||||
if (local_name() == TagNames::dfn)
|
if (local_name() == TagNames::dfn)
|
||||||
return DOM::ARIARoles::Role::term;
|
return ARIA::Role::term;
|
||||||
// https://www.w3.org/TR/html-aria/#el-em
|
// https://www.w3.org/TR/html-aria/#el-em
|
||||||
if (local_name() == TagNames::em)
|
if (local_name() == TagNames::em)
|
||||||
return DOM::ARIARoles::Role::emphasis;
|
return ARIA::Role::emphasis;
|
||||||
// https://www.w3.org/TR/html-aria/#el-figure
|
// https://www.w3.org/TR/html-aria/#el-figure
|
||||||
if (local_name() == TagNames::figure)
|
if (local_name() == TagNames::figure)
|
||||||
return DOM::ARIARoles::Role::figure;
|
return ARIA::Role::figure;
|
||||||
// https://www.w3.org/TR/html-aria/#el-footer
|
// https://www.w3.org/TR/html-aria/#el-footer
|
||||||
if (local_name() == TagNames::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
|
// 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
|
// Otherwise, role=generic
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
}
|
}
|
||||||
// https://www.w3.org/TR/html-aria/#el-header
|
// https://www.w3.org/TR/html-aria/#el-header
|
||||||
if (local_name() == TagNames::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
|
// 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
|
// Otherwise, role=generic
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
}
|
}
|
||||||
// https://www.w3.org/TR/html-aria/#el-hgroup
|
// https://www.w3.org/TR/html-aria/#el-hgroup
|
||||||
if (local_name() == TagNames::hgroup)
|
if (local_name() == TagNames::hgroup)
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
// https://www.w3.org/TR/html-aria/#el-i
|
// https://www.w3.org/TR/html-aria/#el-i
|
||||||
if (local_name() == TagNames::i)
|
if (local_name() == TagNames::i)
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
// https://www.w3.org/TR/html-aria/#el-main
|
// https://www.w3.org/TR/html-aria/#el-main
|
||||||
if (local_name() == TagNames::main)
|
if (local_name() == TagNames::main)
|
||||||
return DOM::ARIARoles::Role::main;
|
return ARIA::Role::main;
|
||||||
// https://www.w3.org/TR/html-aria/#el-nav
|
// https://www.w3.org/TR/html-aria/#el-nav
|
||||||
if (local_name() == TagNames::nav)
|
if (local_name() == TagNames::nav)
|
||||||
return DOM::ARIARoles::Role::navigation;
|
return ARIA::Role::navigation;
|
||||||
// https://www.w3.org/TR/html-aria/#el-samp
|
// https://www.w3.org/TR/html-aria/#el-samp
|
||||||
if (local_name() == TagNames::samp)
|
if (local_name() == TagNames::samp)
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
// https://www.w3.org/TR/html-aria/#el-section
|
// https://www.w3.org/TR/html-aria/#el-section
|
||||||
if (local_name() == TagNames::section) {
|
if (local_name() == TagNames::section) {
|
||||||
// TODO: role=region if the section element has an accessible name
|
// TODO: role=region if the section element has an accessible name
|
||||||
// Otherwise, no corresponding role
|
// Otherwise, no corresponding role
|
||||||
return DOM::ARIARoles::Role::region;
|
return ARIA::Role::region;
|
||||||
}
|
}
|
||||||
// https://www.w3.org/TR/html-aria/#el-small
|
// https://www.w3.org/TR/html-aria/#el-small
|
||||||
if (local_name() == TagNames::small)
|
if (local_name() == TagNames::small)
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
// https://www.w3.org/TR/html-aria/#el-strong
|
// https://www.w3.org/TR/html-aria/#el-strong
|
||||||
if (local_name() == TagNames::strong)
|
if (local_name() == TagNames::strong)
|
||||||
return DOM::ARIARoles::Role::strong;
|
return ARIA::Role::strong;
|
||||||
// https://www.w3.org/TR/html-aria/#el-sub
|
// https://www.w3.org/TR/html-aria/#el-sub
|
||||||
if (local_name() == TagNames::sub)
|
if (local_name() == TagNames::sub)
|
||||||
return DOM::ARIARoles::Role::subscript;
|
return ARIA::Role::subscript;
|
||||||
// https://www.w3.org/TR/html-aria/#el-summary
|
// https://www.w3.org/TR/html-aria/#el-summary
|
||||||
if (local_name() == TagNames::summary)
|
if (local_name() == TagNames::summary)
|
||||||
return DOM::ARIARoles::Role::button;
|
return ARIA::Role::button;
|
||||||
// https://www.w3.org/TR/html-aria/#el-sup
|
// https://www.w3.org/TR/html-aria/#el-sup
|
||||||
if (local_name() == TagNames::sup)
|
if (local_name() == TagNames::sup)
|
||||||
return DOM::ARIARoles::Role::superscript;
|
return ARIA::Role::superscript;
|
||||||
// https://www.w3.org/TR/html-aria/#el-u
|
// https://www.w3.org/TR/html-aria/#el-u
|
||||||
if (local_name() == TagNames::u)
|
if (local_name() == TagNames::u)
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||||
virtual bool is_labelable() const { return false; }
|
virtual bool is_labelable() const { return false; }
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
HTMLElement(DOM::Document&, DOM::QualifiedName);
|
HTMLElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/FormAssociatedElement.h>
|
#include <LibWeb/HTML/FormAssociatedElement.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public:
|
||||||
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
// https://html.spec.whatwg.org/multipage/forms.html#category-autocapitalize
|
||||||
virtual bool is_auto_capitalize_inheriting() const override { return true; }
|
virtual bool is_auto_capitalize_inheriting() const override { return true; }
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::group; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::group; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLFieldSetElement(DOM::Document&, DOM::QualifiedName);
|
HTMLFieldSetElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
#include <LibWeb/HTML/HTMLInputElement.h>
|
#include <LibWeb/HTML/HTMLInputElement.h>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public:
|
||||||
unsigned length() const;
|
unsigned length() const;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-form
|
// https://www.w3.org/TR/html-aria/#el-form
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::form; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::form; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLFormElement(DOM::Document&, DOM::QualifiedName);
|
HTMLFormElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLHRElement() override;
|
virtual ~HTMLHRElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-hr
|
// https://www.w3.org/TR/html-aria/#el-hr
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::separator; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::separator; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLHRElement(DOM::Document&, DOM::QualifiedName);
|
HTMLHRElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-h1-h6
|
// https://www.w3.org/TR/html-aria/#el-h1-h6
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::heading; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::heading; }
|
||||||
|
|
||||||
virtual DeprecatedString aria_level() const override
|
virtual DeprecatedString aria_level() const override
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -20,7 +20,7 @@ public:
|
||||||
bool should_use_body_background_properties() const;
|
bool should_use_body_background_properties() const;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-html
|
// https://www.w3.org/TR/html-aria/#el-html
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::document; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::document; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLHtmlElement(DOM::Document&, DOM::QualifiedName);
|
HTMLHtmlElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <LibGfx/Bitmap.h>
|
#include <LibGfx/Bitmap.h>
|
||||||
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/CSS/Parser/Parser.h>
|
#include <LibWeb/CSS/Parser/Parser.h>
|
||||||
#include <LibWeb/CSS/StyleComputer.h>
|
#include <LibWeb/CSS/StyleComputer.h>
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
|
||||||
#include <LibWeb/DOM/Document.h>
|
#include <LibWeb/DOM/Document.h>
|
||||||
#include <LibWeb/DOM/Event.h>
|
#include <LibWeb/DOM/Event.h>
|
||||||
#include <LibWeb/HTML/EventNames.h>
|
#include <LibWeb/HTML/EventNames.h>
|
||||||
|
@ -204,14 +204,14 @@ bool HTMLImageElement::complete() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DOM::ARIARoles::Role> HTMLImageElement::default_role() const
|
Optional<ARIA::Role> HTMLImageElement::default_role() const
|
||||||
{
|
{
|
||||||
// https://www.w3.org/TR/html-aria/#el-img
|
// https://www.w3.org/TR/html-aria/#el-img
|
||||||
// https://www.w3.org/TR/html-aria/#el-img-no-alt
|
// https://www.w3.org/TR/html-aria/#el-img-no-alt
|
||||||
if (alt().is_null() || !alt().is_empty())
|
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
|
// https://www.w3.org/TR/html-aria/#el-img-empty-alt
|
||||||
return DOM::ARIARoles::Role::presentation;
|
return ARIA::Role::presentation;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete
|
// https://html.spec.whatwg.org/multipage/embedded-content.html#dom-img-complete
|
||||||
bool complete() const;
|
bool complete() const;
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLImageElement(DOM::Document&, DOM::QualifiedName);
|
HTMLImageElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -872,32 +872,32 @@ WebIDL::ExceptionOr<void> HTMLInputElement::set_selection_range(u32 start, u32 e
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DOM::ARIARoles::Role> HTMLInputElement::default_role() const
|
Optional<ARIA::Role> HTMLInputElement::default_role() const
|
||||||
{
|
{
|
||||||
// https://www.w3.org/TR/html-aria/#el-input-button
|
// https://www.w3.org/TR/html-aria/#el-input-button
|
||||||
if (type_state() == TypeAttributeState::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
|
// https://www.w3.org/TR/html-aria/#el-input-checkbox
|
||||||
if (type_state() == TypeAttributeState::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
|
// https://www.w3.org/TR/html-aria/#el-input-email
|
||||||
if (type_state() == TypeAttributeState::Email && attribute("list").is_null())
|
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
|
// https://www.w3.org/TR/html-aria/#el-input-image
|
||||||
if (type_state() == TypeAttributeState::ImageButton)
|
if (type_state() == TypeAttributeState::ImageButton)
|
||||||
return DOM::ARIARoles::Role::button;
|
return ARIA::Role::button;
|
||||||
// https://www.w3.org/TR/html-aria/#el-input-number
|
// https://www.w3.org/TR/html-aria/#el-input-number
|
||||||
if (type_state() == TypeAttributeState::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
|
// https://www.w3.org/TR/html-aria/#el-input-radio
|
||||||
if (type_state() == TypeAttributeState::RadioButton)
|
if (type_state() == TypeAttributeState::RadioButton)
|
||||||
return DOM::ARIARoles::Role::radio;
|
return ARIA::Role::radio;
|
||||||
// https://www.w3.org/TR/html-aria/#el-input-range
|
// https://www.w3.org/TR/html-aria/#el-input-range
|
||||||
if (type_state() == TypeAttributeState::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
|
// https://www.w3.org/TR/html-aria/#el-input-reset
|
||||||
if (type_state() == TypeAttributeState::ResetButton)
|
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
|
// https://www.w3.org/TR/html-aria/#el-input-text-list
|
||||||
if ((type_state() == TypeAttributeState::Text
|
if ((type_state() == TypeAttributeState::Text
|
||||||
|| type_state() == TypeAttributeState::Search
|
|| type_state() == TypeAttributeState::Search
|
||||||
|
@ -905,22 +905,22 @@ Optional<DOM::ARIARoles::Role> HTMLInputElement::default_role() const
|
||||||
|| type_state() == TypeAttributeState::URL
|
|| type_state() == TypeAttributeState::URL
|
||||||
|| type_state() == TypeAttributeState::Email)
|
|| type_state() == TypeAttributeState::Email)
|
||||||
&& !attribute("list").is_null())
|
&& !attribute("list").is_null())
|
||||||
return DOM::ARIARoles::Role::combobox;
|
return ARIA::Role::combobox;
|
||||||
// https://www.w3.org/TR/html-aria/#el-input-search
|
// https://www.w3.org/TR/html-aria/#el-input-search
|
||||||
if (type_state() == TypeAttributeState::Search && attribute("list").is_null())
|
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
|
// https://www.w3.org/TR/html-aria/#el-input-submit
|
||||||
if (type_state() == TypeAttributeState::SubmitButton)
|
if (type_state() == TypeAttributeState::SubmitButton)
|
||||||
return DOM::ARIARoles::Role::button;
|
return ARIA::Role::button;
|
||||||
// https://www.w3.org/TR/html-aria/#el-input-tel
|
// https://www.w3.org/TR/html-aria/#el-input-tel
|
||||||
if (type_state() == TypeAttributeState::Telephone)
|
if (type_state() == TypeAttributeState::Telephone)
|
||||||
return DOM::ARIARoles::Role::textbox;
|
return ARIA::Role::textbox;
|
||||||
// https://www.w3.org/TR/html-aria/#el-input-text
|
// https://www.w3.org/TR/html-aria/#el-input-text
|
||||||
if (type_state() == TypeAttributeState::Text && attribute("list").is_null())
|
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
|
// https://www.w3.org/TR/html-aria/#el-input-url
|
||||||
if (type_state() == TypeAttributeState::URL && attribute("list").is_null())
|
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-color
|
||||||
// https://www.w3.org/TR/html-aria/#el-input-date
|
// https://www.w3.org/TR/html-aria/#el-input-date
|
||||||
|
|
|
@ -120,7 +120,7 @@ public:
|
||||||
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
// https://html.spec.whatwg.org/multipage/forms.html#category-label
|
||||||
virtual bool is_labelable() const override { return type_state() != TypeAttributeState::Hidden; }
|
virtual bool is_labelable() const override { return type_state() != TypeAttributeState::Hidden; }
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLInputElement(DOM::Document&, DOM::QualifiedName);
|
HTMLInputElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLLIElement() override;
|
virtual ~HTMLLIElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-li
|
// https://www.w3.org/TR/html-aria/#el-li
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::listitem; };
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::listitem; };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLLIElement(DOM::Document&, DOM::QualifiedName);
|
HTMLLIElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLMenuElement() override;
|
virtual ~HTMLMenuElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-menu
|
// https://www.w3.org/TR/html-aria/#el-menu
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::list; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::list; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLMenuElement(DOM::Document&, DOM::QualifiedName);
|
HTMLMenuElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -23,7 +23,7 @@ public:
|
||||||
virtual bool is_labelable() const override { return true; }
|
virtual bool is_labelable() const override { return true; }
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-meter
|
// https://www.w3.org/TR/html-aria/#el-meter
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::meter; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::meter; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLMeterElement(DOM::Document&, DOM::QualifiedName);
|
HTMLMeterElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -25,14 +25,14 @@ JS::ThrowCompletionOr<void> HTMLModElement::initialize(JS::Realm& realm)
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DOM::ARIARoles::Role> HTMLModElement::default_role() const
|
Optional<ARIA::Role> HTMLModElement::default_role() const
|
||||||
{
|
{
|
||||||
// https://www.w3.org/TR/html-aria/#el-del
|
// https://www.w3.org/TR/html-aria/#el-del
|
||||||
if (local_name() == TagNames::del)
|
if (local_name() == TagNames::del)
|
||||||
return DOM::ARIARoles::Role::deletion;
|
return ARIA::Role::deletion;
|
||||||
// https://www.w3.org/TR/html-aria/#el-ins
|
// https://www.w3.org/TR/html-aria/#el-ins
|
||||||
if (local_name() == TagNames::ins)
|
if (local_name() == TagNames::ins)
|
||||||
return DOM::ARIARoles::Role::insertion;
|
return ARIA::Role::insertion;
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -17,7 +17,7 @@ class HTMLModElement final : public HTMLElement {
|
||||||
public:
|
public:
|
||||||
virtual ~HTMLModElement() override;
|
virtual ~HTMLModElement() override;
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLModElement(DOM::Document&, DOM::QualifiedName);
|
HTMLModElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLOListElement() override;
|
virtual ~HTMLOListElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-ol
|
// https://www.w3.org/TR/html-aria/#el-ol
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::list; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::list; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLOListElement(DOM::Document&, DOM::QualifiedName);
|
HTMLOListElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLOptGroupElement() override;
|
virtual ~HTMLOptGroupElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-optgroup
|
// https://www.w3.org/TR/html-aria/#el-optgroup
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::group; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::group; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLOptGroupElement(DOM::Document&, DOM::QualifiedName);
|
HTMLOptGroupElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
|
||||||
#include <LibWeb/DOM/Node.h>
|
#include <LibWeb/DOM/Node.h>
|
||||||
#include <LibWeb/DOM/Text.h>
|
#include <LibWeb/DOM/Text.h>
|
||||||
#include <LibWeb/HTML/HTMLOptGroupElement.h>
|
#include <LibWeb/HTML/HTMLOptGroupElement.h>
|
||||||
|
@ -148,11 +148,11 @@ bool HTMLOptionElement::disabled() const
|
||||||
|| (parent() && is<HTMLOptGroupElement>(parent()) && static_cast<HTMLOptGroupElement const&>(*parent()).has_attribute(AttributeNames::disabled));
|
|| (parent() && is<HTMLOptGroupElement>(parent()) && static_cast<HTMLOptGroupElement const&>(*parent()).has_attribute(AttributeNames::disabled));
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DOM::ARIARoles::Role> HTMLOptionElement::default_role() const
|
Optional<ARIA::Role> HTMLOptionElement::default_role() const
|
||||||
{
|
{
|
||||||
// https://www.w3.org/TR/html-aria/#el-option
|
// 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
|
// 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public:
|
||||||
|
|
||||||
bool disabled() const;
|
bool disabled() const;
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class Bindings::OptionConstructor;
|
friend class Bindings::OptionConstructor;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/FormAssociatedElement.h>
|
#include <LibWeb/HTML/FormAssociatedElement.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ public:
|
||||||
virtual void reset_algorithm() override;
|
virtual void reset_algorithm() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-output
|
// https://www.w3.org/TR/html-aria/#el-output
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::status; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::status; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLOutputElement(DOM::Document&, DOM::QualifiedName);
|
HTMLOutputElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-p
|
// https://www.w3.org/TR/html-aria/#el-p
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::paragraph; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::paragraph; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLParagraphElement(DOM::Document&, DOM::QualifiedName);
|
HTMLParagraphElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLPreElement() override;
|
virtual ~HTMLPreElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-pre
|
// https://www.w3.org/TR/html-aria/#el-pre
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::generic; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::generic; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLPreElement(DOM::Document&, DOM::QualifiedName);
|
HTMLPreElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -34,7 +34,7 @@ public:
|
||||||
bool using_system_appearance() const;
|
bool using_system_appearance() const;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-progress
|
// https://www.w3.org/TR/html-aria/#el-progress
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::progressbar; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::progressbar; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLProgressElement(DOM::Document&, DOM::QualifiedName);
|
HTMLProgressElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/Bindings/Intrinsics.h>
|
#include <LibWeb/Bindings/Intrinsics.h>
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
|
||||||
#include <LibWeb/HTML/HTMLQuoteElement.h>
|
#include <LibWeb/HTML/HTMLQuoteElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -26,14 +26,14 @@ JS::ThrowCompletionOr<void> HTMLQuoteElement::initialize(JS::Realm& realm)
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DOM::ARIARoles::Role> HTMLQuoteElement::default_role() const
|
Optional<ARIA::Role> HTMLQuoteElement::default_role() const
|
||||||
{
|
{
|
||||||
// https://www.w3.org/TR/html-aria/#el-blockquote
|
// https://www.w3.org/TR/html-aria/#el-blockquote
|
||||||
if (local_name() == TagNames::blockquote)
|
if (local_name() == TagNames::blockquote)
|
||||||
return DOM::ARIARoles::Role::blockquote;
|
return ARIA::Role::blockquote;
|
||||||
// https://www.w3.org/TR/html-aria/#el-q
|
// https://www.w3.org/TR/html-aria/#el-q
|
||||||
if (local_name() == TagNames::q)
|
if (local_name() == TagNames::q)
|
||||||
return DOM::ARIARoles::Role::generic;
|
return ARIA::Role::generic;
|
||||||
VERIFY_NOT_REACHED();
|
VERIFY_NOT_REACHED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class HTMLQuoteElement final : public HTMLElement {
|
||||||
public:
|
public:
|
||||||
virtual ~HTMLQuoteElement() override;
|
virtual ~HTMLQuoteElement() override;
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLQuoteElement(DOM::Document&, DOM::QualifiedName);
|
HTMLQuoteElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -163,18 +163,18 @@ DeprecatedString const& HTMLSelectElement::type() const
|
||||||
return select_multiple;
|
return select_multiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DOM::ARIARoles::Role> HTMLSelectElement::default_role() const
|
Optional<ARIA::Role> HTMLSelectElement::default_role() const
|
||||||
{
|
{
|
||||||
// https://www.w3.org/TR/html-aria/#el-select-multiple-or-size-greater-1
|
// https://www.w3.org/TR/html-aria/#el-select-multiple-or-size-greater-1
|
||||||
if (has_attribute("multiple"))
|
if (has_attribute("multiple"))
|
||||||
return DOM::ARIARoles::Role::listbox;
|
return ARIA::Role::listbox;
|
||||||
if (has_attribute("size")) {
|
if (has_attribute("size")) {
|
||||||
auto size_attribute = attribute("size").to_int();
|
auto size_attribute = attribute("size").to_int();
|
||||||
if (size_attribute.has_value() && size_attribute.value() > 1)
|
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
|
// https://www.w3.org/TR/html-aria/#el-select
|
||||||
return DOM::ARIARoles::Role::combobox;
|
return ARIA::Role::combobox;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
|
|
||||||
DeprecatedString const& type() const;
|
DeprecatedString const& type() const;
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLSelectElement(DOM::Document&, DOM::QualifiedName);
|
HTMLSelectElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLSpanElement() override;
|
virtual ~HTMLSpanElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-span
|
// https://www.w3.org/TR/html-aria/#el-span
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::generic; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::generic; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLSpanElement(DOM::Document&, DOM::QualifiedName);
|
HTMLSpanElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -20,7 +20,7 @@ public:
|
||||||
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-caption
|
// https://www.w3.org/TR/html-aria/#el-caption
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::caption; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::caption; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLTableCaptionElement(DOM::Document&, DOM::QualifiedName);
|
HTMLTableCaptionElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -76,7 +76,7 @@ void HTMLTableCellElement::set_row_span(unsigned int value)
|
||||||
MUST(set_attribute(HTML::AttributeNames::rowspan, DeprecatedString::number(value)));
|
MUST(set_attribute(HTML::AttributeNames::rowspan, DeprecatedString::number(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
Optional<DOM::ARIARoles::Role> HTMLTableCellElement::default_role() const
|
Optional<ARIA::Role> HTMLTableCellElement::default_role() const
|
||||||
{
|
{
|
||||||
// TODO: For td:
|
// TODO: For td:
|
||||||
// role=cell if the ancestor table element is exposed as a role=table
|
// role=cell if the ancestor table element is exposed as a role=table
|
||||||
|
|
|
@ -22,7 +22,7 @@ public:
|
||||||
void set_col_span(unsigned);
|
void set_col_span(unsigned);
|
||||||
void set_row_span(unsigned);
|
void set_row_span(unsigned);
|
||||||
|
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override;
|
virtual Optional<ARIA::Role> default_role() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLTableCellElement(DOM::Document&, DOM::QualifiedName);
|
HTMLTableCellElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -43,7 +43,7 @@ public:
|
||||||
WebIDL::ExceptionOr<void> delete_row(long index);
|
WebIDL::ExceptionOr<void> delete_row(long index);
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-table
|
// https://www.w3.org/TR/html-aria/#el-table
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::table; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::table; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLTableElement(DOM::Document&, DOM::QualifiedName);
|
HTMLTableElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -25,7 +25,7 @@ public:
|
||||||
WebIDL::ExceptionOr<void> delete_cell(i32 index);
|
WebIDL::ExceptionOr<void> delete_cell(i32 index);
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-tr
|
// https://www.w3.org/TR/html-aria/#el-tr
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::row; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::row; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLTableRowElement(DOM::Document&, DOM::QualifiedName);
|
HTMLTableRowElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
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-tbody
|
||||||
// https://www.w3.org/TR/html-aria/#el-tfoot
|
// https://www.w3.org/TR/html-aria/#el-tfoot
|
||||||
// https://www.w3.org/TR/html-aria/#el-thead
|
// https://www.w3.org/TR/html-aria/#el-thead
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::rowgroup; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::rowgroup; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLTableSectionElement(DOM::Document&, DOM::QualifiedName);
|
HTMLTableSectionElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/FormAssociatedElement.h>
|
#include <LibWeb/HTML/FormAssociatedElement.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public:
|
||||||
virtual void reset_algorithm() override;
|
virtual void reset_algorithm() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-textarea
|
// https://www.w3.org/TR/html-aria/#el-textarea
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::textbox; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::textbox; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName);
|
HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLTimeElement() override;
|
virtual ~HTMLTimeElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-time
|
// https://www.w3.org/TR/html-aria/#el-time
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::time; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::time; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLTimeElement(DOM::Document&, DOM::QualifiedName);
|
HTMLTimeElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <LibWeb/DOM/ARIARoles.h>
|
#include <LibWeb/ARIA/Roles.h>
|
||||||
#include <LibWeb/HTML/HTMLElement.h>
|
#include <LibWeb/HTML/HTMLElement.h>
|
||||||
|
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
@ -18,7 +18,7 @@ public:
|
||||||
virtual ~HTMLUListElement() override;
|
virtual ~HTMLUListElement() override;
|
||||||
|
|
||||||
// https://www.w3.org/TR/html-aria/#el-ul
|
// https://www.w3.org/TR/html-aria/#el-ul
|
||||||
virtual Optional<DOM::ARIARoles::Role> default_role() const override { return DOM::ARIARoles::Role::list; }
|
virtual Optional<ARIA::Role> default_role() const override { return ARIA::Role::list; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HTMLUListElement(DOM::Document&, DOM::QualifiedName);
|
HTMLUListElement(DOM::Document&, DOM::QualifiedName);
|
||||||
|
|
|
@ -1254,7 +1254,7 @@ Messages::WebDriverClient::GetComputedRoleResponse WebDriverConnection::get_comp
|
||||||
|
|
||||||
// 5. Return success with data role.
|
// 5. Return success with data role.
|
||||||
if (role.has_value())
|
if (role.has_value())
|
||||||
return Web::DOM::ARIARoles::role_name(*role);
|
return Web::ARIA::role_name(*role);
|
||||||
return ""sv;
|
return ""sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue