SVGSVGElement.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) 2020, Matthew Olsson <matthewcolsson@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibGfx/Painter.h>
  7. #include <LibWeb/CSS/StyleResolver.h>
  8. #include <LibWeb/DOM/Document.h>
  9. #include <LibWeb/DOM/Event.h>
  10. #include <LibWeb/Layout/SVGSVGBox.h>
  11. #include <LibWeb/SVG/SVGPathElement.h>
  12. #include <LibWeb/SVG/SVGSVGElement.h>
  13. #include <ctype.h>
  14. namespace Web::SVG {
  15. SVGSVGElement::SVGSVGElement(DOM::Document& document, QualifiedName qualified_name)
  16. : SVGGraphicsElement(document, qualified_name)
  17. {
  18. }
  19. RefPtr<Layout::Node> SVGSVGElement::create_layout_node()
  20. {
  21. auto style = document().style_resolver().resolve_style(*this);
  22. if (style->display() == CSS::Display::None)
  23. return nullptr;
  24. return adopt_ref(*new Layout::SVGSVGBox(document(), *this, move(style)));
  25. }
  26. unsigned SVGSVGElement::width() const
  27. {
  28. return attribute(HTML::AttributeNames::width).to_uint().value_or(300);
  29. }
  30. unsigned SVGSVGElement::height() const
  31. {
  32. return attribute(HTML::AttributeNames::height).to_uint().value_or(150);
  33. }
  34. }