1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 00:27: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:
MacDue 2024-03-11 18:26:58 +00:00 committed by Andreas Kling
parent 15e3b0ebde
commit 163b6bb401
18 changed files with 232 additions and 76 deletions

View file

@ -469,6 +469,7 @@ set(SOURCES
Layout/SVGGeometryBox.cpp
Layout/SVGGraphicsBox.cpp
Layout/SVGSVGBox.cpp
Layout/SVGMaskBox.cpp
Layout/SVGTextBox.cpp
Layout/SVGTextPathBox.cpp
Layout/TableFormattingContext.cpp
@ -523,6 +524,7 @@ set(SOURCES
Painting/RecordingPainter.cpp
Painting/SVGPathPaintable.cpp
Painting/SVGGraphicsPaintable.cpp
Painting/SVGMaskPaintable.cpp
Painting/SVGPaintable.cpp
Painting/SVGSVGPaintable.cpp
Painting/ShadowPainting.cpp