LibWeb: Implement ariaActiveDescendantElement spiritually closer to spec
Some checks are pending
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (x86_64, ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Lint Code / lint (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (arm64, macos-15, macOS, macOS-universal2) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

We are meant to store a weak reference to the element indicated by this
attribute, rather than a GC-protected strong reference. This also hoists
the "get the attr-associated element" AO into its own function, rather
than being hidden in IDL, to match "get the attr-associated elements".
This commit is contained in:
Timothy Flynn 2025-04-24 16:00:14 -04:00 committed by Tim Ledbetter
commit 13ac6c4fde
Notes: github-actions[bot] 2025-04-25 00:21:14 +00:00
5 changed files with 87 additions and 67 deletions

View file

@ -14,11 +14,6 @@ namespace Web::ARIA {
ARIAMixin::ARIAMixin() = default;
ARIAMixin::~ARIAMixin() = default;
void ARIAMixin::visit_edges(GC::Cell::Visitor& visitor)
{
visitor.visit(m_aria_active_descendant_element);
}
// https://www.w3.org/TR/wai-aria-1.2/#introroles
Optional<Role> ARIAMixin::role_from_role_attribute_value() const
{
@ -230,6 +225,19 @@ Vector<String> ARIAMixin::parse_id_reference_list(Optional<String> const& id_lis
return result;
}
#define __ENUMERATE_ARIA_ATTRIBUTE(attribute, referencing_attribute) \
GC::Ptr<DOM::Element> ARIAMixin::attribute() const \
{ \
return m_##attribute.ptr(); \
} \
\
void ARIAMixin::set_##attribute(GC::Ptr<DOM::Element> value) \
{ \
m_##attribute = value.ptr(); \
}
ENUMERATE_ARIA_ELEMENT_REFERENCING_ATTRIBUTES
#undef __ENUMERATE_ARIA_ATTRIBUTE
#define __ENUMERATE_ARIA_ATTRIBUTE(attribute, referencing_attribute) \
Optional<Vector<WeakPtr<DOM::Element>>> const& ARIAMixin::attribute() const \
{ \