SVGRectElement.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/SVG/SVGGeometryElement.h>
  8. namespace Web::SVG {
  9. // https://www.w3.org/TR/SVG11/shapes.html#RectElement
  10. class SVGRectElement final : public SVGGeometryElement {
  11. WEB_PLATFORM_OBJECT(SVGRectElement, SVGGeometryElement);
  12. public:
  13. virtual ~SVGRectElement() override = default;
  14. virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
  15. virtual Gfx::Path& get_path() override;
  16. JS::NonnullGCPtr<SVGAnimatedLength> x() const;
  17. JS::NonnullGCPtr<SVGAnimatedLength> y() const;
  18. JS::NonnullGCPtr<SVGAnimatedLength> width() const;
  19. JS::NonnullGCPtr<SVGAnimatedLength> height() const;
  20. JS::NonnullGCPtr<SVGAnimatedLength> rx() const;
  21. JS::NonnullGCPtr<SVGAnimatedLength> ry() const;
  22. private:
  23. SVGRectElement(DOM::Document&, DOM::QualifiedName);
  24. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  25. Gfx::FloatSize calculate_used_corner_radius_values() const;
  26. Optional<Gfx::Path> m_path;
  27. Optional<float> m_x;
  28. Optional<float> m_y;
  29. Optional<float> m_width;
  30. Optional<float> m_height;
  31. Optional<float> m_radius_x;
  32. Optional<float> m_radius_y;
  33. };
  34. }