ladybird/Userland/Libraries/LibWeb/SVG/SVGLength.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

38 lines
910 B
C++

/*
* Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
namespace Web::SVG {
// https://www.w3.org/TR/SVG11/types.html#InterfaceSVGLength
class SVGLength : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(SVGLength, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(SVGLength);
public:
[[nodiscard]] static JS::NonnullGCPtr<SVGLength> create(JS::Realm&, u8 unit_type, float value);
virtual ~SVGLength() override;
u8 unit_type() const { return m_unit_type; }
float value() const { return m_value; }
WebIDL::ExceptionOr<void> set_value(float value);
private:
SVGLength(JS::Realm&, u8 unit_type, float value);
virtual void initialize(JS::Realm&) override;
u8 m_unit_type { 0 };
float m_value { 0 };
};
}