Serenity Operating System
1/*
2 * Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
3 * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
4 *
5 * SPDX-License-Identifier: BSD-2-Clause
6 */
7
8#pragma once
9
10#include <LibWeb/Geometry/DOMPointReadOnly.h>
11
12namespace Web::Geometry {
13
14// https://drafts.fxtf.org/geometry/#DOMPoint
15class DOMPoint final : public DOMPointReadOnly {
16 WEB_PLATFORM_OBJECT(DOMPoint, DOMPointReadOnly);
17
18public:
19 static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPoint>> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1);
20
21 static JS::NonnullGCPtr<DOMPoint> from_point(JS::VM&, DOMPointInit const&);
22
23 virtual ~DOMPoint() override;
24
25 double x() const { return m_x; }
26 double y() const { return m_y; }
27 double z() const { return m_z; }
28 double w() const { return m_w; }
29
30 void set_x(double x) { m_x = x; }
31 void set_y(double y) { m_y = y; }
32 void set_z(double z) { m_z = z; }
33 void set_w(double w) { m_w = w; }
34
35private:
36 DOMPoint(JS::Realm&, double x, double y, double z, double w);
37
38 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
39};
40
41}