SVGTextContentElement.h 1000 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/SVG/SVGGraphicsElement.h>
  8. #include <LibWeb/WebIDL/ExceptionOr.h>
  9. namespace Web::SVG {
  10. // https://svgwg.org/svg2-draft/text.html#InterfaceSVGTextContentElement
  11. class SVGTextContentElement : public SVGGraphicsElement {
  12. WEB_PLATFORM_OBJECT(SVGTextContentElement, SVGGraphicsElement);
  13. public:
  14. virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
  15. virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
  16. WebIDL::ExceptionOr<int> get_number_of_chars() const;
  17. Gfx::FloatPoint get_offset() const;
  18. protected:
  19. SVGTextContentElement(DOM::Document&, DOM::QualifiedName);
  20. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  21. private:
  22. float m_x { 0 };
  23. float m_y { 0 };
  24. float m_dx { 0 };
  25. float m_dy { 0 };
  26. };
  27. }