mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:07:35 +00:00
LibWeb: Add fast_is<T>() for some DOM and layout node subclasses
The generic is<T>() uses dynamic_cast which is fine in the majority of cases, but when one of them shows up in profiles, we can make it faster by answering the is-a question manually.
This commit is contained in:
parent
65fa0c2774
commit
fd441b954d
7 changed files with 24 additions and 17 deletions
|
@ -47,6 +47,7 @@ public:
|
|||
virtual void split_into_lines(InlineFormattingContext&, LayoutMode) override;
|
||||
|
||||
private:
|
||||
virtual bool is_text_node() const final { return true; }
|
||||
void split_into_lines_by_rules(InlineFormattingContext&, LayoutMode, bool do_collapse, bool do_wrap_lines, bool do_wrap_breaks);
|
||||
void paint_cursor_if_needed(PaintContext&, const LineBoxFragment&) const;
|
||||
|
||||
|
@ -56,4 +57,7 @@ private:
|
|||
String m_text_for_rendering;
|
||||
};
|
||||
|
||||
template<>
|
||||
inline bool Node::fast_is<TextNode>() const { return is_text_node(); }
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue