ladybird/Userland/Libraries/LibWeb/Painting/SVGGraphicsPaintable.cpp
Aliaksandr Kalenik acd5369774 LibWeb: Separate svg mask calculation into SVGMaskable
Preparation work before adding support for SVGForeignObjectElement
masking.

Having a mixin makes possible sharing mask calculation between
SVGForeignObjectElement's paintable and SVGGraphicsPaintable.

Both has to support masking:
- PaintableWithLines (from SVGForeignObjectElement) -> PaintableBox
- SVGGraphicsPaintable -> SVGPaintable -> PaintableBox

After this change it will be possible to introduce a new paintable type
for foreignObject that inherits from both PaintableWithLines and
SVGMaskable.
2024-04-27 07:10:20 +02:00

33 lines
907 B
C++

/*
* Copyright (c) 2018-2022, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Layout/ImageBox.h>
#include <LibWeb/Layout/SVGClipBox.h>
#include <LibWeb/Layout/SVGMaskBox.h>
#include <LibWeb/Painting/SVGClipPaintable.h>
#include <LibWeb/Painting/SVGGraphicsPaintable.h>
#include <LibWeb/Painting/StackingContext.h>
#include <LibWeb/SVG/SVGSVGElement.h>
namespace Web::Painting {
JS::NonnullGCPtr<SVGGraphicsPaintable> SVGGraphicsPaintable::create(Layout::SVGGraphicsBox const& layout_box)
{
return layout_box.heap().allocate_without_realm<SVGGraphicsPaintable>(layout_box);
}
SVGGraphicsPaintable::SVGGraphicsPaintable(Layout::SVGGraphicsBox const& layout_box)
: SVGPaintable(layout_box)
{
}
Layout::SVGGraphicsBox const& SVGGraphicsPaintable::layout_box() const
{
return static_cast<Layout::SVGGraphicsBox const&>(layout_node());
}
}