LibWeb: Replace usages of dynamic_cast with as and as_if

This commit is contained in:
Tim Ledbetter 2025-08-22 11:59:47 +01:00 committed by Jelle Raaijmakers
parent d31aec25e8
commit aadd563592
Notes: github-actions[bot] 2025-08-22 18:27:13 +00:00
22 changed files with 72 additions and 91 deletions

View file

@ -30,9 +30,8 @@ public:
// - if the element is defined to support the deprecated xlink:href attribute, additionally reflects that
// deprecated attribute.
if (!m_href_animated_string) {
auto* this_svg_element = dynamic_cast<SVGElement*>(this);
VERIFY(this_svg_element);
m_href_animated_string = SVGAnimatedString::create(this_svg_element->realm(), *this_svg_element, AttributeNames::href, supports_xlink_href == SupportsXLinkHref::Yes ? Optional<FlyString> { AttributeNames::xlink_href } : OptionalNone {});
auto& this_svg_element = as<SVGElement>(*this);
m_href_animated_string = SVGAnimatedString::create(this_svg_element.realm(), this_svg_element, AttributeNames::href, supports_xlink_href == SupportsXLinkHref::Yes ? Optional<FlyString> { AttributeNames::xlink_href } : OptionalNone {});
}
return *m_href_animated_string;
}