mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:28:11 +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:
parent
d327104910
commit
809c5b0b03
11 changed files with 171 additions and 0 deletions
30
Userland/Libraries/LibWeb/SVG/SVGTextPathElement.h
Normal file
30
Userland/Libraries/LibWeb/SVG/SVGTextPathElement.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (c) 2023, MacDue <macdue@dueutil.tech>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/SVG/SVGGeometryElement.h>
|
||||
#include <LibWeb/SVG/SVGTextContentElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
// https://svgwg.org/svg2-draft/text.html#TextPathElement
|
||||
class SVGTextPathElement : public SVGTextContentElement {
|
||||
WEB_PLATFORM_OBJECT(SVGTextPathElement, SVGTextContentElement);
|
||||
JS_DECLARE_ALLOCATOR(SVGTextPathElement);
|
||||
|
||||
public:
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
JS::GCPtr<SVGGeometryElement const> path_or_shape() const;
|
||||
|
||||
protected:
|
||||
SVGTextPathElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue