
Rather than try to lay out masks normally, this updates the TreeBuilder to create layout nodes for masks as a child of their user (i.e. the masked element). This allows each use of a mask to be laid out differently, which makes supporting `maskContentUnits=objectBoundingBox` fairly easy. The `SVGFormattingContext` is then updated to lay out masks last (as their sizing may depend on their parent), and treats them like viewports. This is pretty ad-hoc, but the SVG specification does not give any guidance on how to actually implement this.
23 lines
571 B
C++
23 lines
571 B
C++
/*
|
|
* Copyright (c) 2024, MacDue <macdue@dueutil.tech>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Layout/SVGMaskBox.h>
|
|
#include <LibWeb/Painting/SVGMaskPaintable.h>
|
|
#include <LibWeb/Painting/StackingContext.h>
|
|
|
|
namespace Web::Layout {
|
|
|
|
SVGMaskBox::SVGMaskBox(DOM::Document& document, SVG::SVGMaskElement& element, NonnullRefPtr<CSS::StyleProperties> properties)
|
|
: SVGGraphicsBox(document, element, properties)
|
|
{
|
|
}
|
|
|
|
JS::GCPtr<Painting::Paintable> SVGMaskBox::create_paintable() const
|
|
{
|
|
return Painting::SVGMaskPaintable::create(*this);
|
|
}
|
|
|
|
}
|