2022-07-12 20:06:50 +02:00
|
|
|
/*
|
2024-10-04 13:19:50 +02:00
|
|
|
* Copyright (c) 2021, Andreas Kling <andreas@ladybird.org>
|
2022-10-06 15:25:08 +01:00
|
|
|
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
2022-07-12 20:06:50 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2025-07-19 19:35:33 -07:00
|
|
|
#include <LibWeb/Export.h>
|
2022-07-12 20:06:50 +02:00
|
|
|
#include <LibWeb/Geometry/DOMPointReadOnly.h>
|
|
|
|
|
|
|
|
namespace Web::Geometry {
|
|
|
|
|
|
|
|
// https://drafts.fxtf.org/geometry/#DOMPoint
|
2025-07-19 19:35:33 -07:00
|
|
|
class WEB_API DOMPoint final : public DOMPointReadOnly {
|
2022-09-03 21:32:14 +02:00
|
|
|
WEB_PLATFORM_OBJECT(DOMPoint, DOMPointReadOnly);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(DOMPoint);
|
2022-07-12 20:06:50 +02:00
|
|
|
|
2022-09-03 21:32:14 +02:00
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
static GC::Ref<DOMPoint> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1);
|
|
|
|
static GC::Ref<DOMPoint> create(JS::Realm&);
|
2022-07-12 20:06:50 +02:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
static GC::Ref<DOMPoint> from_point(JS::VM&, DOMPointInit const&);
|
2022-10-06 15:25:08 +01:00
|
|
|
|
2022-09-03 21:32:14 +02:00
|
|
|
virtual ~DOMPoint() override;
|
2022-07-12 20:06:50 +02:00
|
|
|
|
|
|
|
double x() const { return m_x; }
|
|
|
|
double y() const { return m_y; }
|
|
|
|
double z() const { return m_z; }
|
|
|
|
double w() const { return m_w; }
|
|
|
|
|
|
|
|
void set_x(double x) { m_x = x; }
|
|
|
|
void set_y(double y) { m_y = y; }
|
|
|
|
void set_z(double z) { m_z = z; }
|
|
|
|
void set_w(double w) { m_w = w; }
|
|
|
|
|
2025-07-14 17:15:09 +01:00
|
|
|
virtual HTML::SerializeType serialize_type() const override { return HTML::SerializeType::DOMPoint; }
|
2024-03-09 23:10:11 +01:00
|
|
|
|
2022-07-12 20:06:50 +02:00
|
|
|
private:
|
2022-09-25 18:03:02 -06:00
|
|
|
DOMPoint(JS::Realm&, double x, double y, double z, double w);
|
2024-03-09 23:10:11 +01:00
|
|
|
DOMPoint(JS::Realm&);
|
2023-01-10 06:28:20 -05:00
|
|
|
|
2023-08-07 08:41:28 +02:00
|
|
|
virtual void initialize(JS::Realm&) override;
|
2022-07-12 20:06:50 +02:00
|
|
|
};
|
2022-09-03 21:32:14 +02:00
|
|
|
|
2022-07-12 20:06:50 +02:00
|
|
|
}
|