LibWeb: Add fast_is<T>() for HTMLSlotElement

2.4x speed-up on StyleBench :^)
This commit is contained in:
Andreas Kling 2023-09-23 13:03:59 +02:00
parent 07b332e17c
commit a6131634f1
Notes: sideshowbarker 2024-07-17 18:49:10 +09:00
2 changed files with 10 additions and 0 deletions

View file

@ -103,6 +103,7 @@ public:
virtual bool is_html_table_cell_element() const { return false; }
virtual bool is_html_br_element() const { return false; }
virtual bool is_html_button_element() const { return false; }
virtual bool is_html_slot_element() const { return false; }
virtual bool is_navigable_container() const { return false; }
WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> pre_insert(JS::NonnullGCPtr<Node>, JS::GCPtr<Node>);

View file

@ -39,6 +39,8 @@ public:
private:
HTMLSlotElement(DOM::Document&, DOM::QualifiedName);
virtual bool is_html_slot_element() const override { return true; }
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(JS::Cell::Visitor&) override;
@ -47,3 +49,10 @@ private:
};
}
namespace Web::DOM {
template<>
inline bool Node::fast_is<HTML::HTMLSlotElement>() const { return is_html_slot_element(); }
}