ladybird/Userland/Libraries/LibWeb/MathML/MathMLElement.h
Andreas Kling 4c921e17b7 LibWeb: Allocate dataset lazily for HTML/SVG/MathML elements
Most elements never need a dataset object, so we can avoid creating lots
of objects by making them lazy.
2024-04-25 09:30:30 +02:00

43 lines
1,011 B
C++

/*
* Copyright (c) 2023, Jonah Shafran <jonahshafran@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/DOM/Element.h>
#include <LibWeb/HTML/DOMStringMap.h>
#include <LibWeb/HTML/GlobalEventHandlers.h>
namespace Web::MathML {
class MathMLElement : public DOM::Element
, public HTML::GlobalEventHandlers {
WEB_PLATFORM_OBJECT(MathMLElement, Element);
JS_DECLARE_ALLOCATOR(MathMLElement);
public:
virtual ~MathMLElement() override;
[[nodiscard]] JS::NonnullGCPtr<HTML::DOMStringMap> dataset();
virtual Optional<ARIA::Role> default_role() const override;
void focus();
void blur();
protected:
virtual JS::GCPtr<DOM::EventTarget> global_event_handlers_to_event_target(FlyString const&) override { return *this; }
private:
MathMLElement(DOM::Document&, DOM::QualifiedName);
virtual void visit_edges(Visitor&) override;
virtual void initialize(JS::Realm&) override;
JS::GCPtr<HTML::DOMStringMap> m_dataset;
};
}