SVGLength.cpp 633 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/SVG/SVGLength.h>
  7. namespace Web::SVG {
  8. NonnullRefPtr<SVGLength> SVGLength::create(u8 unit_type, float value)
  9. {
  10. return adopt_ref(*new SVGLength(unit_type, value));
  11. }
  12. SVGLength::SVGLength(u8 unit_type, float value)
  13. : m_unit_type(unit_type)
  14. , m_value(value)
  15. {
  16. }
  17. // https://www.w3.org/TR/SVG11/types.html#__svg__SVGLength__value
  18. DOM::ExceptionOr<void> SVGLength::set_value(float value)
  19. {
  20. // FIXME: Raise an exception if this <length> is read-only.
  21. m_value = value;
  22. return {};
  23. }
  24. }