SVGSVGElement.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright (c) 2020, Matthew Olsson <matthewcolsson@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibGfx/Bitmap.h>
  8. #include <LibWeb/SVG/AttributeParser.h>
  9. #include <LibWeb/SVG/SVGGraphicsElement.h>
  10. #include <LibWeb/SVG/ViewBox.h>
  11. namespace Web::SVG {
  12. class SVGSVGElement final : public SVGGraphicsElement {
  13. WEB_PLATFORM_OBJECT(SVGSVGElement, SVGGraphicsElement);
  14. public:
  15. virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
  16. virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
  17. virtual bool requires_svg_container() const override { return false; }
  18. virtual bool is_svg_container() const override { return true; }
  19. Optional<ViewBox> const& view_box() const { return m_view_box; }
  20. Optional<PreserveAspectRatio> const& preserve_aspect_ratio() const { return m_preserve_aspect_ratio; }
  21. private:
  22. SVGSVGElement(DOM::Document&, DOM::QualifiedName);
  23. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  24. virtual bool is_svg_svg_element() const override { return true; }
  25. virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
  26. Optional<ViewBox> m_view_box;
  27. Optional<PreserveAspectRatio> m_preserve_aspect_ratio;
  28. };
  29. }
  30. namespace Web::DOM {
  31. template<>
  32. inline bool Node::fast_is<SVG::SVGSVGElement>() const { return is_svg_svg_element(); }
  33. }