LibWeb: Test layout of standalone SVG document: edge cases
Tests with different combinations of missing width, height and viewBox. All tests confirmed to work on Ladybird: - exactly the same as Chromium (131.0.6778.85) - almost the same as Firefox (129.0.2) - only difference: standalone-w.svg: same size, different alignment
Author: https://github.com/manuel-za
Commit: 5d85f3a5c8
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2806
Reviewed-by: https://github.com/ADKaster ✅
Reviewed-by: https://github.com/AtkinsSJ ✅
Reviewed-by: https://github.com/awesomekling
18
Tests/LibWeb/Layout/expected/svg/standalone-h.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||
SVGSVGBox <svg> at (0,0) content-size 128x600 [SVG] children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <rect> at (0,172) content-size 128x256 children: not-inline
|
||||
TextNode <#text>
|
||||
SVGGraphicsBox <g> at (0,172) content-size 128x256 children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <path> at (0,172) content-size 128x256 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
SVGSVGPaintable (SVGSVGBox<svg>) [0,0 128x600]
|
||||
SVGPathPaintable (SVGGeometryBox<rect>) [0,172 128x256]
|
||||
SVGGraphicsPaintable (SVGGraphicsBox<g>) [0,172 128x256]
|
||||
SVGPathPaintable (SVGGeometryBox<path>) [0,172 128x256]
|
||||
|
18
Tests/LibWeb/Layout/expected/svg/standalone-vb-h.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||
SVGSVGBox <svg> at (0,0) content-size 128x600 [SVG] children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <rect> at (0,0) content-size 32x64 children: not-inline
|
||||
TextNode <#text>
|
||||
SVGGraphicsBox <g> at (0,0) content-size 32x64 children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <path> at (0,0) content-size 32x64 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
SVGSVGPaintable (SVGSVGBox<svg>) [0,0 128x600]
|
||||
SVGPathPaintable (SVGGeometryBox<rect>) [0,0 32x64]
|
||||
SVGGraphicsPaintable (SVGGraphicsBox<g>) [0,0 32x64]
|
||||
SVGPathPaintable (SVGGeometryBox<path>) [0,0 32x64]
|
||||
|
18
Tests/LibWeb/Layout/expected/svg/standalone-vb-w.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||
SVGSVGBox <svg> at (0,0) content-size 800x256 [SVG] children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <rect> at (0,0) content-size 32x64 children: not-inline
|
||||
TextNode <#text>
|
||||
SVGGraphicsBox <g> at (0,0) content-size 32x64 children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <path> at (0,0) content-size 32x64 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
SVGSVGPaintable (SVGSVGBox<svg>) [0,0 800x256]
|
||||
SVGPathPaintable (SVGGeometryBox<rect>) [0,0 32x64]
|
||||
SVGGraphicsPaintable (SVGGraphicsBox<g>) [0,0 32x64]
|
||||
SVGPathPaintable (SVGGeometryBox<path>) [0,0 32x64]
|
||||
|
18
Tests/LibWeb/Layout/expected/svg/standalone-vb-wh.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||
SVGSVGBox <svg> at (0,0) content-size 800x600 [SVG] children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <rect> at (0,0) content-size 32x64 children: not-inline
|
||||
TextNode <#text>
|
||||
SVGGraphicsBox <g> at (0,0) content-size 32x64 children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <path> at (0,0) content-size 32x64 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
SVGSVGPaintable (SVGSVGBox<svg>) [0,0 800x600]
|
||||
SVGPathPaintable (SVGGeometryBox<rect>) [0,0 32x64]
|
||||
SVGGraphicsPaintable (SVGGraphicsBox<g>) [0,0 32x64]
|
||||
SVGPathPaintable (SVGGeometryBox<path>) [0,0 32x64]
|
||||
|
18
Tests/LibWeb/Layout/expected/svg/standalone-vb.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||
SVGSVGBox <svg> at (0,0) content-size 128x256 [SVG] children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <rect> at (0,0) content-size 32x64 children: not-inline
|
||||
TextNode <#text>
|
||||
SVGGraphicsBox <g> at (0,0) content-size 32x64 children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <path> at (0,0) content-size 32x64 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
SVGSVGPaintable (SVGSVGBox<svg>) [0,0 128x256]
|
||||
SVGPathPaintable (SVGGeometryBox<rect>) [0,0 32x64]
|
||||
SVGGraphicsPaintable (SVGGraphicsBox<g>) [0,0 32x64]
|
||||
SVGPathPaintable (SVGGeometryBox<path>) [0,0 32x64]
|
||||
|
18
Tests/LibWeb/Layout/expected/svg/standalone-w.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||
SVGSVGBox <svg> at (0,0) content-size 800x256 [SVG] children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <rect> at (336,0) content-size 128x256 children: not-inline
|
||||
TextNode <#text>
|
||||
SVGGraphicsBox <g> at (336,0) content-size 128x256 children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <path> at (336,0) content-size 128x256 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
SVGSVGPaintable (SVGSVGBox<svg>) [0,0 800x256]
|
||||
SVGPathPaintable (SVGGeometryBox<rect>) [336,0 128x256]
|
||||
SVGGraphicsPaintable (SVGGraphicsBox<g>) [336,0 128x256]
|
||||
SVGPathPaintable (SVGGeometryBox<path>) [336,0 128x256]
|
||||
|
18
Tests/LibWeb/Layout/expected/svg/standalone-wh.txt
Normal file
|
@ -0,0 +1,18 @@
|
|||
Viewport <#document> at (0,0) content-size 800x600 [BFC] children: not-inline
|
||||
SVGSVGBox <svg> at (0,0) content-size 800x600 [SVG] children: inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <rect> at (250,0) content-size 300x600 children: not-inline
|
||||
TextNode <#text>
|
||||
SVGGraphicsBox <g> at (250,0) content-size 300x600 children: inline
|
||||
TextNode <#text>
|
||||
SVGGeometryBox <path> at (250,0) content-size 300x600 children: not-inline
|
||||
TextNode <#text>
|
||||
TextNode <#text>
|
||||
|
||||
ViewportPaintable (Viewport<#document>) [0,0 800x600]
|
||||
SVGSVGPaintable (SVGSVGBox<svg>) [0,0 800x600]
|
||||
SVGPathPaintable (SVGGeometryBox<rect>) [250,0 300x600]
|
||||
SVGGraphicsPaintable (SVGGraphicsBox<g>) [250,0 300x600]
|
||||
SVGPathPaintable (SVGGeometryBox<path>) [250,0 300x600]
|
||||
|
7
Tests/LibWeb/Layout/input/svg/standalone-h.svg
Normal file
|
@ -0,0 +1,7 @@
|
|||
<svg viewBox="0 0 32 64" width="128" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>white diamond on blue; no height</title>
|
||||
<rect x="0" y="0" width="32" height="64" fill="blue"/>
|
||||
<g fill="white">
|
||||
<path d="M16 0 L32 32 L16 64 L0 32 Z" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 270 B |
7
Tests/LibWeb/Layout/input/svg/standalone-vb-h.svg
Normal file
|
@ -0,0 +1,7 @@
|
|||
<svg width="128" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>white diamond on blue; no viewBox; no height</title>
|
||||
<rect x="0" y="0" width="32" height="64" fill="blue"/>
|
||||
<g fill="white">
|
||||
<path d="M16 0 L32 32 L16 64 L0 32 Z" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 262 B |
7
Tests/LibWeb/Layout/input/svg/standalone-vb-w.svg
Normal file
|
@ -0,0 +1,7 @@
|
|||
<svg height="256" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>white diamond on blue; no viewBox; no width</title>
|
||||
<rect x="0" y="0" width="32" height="64" fill="blue"/>
|
||||
<g fill="white">
|
||||
<path d="M16 0 L32 32 L16 64 L0 32 Z" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 262 B |
7
Tests/LibWeb/Layout/input/svg/standalone-vb-wh.svg
Normal file
|
@ -0,0 +1,7 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<title>white diamond on blue; no viewBox; no width; no height</title>
|
||||
<rect x="0" y="0" width="32" height="64" fill="blue"/>
|
||||
<g fill="white">
|
||||
<path d="M16 0 L32 32 L16 64 L0 32 Z" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 260 B |
7
Tests/LibWeb/Layout/input/svg/standalone-vb.svg
Normal file
|
@ -0,0 +1,7 @@
|
|||
<svg width="128" height="256" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>white diamond on blue; no viewBox</title>
|
||||
<rect x="0" y="0" width="32" height="64" fill="blue"/>
|
||||
<g fill="white">
|
||||
<path d="M16 0 L32 32 L16 64 L0 32 Z" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 264 B |
13
Tests/LibWeb/Layout/input/svg/standalone-w.svg
Normal file
|
@ -0,0 +1,13 @@
|
|||
<!--
|
||||
This will display identical on Ladybird and Chromium (131.0.6778.85) (centered), but left-aligned on Firefox (129.0.2)
|
||||
Guessing Firefox has it right; no reason why missing height should align center (see standalone.svg where all left align)
|
||||
Suggestion: not a priority, since it works the same as chromium
|
||||
Likely a result of settings in Default.css
|
||||
-->
|
||||
<svg viewBox="0 0 32 64" height="256" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>white diamond on blue; no width</title>
|
||||
<rect x="0" y="0" width="32" height="64" fill="blue"/>
|
||||
<g fill="white">
|
||||
<path d="M16 0 L32 32 L16 64 L0 32 Z" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 643 B |
7
Tests/LibWeb/Layout/input/svg/standalone-wh.svg
Normal file
|
@ -0,0 +1,7 @@
|
|||
<svg viewBox="0 0 32 64" xmlns="http://www.w3.org/2000/svg">
|
||||
<title>white diamond on blue; no width ; no height</title>
|
||||
<rect x="0" y="0" width="32" height="64" fill="blue"/>
|
||||
<g fill="white">
|
||||
<path d="M16 0 L32 32 L16 64 L0 32 Z" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 269 B |