mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27: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:
parent
dc9cb449b1
commit
c93d367d95
16 changed files with 209 additions and 173 deletions
20
Tests/LibWeb/Layout/input/svg-text-with-viewbox.html
Normal file
20
Tests/LibWeb/Layout/input/svg-text-with-viewbox.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<svg viewBox="0 0 240 80" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.small {
|
||||
font: italic 13px sans-serif;
|
||||
}
|
||||
.heavy {
|
||||
font: bold 30px sans-serif;
|
||||
}
|
||||
|
||||
.Rrrrr {
|
||||
font: italic 40px serif;
|
||||
fill: red;
|
||||
}
|
||||
</style>
|
||||
|
||||
<text x="20" y="35" class="small">My</text>
|
||||
<text x="40" y="35" class="heavy">cat</text>
|
||||
<text x="55" y="55" class="small">is</text>
|
||||
<text x="65" y="55" class="Rrrrr">Grumpy!</text>
|
||||
</svg>
|
After Width: | Height: | Size: 457 B |
Loading…
Add table
Add a link
Reference in a new issue