1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:48:11 +00:00

LibWeb: Implement DOMPoint/DOMPointReadOnly.fromPoint()

This commit is contained in:
Sam Atkins 2022-10-06 15:25:08 +01:00 committed by Linus Groh
parent 0823a3c422
commit ab19c5fab8
6 changed files with 38 additions and 2 deletions

View file

@ -1,5 +1,6 @@
/*
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@ -12,6 +13,13 @@
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);
@ -19,6 +27,8 @@ class DOMPointReadOnly : public Bindings::PlatformObject {
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; }