diff --git a/AK/TypeCasts.h b/AK/TypeCasts.h index d9c924bca0..7141d3b8a3 100644 --- a/AK/TypeCasts.h +++ b/AK/TypeCasts.h @@ -38,7 +38,9 @@ ALWAYS_INLINE bool is(NonnullRefPtr const& input) template ALWAYS_INLINE CopyConst* as_if(InputType& input) { - if constexpr (requires { input.template fast_is>(); static_cast*>(&input); }) { + if constexpr (requires { input.template fast_as>(); }) { + return input.template fast_as>(); + } else if constexpr (requires { input.template fast_is>(); static_cast*>(&input); }) { if (!is(input)) return nullptr; return static_cast*>(&input); diff --git a/Libraries/LibWeb/DOM/Node.h b/Libraries/LibWeb/DOM/Node.h index 7bc07851fa..f6573fa005 100644 --- a/Libraries/LibWeb/DOM/Node.h +++ b/Libraries/LibWeb/DOM/Node.h @@ -379,6 +379,11 @@ public: template bool fast_is() const = delete; + template + T* fast_as() = delete; + template + T const* fast_as() const = delete; + WebIDL::ExceptionOr ensure_pre_insertion_validity(JS::Realm&, GC::Ref node, GC::Ptr child) const; bool is_host_including_inclusive_ancestor_of(Node const&) const;