LibWeb: Support fast_is<T>() for table, table sections, rows and cells

3.2x speed-up on WebKit/PerformanceTests/DOM/GridSort.html
This commit is contained in:
Andreas Kling 2023-08-22 14:55:10 +02:00
parent 76580bb9ba
commit 354d2ccc3c
5 changed files with 32 additions and 0 deletions

View file

@ -95,6 +95,10 @@ public:
virtual bool is_html_progress_element() const { return false; }
virtual bool is_html_script_element() const { return false; }
virtual bool is_html_template_element() const { return false; }
virtual bool is_html_table_element() const { return false; }
virtual bool is_html_table_section_element() const { return false; }
virtual bool is_html_table_row_element() const { return false; }
virtual bool is_html_table_cell_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

@ -27,8 +27,15 @@ public:
private:
HTMLTableCellElement(DOM::Document&, DOM::QualifiedName);
virtual bool is_html_table_cell_element() const override { return true; }
virtual void initialize(JS::Realm&) override;
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
};
}
namespace Web::DOM {
template<>
inline bool Node::fast_is<HTML::HTMLTableCellElement>() const { return is_html_table_cell_element(); }
}

View file

@ -48,6 +48,8 @@ public:
private:
HTMLTableElement(DOM::Document&, DOM::QualifiedName);
virtual bool is_html_table_element() const override { return true; }
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
@ -58,3 +60,8 @@ private:
};
}
namespace Web::DOM {
template<>
inline bool Node::fast_is<HTML::HTMLTableElement>() const { return is_html_table_element(); }
}

View file

@ -30,6 +30,8 @@ public:
private:
HTMLTableRowElement(DOM::Document&, DOM::QualifiedName);
virtual bool is_html_table_row_element() const override { return true; }
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
@ -38,3 +40,8 @@ private:
};
}
namespace Web::DOM {
template<>
inline bool Node::fast_is<HTML::HTMLTableRowElement>() const { return is_html_table_row_element(); }
}

View file

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