mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Compute roles for SVG graphics-symbol elements and foreignObject
This change adds computation of ARIA roles for a number of SVG elements for which, if the element meets the SVG spec criteria for inclusion in the accessibility tree, the computed ARIA role should be “graphics-symbol”, and should otherwise be “generic”. This change also adds similar role computation for the SVG foreignObject element (the role for which, if the element meets the SVG spec criteria for inclusion in the accessibility tree, should be “group”, and should otherwise be “generic”).
This commit is contained in:
parent
8961d5d2ce
commit
2983a17ea6
Notes:
github-actions[bot]
2024-12-28 01:17:12 +00:00
Author: https://github.com/sideshowbarker
Commit: 2983a17ea6
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3043
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/trflynn89
3 changed files with 64 additions and 2 deletions
|
@ -55,11 +55,17 @@ Optional<ARIA::Role> SVGElement::default_role() const
|
|||
// https://w3c.github.io/svg-aam/#mapping_role_table
|
||||
if (local_name() == TagNames::a && (has_attribute(SVG::AttributeNames::href) || has_attribute(AttributeNames::xlink_href)))
|
||||
return ARIA::Role::link;
|
||||
if (local_name() == TagNames::g && should_include_in_accessibility_tree())
|
||||
if (local_name().is_one_of(TagNames::foreignObject, TagNames::g)
|
||||
&& should_include_in_accessibility_tree())
|
||||
return ARIA::Role::group;
|
||||
if (local_name() == TagNames::image && should_include_in_accessibility_tree())
|
||||
return ARIA::Role::image;
|
||||
return {};
|
||||
if (local_name() == TagNames::circle && should_include_in_accessibility_tree())
|
||||
return ARIA::Role::graphicssymbol;
|
||||
if (local_name().is_one_of(TagNames::ellipse, TagNames::path, TagNames::polygon, TagNames::polyline)
|
||||
&& should_include_in_accessibility_tree())
|
||||
return ARIA::Role::graphicssymbol;
|
||||
return ARIA::Role::generic;
|
||||
}
|
||||
|
||||
void SVGElement::visit_edges(Cell::Visitor& visitor)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue