LibWeb: Make Node::parent_element return GC::Ptr

This is useful for people like myself who run with debug mode to
more reliably get stacktraces without spinning up a debugger.
This commit is contained in:
Shannon Booth 2025-04-18 14:19:19 +12:00 committed by Andreas Kling
commit 3e17b1c9ae
Notes: github-actions[bot] 2025-04-18 09:08:36 +00:00
18 changed files with 48 additions and 54 deletions

View file

@ -582,20 +582,14 @@ private:
template<>
inline bool Node::fast_is<Element>() const { return is_element(); }
inline Element* Node::parent_element()
inline GC::Ptr<Element> Node::parent_element()
{
auto* parent = this->parent();
if (!parent || !is<Element>(parent))
return nullptr;
return static_cast<Element*>(parent);
return as_if<Element>(this->parent());
}
inline Element const* Node::parent_element() const
inline GC::Ptr<Element const> Node::parent_element() const
{
auto const* parent = this->parent();
if (!parent || !is<Element>(parent))
return nullptr;
return static_cast<Element const*>(parent);
return as_if<Element>(this->parent());
}
inline bool Element::has_class(FlyString const& class_name, CaseSensitivity case_sensitivity) const