1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibWeb: Add fast_is<HTMLBaseElement>()

This avoids slow RTTI lookups in Document::base_url().
This commit is contained in:
Andreas Kling 2022-07-27 16:03:43 +02:00
parent 7b4004d682
commit 9f32da1dbc
2 changed files with 8 additions and 0 deletions

View file

@ -26,6 +26,8 @@ public:
virtual void parse_attribute(FlyString const& name, String const& value) override;
private:
virtual bool is_html_base_element() const override { return true; }
// https://html.spec.whatwg.org/multipage/semantics.html#frozen-base-url
// A base element that is the first base element with an href content attribute in a document tree has a frozen base URL.
AK::URL m_frozen_base_url;
@ -34,3 +36,8 @@ private:
};
}
namespace Web::DOM {
template<>
inline bool Node::fast_is<HTML::HTMLBaseElement>() const { return is_html_base_element(); }
}