mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 13:17:36 +00:00
LibWeb: Add fast_is<T> for HTML::HTMLAnchorElement
We were spending 20% of style computation time on the HTML spec on deciding whether DOM nodes were HTML anchor (a) tags or not.
This commit is contained in:
parent
65b38f2623
commit
ad9f3f7ae6
2 changed files with 8 additions and 0 deletions
|
@ -84,6 +84,7 @@ public:
|
||||||
virtual bool is_editable() const;
|
virtual bool is_editable() const;
|
||||||
|
|
||||||
virtual bool is_html_html_element() const { return false; }
|
virtual bool is_html_html_element() const { return false; }
|
||||||
|
virtual bool is_html_anchor_element() const { return false; }
|
||||||
virtual bool is_html_template_element() const { return false; }
|
virtual bool is_html_template_element() const { return false; }
|
||||||
virtual bool is_browsing_context_container() const { return false; }
|
virtual bool is_browsing_context_container() const { return false; }
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ public:
|
||||||
|
|
||||||
virtual bool is_focusable() const override { return has_attribute(HTML::AttributeNames::href); }
|
virtual bool is_focusable() const override { return has_attribute(HTML::AttributeNames::href); }
|
||||||
|
|
||||||
|
virtual bool is_html_anchor_element() const override { return true; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// ^DOM::Element
|
// ^DOM::Element
|
||||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||||
|
@ -35,3 +37,8 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Web::DOM {
|
||||||
|
template<>
|
||||||
|
inline bool Node::fast_is<HTML::HTMLAnchorElement>() const { return is_html_anchor_element(); }
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue