Serenity Operating System
at master 50 lines 1.3 kB view raw
1/* 2 * Copyright (c) 2022, 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 <LibGfx/Point.h> 11#include <LibWeb/Bindings/PlatformObject.h> 12#include <LibWeb/Forward.h> 13 14namespace Web::Geometry { 15 16struct DOMPointInit { 17 double x { 0 }; 18 double y { 0 }; 19 double z { 0 }; 20 double w { 1 }; 21}; 22 23// https://drafts.fxtf.org/geometry/#dompointreadonly 24class DOMPointReadOnly : public Bindings::PlatformObject { 25 WEB_PLATFORM_OBJECT(DOMPointReadOnly, Bindings::PlatformObject); 26 27public: 28 static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPointReadOnly>> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1); 29 30 static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPointReadOnly>> from_point(JS::VM&, DOMPointInit const&); 31 32 virtual ~DOMPointReadOnly() override; 33 34 double x() const { return m_x; } 35 double y() const { return m_y; } 36 double z() const { return m_z; } 37 double w() const { return m_w; } 38 39protected: 40 DOMPointReadOnly(JS::Realm&, double x, double y, double z, double w); 41 42 virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override; 43 44 double m_x; 45 double m_y; 46 double m_z; 47 double m_w; 48}; 49 50}