ladybird/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.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

54 lines
1.3 KiB
C++

/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/Point.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Forward.h>
namespace Web::Geometry {
struct DOMPointInit {
double x { 0 };
double y { 0 };
double z { 0 };
double w { 1 };
};
// https://drafts.fxtf.org/geometry/#dompointreadonly
class DOMPointReadOnly : public Bindings::PlatformObject {
WEB_PLATFORM_OBJECT(DOMPointReadOnly, Bindings::PlatformObject);
JS_DECLARE_ALLOCATOR(DOMPointReadOnly);
public:
static JS::NonnullGCPtr<DOMPointReadOnly> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1);
static JS::NonnullGCPtr<DOMPointReadOnly> from_point(JS::VM&, DOMPointInit const&);
virtual ~DOMPointReadOnly() override;
double x() const { return m_x; }
double y() const { return m_y; }
double z() const { return m_z; }
double w() const { return m_w; }
WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPoint>> matrix_transform(DOMMatrixInit&) const;
protected:
DOMPointReadOnly(JS::Realm&, double x, double y, double z, double w);
virtual void initialize(JS::Realm&) override;
double m_x;
double m_y;
double m_z;
double m_w;
};
}