LibWeb: Add fast_is<T> for hotly dynamic_cast'ed things on imdb.com

This commit is contained in:
Andreas Kling 2025-09-25 12:06:12 +02:00 committed by Andreas Kling
parent 2fcacd21f5
commit 989f6ddb42
Notes: github-actions[bot] 2025-09-25 19:44:12 +00:00
5 changed files with 28 additions and 1 deletions

View file

@ -20,9 +20,18 @@ public:
virtual GC::Ptr<Layout::Node> create_layout_node(GC::Ref<CSS::ComputedProperties>) override;
private:
virtual bool is_svg_g_element() const final { return true; }
SVGGElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
};
}
namespace Web::DOM {
template<>
inline bool Node::fast_is<SVG::SVGGElement>() const { return is_svg_g_element(); }
}

View file

@ -23,6 +23,8 @@ public:
virtual void apply_presentational_hints(GC::Ref<CSS::CascadedProperties>) const override;
private:
virtual bool is_svg_symbol_element() const final { return true; }
SVGSymbolElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
@ -36,3 +38,10 @@ private:
};
}
namespace Web::DOM {
template<>
inline bool Node::fast_is<SVG::SVGSymbolElement>() const { return is_svg_symbol_element(); }
}