SVGSVGElement.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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/SVGGraphicsElement.h>
  9. #include <LibWeb/SVG/ViewBox.h>
  10. namespace Web::SVG {
  11. class SVGSVGElement final : public SVGGraphicsElement {
  12. WEB_PLATFORM_OBJECT(SVGSVGElement, SVGGraphicsElement);
  13. public:
  14. virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
  15. virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
  16. virtual bool requires_svg_container() const override { return false; }
  17. virtual bool is_svg_container() const override { return true; }
  18. Optional<ViewBox> const& view_box() const { return m_view_box; }
  19. private:
  20. SVGSVGElement(DOM::Document&, DOM::QualifiedName);
  21. virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
  22. virtual bool is_svg_svg_element() const override { return true; }
  23. virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
  24. Optional<ViewBox> m_view_box;
  25. };
  26. }
  27. namespace Web::DOM {
  28. template<>
  29. inline bool Node::fast_is<SVG::SVGSVGElement>() const { return is_svg_svg_element(); }
  30. }