1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:37:43 +00:00

LibWeb: Add initial support for SVG <textPath>

This patch adds basic support for the SVG `<textPath>`, so it supports
placing text along a path, but none of the extra attributes for
controlling the layout of the text. This is enough to correctly display
the MDN example.
This commit is contained in:
MacDue 2023-12-17 18:35:21 +00:00 committed by Andreas Kling
parent d327104910
commit 809c5b0b03
11 changed files with 171 additions and 0 deletions

View file

@ -105,6 +105,7 @@
#include <LibWeb/SVG/SVGSymbolElement.h>
#include <LibWeb/SVG/SVGTSpanElement.h>
#include <LibWeb/SVG/SVGTextElement.h>
#include <LibWeb/SVG/SVGTextPathElement.h>
#include <LibWeb/SVG/SVGTitleElement.h>
#include <LibWeb/SVG/SVGUseElement.h>
#include <LibWeb/SVG/TagNames.h>
@ -468,6 +469,8 @@ static JS::GCPtr<SVG::SVGElement> create_svg_element(JS::Realm& realm, Document&
return realm.heap().allocate<SVG::SVGSymbolElement>(realm, document, move(qualified_name));
if (local_name == SVG::TagNames::text)
return realm.heap().allocate<SVG::SVGTextElement>(realm, document, move(qualified_name));
if (local_name == SVG::TagNames::textPath)
return realm.heap().allocate<SVG::SVGTextPathElement>(realm, document, move(qualified_name));
if (local_name == SVG::TagNames::title)
return realm.heap().allocate<SVG::SVGTitleElement>(realm, document, move(qualified_name));
if (local_name == SVG::TagNames::tspan)