mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
LibWeb: Allow accessible-name computation to skip role-attribute lookup
Per https://w3c.github.io/aria/#document-handling_author-errors_roles, determining whether to ignore certain specified landmark roles requires first determining whether the element for which the role is specified has an accessible name. But if we then try to retrieve a role for such elements, we end up calling right back into the accessible-name computation code — which would cause the calls to loop infinitely. So to avoid that — and to have handling for any other future cases the spec may introduce of such recursive calls that will loop indefinitely — this change introduces a parameter that callers can pass to cause role-attribute lookup to be skipped during accessible-name computation.
This commit is contained in:
committed by
Sam Atkins
parent
9f01eebff3
commit
173368bd5e
@@ -58,6 +58,11 @@ enum class IsDescendant {
|
||||
Yes,
|
||||
};
|
||||
|
||||
enum class ShouldComputeRole {
|
||||
No,
|
||||
Yes,
|
||||
};
|
||||
|
||||
#define ENUMERATE_STYLE_INVALIDATION_REASONS(X) \
|
||||
X(ActiveElementChange) \
|
||||
X(AdoptedStyleSheetsList) \
|
||||
@@ -732,7 +737,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
ErrorOr<String> accessible_name(Document const&) const;
|
||||
ErrorOr<String> accessible_name(Document const&, ShouldComputeRole = ShouldComputeRole::Yes) const;
|
||||
ErrorOr<String> accessible_description(Document const&) const;
|
||||
|
||||
Optional<String> locate_a_namespace(Optional<String> const& prefix) const;
|
||||
@@ -765,7 +770,7 @@ protected:
|
||||
|
||||
void build_accessibility_tree(AccessibilityTreeNode& parent);
|
||||
|
||||
ErrorOr<String> name_or_description(NameOrDescription, Document const&, HashTable<UniqueNodeID>&, IsDescendant = IsDescendant::No) const;
|
||||
ErrorOr<String> name_or_description(NameOrDescription, Document const&, HashTable<UniqueNodeID>&, IsDescendant = IsDescendant::No, ShouldComputeRole = ShouldComputeRole::Yes) const;
|
||||
|
||||
private:
|
||||
void queue_tree_mutation_record(Vector<GC::Root<Node>> added_nodes, Vector<GC::Root<Node>> removed_nodes, Node* previous_sibling, Node* next_sibling);
|
||||
|
||||
Reference in New Issue
Block a user