ladybird/Userland/Libraries/LibWeb/SVG/SVGScriptElement.h
Andreas Kling bfd354492e LibWeb: Put most LibWeb GC objects in type-specific heap blocks
With this change, we now have ~1200 CellAllocators across both LibJS and
LibWeb in a normal WebContent instance.

This gives us a minimum heap size of 4.7 MiB in the scenario where we
only have one cell allocated per type. Of course, in practice there will
be many more of each type, so the effective overhead is quite a bit
smaller than that in practice.

I left a few types unconverted to this mechanism because I got tired of
doing this. :^)
2023-11-19 22:00:48 +01:00

48 lines
1.1 KiB
C++

/*
* Copyright (c) 2023, Shannon Booth <shannon@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/SVG/SVGElement.h>
namespace Web::SVG {
// https://www.w3.org/TR/SVG/interact.html#InterfaceSVGScriptElement
class SVGScriptElement : public SVGElement {
WEB_PLATFORM_OBJECT(SVGScriptElement, SVGElement);
JS_DECLARE_ALLOCATOR(SVGScriptElement);
public:
void process_the_script_element();
void set_source_line_number(Badge<HTML::HTMLParser>, size_t source_line_number) { m_source_line_number = source_line_number; }
protected:
SVGScriptElement(DOM::Document&, DOM::QualifiedName);
virtual void initialize(JS::Realm&) override;
private:
virtual bool is_svg_script_element() const final { return true; }
virtual void visit_edges(Cell::Visitor&) override;
bool m_already_processed { false };
JS::GCPtr<HTML::ClassicScript> m_script;
size_t m_source_line_number { 1 };
};
}
namespace Web::DOM {
template<>
inline bool Node::fast_is<SVG::SVGScriptElement>() const { return is_svg_script_element(); }
}