mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
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:
committed by
Jelle Raaijmakers
parent
e362362cb2
commit
f61528238e
Notes:
github-actions[bot]
2026-03-10 14:19:03 +00:00
Author: https://github.com/gmta Commit: https://github.com/LadybirdBrowser/ladybird/commit/f61528238e9 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8349
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user