LibJS+LibWeb: Add JS::Object::fast_is<T> helpers for some LibWeb types

These are slightly unfortunate as we're crossing the library boundary,
but there's precedent with Object::is_dom_node(), and these are just
knocking down a few more items that were showing up in profiles.
This commit is contained in:
Andreas Kling 2025-04-18 10:31:28 +02:00 committed by Andreas Kling
commit d8188c9f14
Notes: github-actions[bot] 2025-04-18 12:47:12 +00:00
5 changed files with 24 additions and 0 deletions

View file

@ -159,6 +159,8 @@ protected:
virtual void visit_edges(Visitor&) override;
private:
virtual bool is_dom_event() const final { return true; }
FlyString m_type;
GC::Ptr<EventTarget> m_target;
GC::Ptr<EventTarget> m_related_target;
@ -188,3 +190,6 @@ private:
};
}
template<>
inline bool JS::Object::fast_is<Web::DOM::Event>() const { return is_dom_event(); }