DOMPoint.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #pragma once
  8. #include <LibWeb/Geometry/DOMPointReadOnly.h>
  9. namespace Web::Geometry {
  10. // https://drafts.fxtf.org/geometry/#DOMPoint
  11. class DOMPoint final : public DOMPointReadOnly {
  12. WEB_PLATFORM_OBJECT(DOMPoint, DOMPointReadOnly);
  13. JS_DECLARE_ALLOCATOR(DOMPoint);
  14. public:
  15. static JS::NonnullGCPtr<DOMPoint> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1);
  16. static JS::NonnullGCPtr<DOMPoint> from_point(JS::VM&, DOMPointInit const&);
  17. virtual ~DOMPoint() override;
  18. double x() const { return m_x; }
  19. double y() const { return m_y; }
  20. double z() const { return m_z; }
  21. double w() const { return m_w; }
  22. void set_x(double x) { m_x = x; }
  23. void set_y(double y) { m_y = y; }
  24. void set_z(double z) { m_z = z; }
  25. void set_w(double w) { m_w = w; }
  26. private:
  27. DOMPoint(JS::Realm&, double x, double y, double z, double w);
  28. virtual void initialize(JS::Realm&) override;
  29. };
  30. }