Coverage Report

Created: 2026-09-26 06:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibWeb/Geometry/DOMPointReadOnly.h
Line
Count
Source
1
/*
2
 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
3
 * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
4
 * Copyright (c) 2024, Kenneth Myhra <kennethmyhra@serenityos.org>
5
 *
6
 * SPDX-License-Identifier: BSD-2-Clause
7
 */
8
9
#pragma once
10
11
#include <LibGfx/Point.h>
12
#include <LibWeb/Bindings/PlatformObject.h>
13
#include <LibWeb/Bindings/Serializable.h>
14
#include <LibWeb/Forward.h>
15
16
namespace Web::Geometry {
17
18
struct DOMPointInit {
19
    double x { 0 };
20
    double y { 0 };
21
    double z { 0 };
22
    double w { 1 };
23
};
24
25
// https://drafts.fxtf.org/geometry/#dompointreadonly
26
class DOMPointReadOnly
27
    : public Bindings::PlatformObject
28
    , public Bindings::Serializable {
29
    WEB_PLATFORM_OBJECT(DOMPointReadOnly, Bindings::PlatformObject);
30
    JS_DECLARE_ALLOCATOR(DOMPointReadOnly);
31
32
public:
33
    static JS::NonnullGCPtr<DOMPointReadOnly> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1);
34
    static JS::NonnullGCPtr<DOMPointReadOnly> create(JS::Realm&);
35
36
    static JS::NonnullGCPtr<DOMPointReadOnly> from_point(JS::VM&, DOMPointInit const&);
37
38
    virtual ~DOMPointReadOnly() override;
39
40
0
    double x() const { return m_x; }
41
0
    double y() const { return m_y; }
42
0
    double z() const { return m_z; }
43
0
    double w() const { return m_w; }
44
45
    WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPoint>> matrix_transform(DOMMatrixInit&) const;
46
47
0
    virtual StringView interface_name() const override { return "DOMPointReadOnly"sv; }
48
    virtual WebIDL::ExceptionOr<void> serialization_steps(HTML::SerializationRecord&, bool for_storage, HTML::SerializationMemory&) override;
49
    virtual WebIDL::ExceptionOr<void> deserialization_steps(ReadonlySpan<u32> const&, size_t& position, HTML::DeserializationMemory&) override;
50
51
protected:
52
    DOMPointReadOnly(JS::Realm&, double x, double y, double z, double w);
53
    explicit DOMPointReadOnly(JS::Realm&);
54
55
    virtual void initialize(JS::Realm&) override;
56
57
    double m_x;
58
    double m_y;
59
    double m_z;
60
    double m_w;
61
};
62
63
}