SVGBox.cpp 811 B

123456789101112131415161718192021222324252627282930313233
  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. : ReplacedBox(document, element, move(style))
  11. {
  12. }
  13. void SVGBox::before_children_paint(PaintContext& context, PaintPhase phase)
  14. {
  15. Node::before_children_paint(context, phase);
  16. if (phase != PaintPhase::Foreground)
  17. return;
  18. context.svg_context().save();
  19. }
  20. void SVGBox::after_children_paint(PaintContext& context, PaintPhase phase)
  21. {
  22. Node::after_children_paint(context, phase);
  23. if (phase != PaintPhase::Foreground)
  24. return;
  25. context.svg_context().restore();
  26. }
  27. }