SVGSVGBox.cpp 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Layout/SVGSVGBox.h>
  7. namespace Web::Layout {
  8. SVGSVGBox::SVGSVGBox(DOM::Document& document, SVG::SVGSVGElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
  9. : SVGGraphicsBox(document, element, properties)
  10. {
  11. }
  12. void SVGSVGBox::prepare_for_replaced_layout()
  13. {
  14. set_has_intrinsic_width(true);
  15. set_has_intrinsic_height(true);
  16. set_intrinsic_width(dom_node().width());
  17. set_intrinsic_height(dom_node().height());
  18. }
  19. void SVGSVGBox::before_children_paint(PaintContext& context, PaintPhase phase)
  20. {
  21. if (phase != PaintPhase::Foreground)
  22. return;
  23. if (!context.has_svg_context())
  24. context.set_svg_context(SVGContext());
  25. SVGGraphicsBox::before_children_paint(context, phase);
  26. }
  27. void SVGSVGBox::after_children_paint(PaintContext& context, PaintPhase phase)
  28. {
  29. SVGGraphicsBox::after_children_paint(context, phase);
  30. if (phase != PaintPhase::Foreground)
  31. return;
  32. }
  33. }