SVGSVGBox.cpp 875 B

1234567891011121314151617181920212223242526272829303132333435
  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::before_children_paint(PaintContext& context, PaintPhase phase)
  13. {
  14. if (phase != PaintPhase::Foreground)
  15. return;
  16. if (!context.has_svg_context())
  17. context.set_svg_context(SVGContext());
  18. SVGGraphicsBox::before_children_paint(context, phase);
  19. }
  20. void SVGSVGBox::after_children_paint(PaintContext& context, PaintPhase phase)
  21. {
  22. SVGGraphicsBox::after_children_paint(context, phase);
  23. if (phase != PaintPhase::Foreground)
  24. return;
  25. context.clear_svg_context();
  26. }
  27. }