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

LibWeb: Layout SVG <text> elements during layout (not while painting)

Previously, all SVG <text> elements were zero-sized boxes, that were
only actually positioned and sized during painting. This led to a number
of problems, the most visible of which being that text could not be
scaled based on the viewBox.

Which this patch, <text> elements get a correctly sized layout box,
that can be hit-tested and respects the SVG viewBox.

To share code with SVGGeometryElement's the PathData (from the prior
commit) has been split into a computed path and computed transforms.
The computed path is specific to geometry elements, but the computed
transforms are shared between all SVG graphics elements.
This commit is contained in:
MacDue 2023-10-29 19:11:46 +00:00 committed by Alexander Kalenik
parent dc9cb449b1
commit c93d367d95
16 changed files with 209 additions and 173 deletions

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 0x0 children: not-inline
SVGTextBox <text> at (8,-8) content-size 0x16 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]
SVGTextPaintable (SVGTextBox<text>) [8,8 0x0]
SVGSVGPaintable (SVGSVGBox<svg>) [8,8 300x150] overflow: [8,-8 300x166]
SVGTextPaintable (SVGTextBox<text>) [8,-8 0x16]