1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +00:00

LibWeb: Layout SVG <mask> elements (but don't paint them)

This allows SVG mask elements to have layout computed, but not connected
to the main paint tree. They should only be reachable if (and painted)
if referenced by the "mask" attribute of another element.

This is controlled by the forms_unconnected_subtree() function on the
paintable, which (if it returns true) prevents the paintable from being
added as a child to what would be its parent.
This commit is contained in:
MacDue 2023-09-17 15:32:24 +01:00 committed by Andreas Kling
parent c5b50ec2f4
commit 0af8d81f48
8 changed files with 19 additions and 29 deletions

View file

@ -1,17 +0,0 @@
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
BlockContainer <html> at (0,0) content-size 800x116 [BFC] children: not-inline
BlockContainer <body> at (8,8) content-size 784x100 children: inline
line 0 width: 100, height: 100, bottom: 100, baseline: 100
frag 0 from SVGSVGBox start: 0, length: 0, rect: [8,8 100x100]
SVGSVGBox <svg> at (8,8) content-size 100x100 [SVG] children: inline
TextNode <#text>
SVGGeometryBox <rect> at (8,8) content-size 100x100 children: not-inline
TextNode <#text>
TextNode <#text>
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x116]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x100]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 100x100]
SVGGeometryPaintable (SVGGeometryBox<rect>) [8,8 100x100]

View file

@ -1,7 +0,0 @@
<!doctype html>
<svg width="100" height="100" viewBox="0 0 1 1" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect x="0" y="0" width="1" height="1" fill="green"/>
<mask id="mask" x="0" y="0" width="1" height="1">
<rect x="0" y="0" width="1" height="1" fill="red"/>
</mask>
</svg>