SVGLength.h 903 B

123456789101112131415161718192021222324252627282930313233343536
  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 WebIDL::ExceptionOr<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. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  22. u8 m_unit_type { 0 };
  23. float m_value { 0 };
  24. };
  25. }