1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 14:47:34 +00:00

LibWeb: Support transforms, stroking, gradients, etc for SVG <text>

This makes use of the new Gfx::Path::text() to handle SVG text elements,
with this text is just a regular path, and can be manipulated like any
other graphics element.

This removes the SVGTextPaintable and makes both <text> and geometry
elements use a new (shared) SVGPathPaintable. This is identical to the
old SVGGeometryPaintable. This simplifies painting as once something is
resolved to a Gfx::Path, the painting logic is the same.
This commit is contained in:
MacDue 2023-11-04 21:31:35 +00:00 committed by Alexander Kalenik
parent 50d33f79fa
commit 4c5d48f861
30 changed files with 144 additions and 180 deletions

View file

@ -13,4 +13,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x800]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x800]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x784]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 784x784]
SVGGeometryPaintable (SVGGeometryBox<circle>) [47.1875,47.1875 548.796875x548.796875]
SVGPathPaintable (SVGGeometryBox<circle>) [47.1875,47.1875 548.796875x548.796875]

View file

@ -10,4 +10,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x800]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x800]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x784]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 784x784]
SVGGeometryPaintable (SVGGeometryBox<rect>) [8,8 784x784]
SVGPathPaintable (SVGGeometryBox<rect>) [8,8 784x784]

View file

@ -19,5 +19,5 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x800]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x784]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 784x784]
SVGGraphicsPaintable (SVGGraphicsBox<g>) [121.671875,121.671875 556.65625x556.65625]
SVGGeometryPaintable (SVGGeometryBox<circle>) [121.671875,121.671875 399.84375x399.84375]
SVGGeometryPaintable (SVGGeometryBox<circle>) [278.484375,278.484375 399.84375x399.84375]
SVGPathPaintable (SVGGeometryBox<circle>) [121.671875,121.671875 399.84375x399.84375]
SVGPathPaintable (SVGGeometryBox<circle>) [278.484375,278.484375 399.84375x399.84375]

View file

@ -15,4 +15,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 24x24]
SVGGraphicsPaintable (SVGGraphicsBox<g>) [8,8 24x24]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 24x24]
SVGGeometryPaintable (SVGGeometryBox<rect>) [8,8 24x24]
SVGPathPaintable (SVGGeometryBox<rect>) [8,8 24x24]

View file

@ -10,6 +10,6 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x170]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x154]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 102x52]
SVGGeometryPaintable (SVGGeometryBox<rect>) [21.5,21.5 75x25]
SVGPathPaintable (SVGGeometryBox<rect>) [21.5,21.5 75x25]
SVGSVGPaintable (SVGSVGBox<svg>) [8,60 202x102]
SVGGeometryPaintable (SVGGeometryBox<rect>) [34,86 150x50]
SVGPathPaintable (SVGGeometryBox<rect>) [34,86 150x50]

View file

@ -10,4 +10,4 @@ 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<path>) [8,10 100x48]
SVGPathPaintable (SVGGeometryBox<path>) [8,10 100x48]

View file

@ -10,4 +10,4 @@ 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<path>) [28,28 60x60]
SVGPathPaintable (SVGGeometryBox<path>) [28,28 60x60]

View file

@ -27,4 +27,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 300x150]
PaintableBox (Box<use>) [8,8 0x0]
PaintableBox (Box<symbol>#braces) [8,8 0x0]
SVGGeometryPaintable (SVGGeometryBox<path>) [92.375,26.75 131.25x112.15625]
SVGPathPaintable (SVGGeometryBox<path>) [92.375,26.75 131.25x112.15625]

View file

@ -10,4 +10,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x118]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x102]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 102x102]
SVGGeometryPaintable (SVGGeometryBox<rect>) [29,29 60x60]
SVGPathPaintable (SVGGeometryBox<rect>) [29,29 60x60]

View file

@ -8,4 +8,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600] overflow: [0,0 800x800]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x800]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x784]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 784x784]
SVGGeometryPaintable (SVGGeometryBox<rect>) [8,8 784x784]
SVGPathPaintable (SVGGeometryBox<rect>) [8,8 784x784]

View file

@ -26,4 +26,4 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
ImagePaintable (ImageBox<IMG>) [8,21 0x0]
TextPaintable (TextNode<#text>)
SVGSVGPaintable (SVGSVGBox<svg>) [16,21 0x0]
SVGGeometryPaintable (SVGGeometryBox<rect>) [16,21 1x1]
SVGPathPaintable (SVGGeometryBox<rect>) [16,21 1x1]

View file

@ -4,11 +4,11 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
line 0 width: 300, height: 150, bottom: 150, baseline: 150
frag 0 from SVGSVGBox start: 0, length: 0, rect: [8,8 300x150]
SVGSVGBox <svg> at (8,8) content-size 300x150 [SVG] children: not-inline
SVGTextBox <text> at (8,-8) content-size 0x16 children: not-inline
SVGTextBox <text> at (8,8) content-size 0x0 children: not-inline
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<HTML>) [0,0 800x600]
PaintableWithLines (BlockContainer<BODY>) [8,8 784x150]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 300x150] overflow: [8,-8 300x166]
SVGTextPaintable (SVGTextBox<text>) [8,-8 0x16]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 300x150]
SVGPathPaintable (SVGTextBox<text>) [8,8 0x0]