mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWeb: Don't allocate DOMStringMap in HTMLElement constructor
Allocations go in initialize().
This commit is contained in:
parent
b30e95eb27
commit
05dcf3b2f8
Notes:
sideshowbarker
2024-07-18 05:37:06 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/05dcf3b2f8 Pull-request: https://github.com/SerenityOS/serenity/pull/14816 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/linusg ✅
@ -30,13 +30,18 @@ namespace Web::HTML {
|
||||
|
||||
HTMLElement::HTMLElement(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: Element(document, move(qualified_name))
|
||||
, m_dataset(DOMStringMap::create(*this))
|
||||
{
|
||||
set_prototype(&window().cached_web_prototype("HTMLElement"));
|
||||
}
|
||||
|
||||
HTMLElement::~HTMLElement() = default;
|
||||
|
||||
void HTMLElement::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
m_dataset = DOMStringMap::create(*this);
|
||||
}
|
||||
|
||||
void HTMLElement::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
@ -52,6 +52,8 @@ public:
|
||||
protected:
|
||||
HTMLElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
virtual void parse_attribute(FlyString const& name, String const& value) override;
|
||||
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
@ -69,7 +71,7 @@ private:
|
||||
};
|
||||
ContentEditableState content_editable_state() const;
|
||||
|
||||
JS::NonnullGCPtr<DOMStringMap> m_dataset;
|
||||
JS::GCPtr<DOMStringMap> m_dataset;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/interaction.html#locked-for-focus
|
||||
bool m_locked_for_focus { false };
|
||||
|
Loading…
Reference in New Issue
Block a user