SVGRectElement.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. public:
  12. using WrapperType = Bindings::SVGRectElementWrapper;
  13. SVGRectElement(DOM::Document&, DOM::QualifiedName);
  14. virtual ~SVGRectElement() override = default;
  15. virtual void parse_attribute(FlyString const& name, String const& value) override;
  16. virtual Gfx::Path& get_path() override;
  17. NonnullRefPtr<SVGAnimatedLength> x() const;
  18. NonnullRefPtr<SVGAnimatedLength> y() const;
  19. NonnullRefPtr<SVGAnimatedLength> width() const;
  20. NonnullRefPtr<SVGAnimatedLength> height() const;
  21. NonnullRefPtr<SVGAnimatedLength> rx() const;
  22. NonnullRefPtr<SVGAnimatedLength> ry() const;
  23. private:
  24. Gfx::FloatPoint calculate_used_corner_radius_values();
  25. Optional<Gfx::Path> m_path;
  26. Optional<float> m_x;
  27. Optional<float> m_y;
  28. Optional<float> m_width;
  29. Optional<float> m_height;
  30. Optional<float> m_radius_x;
  31. Optional<float> m_radius_y;
  32. };
  33. }