SVGLength.h 808 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Bindings/PlatformObject.h>
  8. #include <LibWeb/WebIDL/ExceptionOr.h>
  9. namespace Web::SVG {
  10. // https://www.w3.org/TR/SVG11/types.html#InterfaceSVGLength
  11. class SVGLength : public Bindings::PlatformObject {
  12. WEB_PLATFORM_OBJECT(SVGLength, Bindings::PlatformObject);
  13. public:
  14. static JS::NonnullGCPtr<SVGLength> create(JS::Realm&, u8 unit_type, float value);
  15. virtual ~SVGLength() override;
  16. u8 unit_type() const { return m_unit_type; }
  17. float value() const { return m_value; }
  18. WebIDL::ExceptionOr<void> set_value(float value);
  19. private:
  20. SVGLength(JS::Realm&, u8 unit_type, float value);
  21. u8 m_unit_type { 0 };
  22. float m_value { 0 };
  23. };
  24. }