mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:17:35 +00:00
LibWeb: Special case SVG masks during layout
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.
This commit is contained in:
parent
15e3b0ebde
commit
163b6bb401
18 changed files with 232 additions and 76 deletions
21
Userland/Libraries/LibWeb/Painting/SVGMaskPaintable.cpp
Normal file
21
Userland/Libraries/LibWeb/Painting/SVGMaskPaintable.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2024, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Painting/SVGMaskPaintable.h>
|
||||
|
||||
namespace Web::Painting {
|
||||
|
||||
JS::NonnullGCPtr<SVGMaskPaintable> SVGMaskPaintable::create(Layout::SVGMaskBox const& layout_box)
|
||||
{
|
||||
return layout_box.heap().allocate_without_realm<SVGMaskPaintable>(layout_box);
|
||||
}
|
||||
|
||||
SVGMaskPaintable::SVGMaskPaintable(Layout::SVGMaskBox const& layout_box)
|
||||
: SVGGraphicsPaintable(layout_box)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue