LibWeb: Replace is<T> + as<T> with as_if<T>

Doing so results in a single fast_if<T> or dynamic_cast<T> call instead
of two. No functional changes.
This commit is contained in:
Jelle Raaijmakers
2026-03-10 14:50:20 +01:00
committed by Jelle Raaijmakers
parent e362362cb2
commit f61528238e
Notes: github-actions[bot] 2026-03-10 14:19:03 +00:00
7 changed files with 21 additions and 13 deletions

View File

@@ -2730,7 +2730,7 @@ WebIDL::ExceptionOr<GC::Ref<Node>> Document::adopt_node_binding(GC::Ref<Node> no
if (is<ShadowRoot>(*node))
return WebIDL::HierarchyRequestError::create(realm(), "Cannot adopt a shadow root into a document"_utf16);
if (is<DocumentFragment>(*node) && as<DocumentFragment>(*node).host())
if (auto* fragment = as_if<DocumentFragment>(*node); fragment && fragment->host())
return node;
adopt_node(*node);