DOMPoint.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. public:
  14. static WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMPoint>> construct_impl(JS::Realm&, double x = 0, double y = 0, double z = 0, double w = 1);
  15. static JS::NonnullGCPtr<DOMPoint> from_point(JS::VM&, DOMPointInit const&);
  16. virtual ~DOMPoint() override;
  17. double x() const { return m_x; }
  18. double y() const { return m_y; }
  19. double z() const { return m_z; }
  20. double w() const { return m_w; }
  21. void set_x(double x) { m_x = x; }
  22. void set_y(double y) { m_y = y; }
  23. void set_z(double z) { m_z = z; }
  24. void set_w(double w) { m_w = w; }
  25. private:
  26. DOMPoint(JS::Realm&, double x, double y, double z, double w);
  27. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  28. };
  29. }