mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Add an alternative_text() getter
This change adds an alternative_text()·getter, for use in computing accessible names.
This commit is contained in:
committed by
Andrew Kaster
parent
6d29afaa6c
commit
dfd50afa4e
Notes:
github-actions[bot]
2024-11-11 21:57:57 +00:00
Author: https://github.com/sideshowbarker Commit: https://github.com/LadybirdBrowser/ladybird/commit/dfd50afa4e5 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2194 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/AtkinsSJ
@@ -40,6 +40,13 @@ public:
|
||||
|
||||
virtual void form_associated_element_attribute_changed(FlyString const& name, Optional<String> const& value) override;
|
||||
|
||||
Optional<String> alternative_text() const override
|
||||
{
|
||||
if (auto alt = get_attribute(HTML::AttributeNames::alt); alt.has_value())
|
||||
return alt.release_value();
|
||||
return {};
|
||||
}
|
||||
|
||||
String alt() const { return get_attribute_value(HTML::AttributeNames::alt); }
|
||||
String src() const { return get_attribute_value(HTML::AttributeNames::src); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user