1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:17: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

@ -10,7 +10,7 @@
#include <LibWeb/Layout/LayoutState.h>
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Layout/Viewport.h>
#include <LibWeb/Painting/SVGGeometryPaintable.h>
#include <LibWeb/Painting/SVGPathPaintable.h>
namespace Web::Layout {
@ -272,8 +272,8 @@ void LayoutState::commit(Box& root)
svg_graphics_paintable.set_computed_transforms(*used_values.computed_svg_transforms());
}
if (used_values.computed_svg_path().has_value() && is<Painting::SVGGeometryPaintable>(paintable_box)) {
auto& svg_geometry_paintable = static_cast<Painting::SVGGeometryPaintable&>(paintable_box);
if (used_values.computed_svg_path().has_value() && is<Painting::SVGPathPaintable>(paintable_box)) {
auto& svg_geometry_paintable = static_cast<Painting::SVGPathPaintable&>(paintable_box);
svg_geometry_paintable.set_computed_path(move(*used_values.computed_svg_path()));
}
}