mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 14:37:45 +00:00
LibWeb: Add initial support for nesting SVG viewports
Previously, we were handling viewBoxes/viewports in a slightly hacky way, asking graphics elements to figure out what viewBox to use during layout. This does not work in all cases, and can't allow for more complex SVGs where it is possible to have nested viewports. This commit makes the SVGFormattingContext keep track of the viewport/boxes, and it now lays out each viewport recursively, where each nested `<svg>` or `<symbol>` can establish a new viewport. This fixes some previous edge cases, and starts to allow nested viewports (there's still some issues to resolve there). Fixes #22931
This commit is contained in:
parent
546143e9a6
commit
5cf1570f40
13 changed files with 229 additions and 67 deletions
21
Tests/LibWeb/Layout/expected/svg/use-honor-outer-viewBox.txt
Normal file
21
Tests/LibWeb/Layout/expected/svg/use-honor-outer-viewBox.txt
Normal file
|
@ -0,0 +1,21 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 children: not-inline
|
||||
BlockContainer <html> at (0,0) content-size 800x118 [BFC] children: not-inline
|
||||
BlockContainer <body> at (8,8) content-size 784x102 children: inline
|
||||
frag 0 from SVGSVGBox start: 0, length: 0, rect: [9,9 100x100] baseline: 102
|
||||
SVGSVGBox <svg#outer> at (9,9) content-size 100x100 [SVG] children: inline
|
||||
TextNode <#text>
|
||||
Box <use> at (9,9) content-size 100x100 children: inline
|
||||
SVGSVGBox <svg#whee> at (9,9) content-size 100x100 [SVG] children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <rect> at (9,9) content-size 50x50 children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
PaintableWithLines (BlockContainer<HTML>) [0,0 800x118]
|
||||
PaintableWithLines (BlockContainer<BODY>) [8,8 784x102]
|
||||
SVGSVGPaintable (SVGSVGBox<svg>#outer) [8,8 102x102]
|
||||
PaintableBox (Box<use>) [9,9 100x100]
|
||||
SVGSVGPaintable (SVGSVGBox<svg>#whee) [9,9 100x100]
|
||||
SVGPathPaintable (SVGGeometryBox<rect>) [9,9 50x50]
|
Loading…
Add table
Add a link
Reference in a new issue