SVGBox.cpp 837 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2020, Matthew Olsson <mattco@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibGfx/Painter.h>
  7. #include <LibWeb/Layout/SVGBox.h>
  8. namespace Web::Layout {
  9. SVGBox::SVGBox(DOM::Document& document, SVG::SVGElement& element, NonnullRefPtr<CSS::StyleProperties> style)
  10. : BlockContainer(document, &element, move(style))
  11. {
  12. set_inline(true);
  13. }
  14. void SVGBox::before_children_paint(PaintContext& context, PaintPhase phase)
  15. {
  16. Node::before_children_paint(context, phase);
  17. if (phase != PaintPhase::Foreground)
  18. return;
  19. context.svg_context().save();
  20. }
  21. void SVGBox::after_children_paint(PaintContext& context, PaintPhase phase)
  22. {
  23. Node::after_children_paint(context, phase);
  24. if (phase != PaintPhase::Foreground)
  25. return;
  26. context.svg_context().restore();
  27. }
  28. }