mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Factor out "process the URL" AO for SVGUseElement
This commit is contained in:
parent
5151f94d39
commit
ab70932681
Notes:
github-actions[bot]
2024-08-05 09:28:11 +00:00
Author: https://github.com/shannonbooth
Commit: ab70932681
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/873
Reviewed-by: https://github.com/tcl3
2 changed files with 12 additions and 3 deletions
|
@ -60,12 +60,19 @@ void SVGUseElement::attribute_changed(FlyString const& name, Optional<String> co
|
|||
} else if (name == SVG::AttributeNames::y) {
|
||||
m_y = AttributeParser::parse_coordinate(value.value_or(String {}));
|
||||
} else if (name == SVG::AttributeNames::href || name == "xlink:href"_fly_string) {
|
||||
m_referenced_id = parse_id_from_href(value.value_or(String {}));
|
||||
|
||||
clone_element_tree_as_our_shadow_tree(referenced_element());
|
||||
// When the ‘href’ attribute is set (or, in the absence of an ‘href’ attribute, an ‘xlink:href’ attribute), the user agent must process the URL.
|
||||
process_the_url(value);
|
||||
}
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/SVG2/linking.html#processingURL
|
||||
void SVGUseElement::process_the_url(Optional<String> const& href)
|
||||
{
|
||||
m_referenced_id = parse_id_from_href(href.value_or(String {}));
|
||||
|
||||
clone_element_tree_as_our_shadow_tree(referenced_element());
|
||||
}
|
||||
|
||||
Optional<FlyString> SVGUseElement::parse_id_from_href(StringView href)
|
||||
{
|
||||
auto id_seperator = href.find('#');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue