DOMPointReadOnly.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/RefCounted.h>
  8. #include <LibGfx/Point.h>
  9. #include <LibWeb/Bindings/Wrappable.h>
  10. #include <LibWeb/Forward.h>
  11. namespace Web::Geometry {
  12. // https://drafts.fxtf.org/geometry/#dompointreadonly
  13. class DOMPointReadOnly
  14. : public RefCounted<DOMPointReadOnly>
  15. , public Bindings::Wrappable {
  16. public:
  17. using WrapperType = Bindings::DOMPointReadOnlyWrapper;
  18. static NonnullRefPtr<DOMPointReadOnly> create_with_global_object(Bindings::WindowObject&, double x = 0, double y = 0, double z = 0, double w = 0)
  19. {
  20. return DOMPointReadOnly::create(x, y, z, w);
  21. }
  22. static NonnullRefPtr<DOMPointReadOnly> create(double x = 0, double y = 0, double z = 0, double w = 0)
  23. {
  24. return adopt_ref(*new DOMPointReadOnly(x, y, z, w));
  25. }
  26. double x() const { return m_x; }
  27. double y() const { return m_y; }
  28. double z() const { return m_z; }
  29. double w() const { return m_w; }
  30. protected:
  31. DOMPointReadOnly(double x, double y, double z, double w)
  32. : m_x(x)
  33. , m_y(y)
  34. , m_z(z)
  35. , m_w(w)
  36. {
  37. }
  38. double m_x;
  39. double m_y;
  40. double m_z;
  41. double m_w;
  42. };
  43. }