mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
LibWeb: Implement painting for svg text
The implementation of painting for SVG text follows the same pattern as the implementation of painting for SVG geometries. However, instead of reusing the existing PaintableWithLines to draw text, a new class called SVGTextPaintable is introduced. because everything that is painted inside an SVG is expected to inherit from SVGGraphicsPaintable. Therefore reusing the text painting from regular text nodes would require significant refactoring.
This commit is contained in:
parent
81a6976e90
commit
0d8d7ae94e
9 changed files with 216 additions and 0 deletions
|
@ -16,12 +16,24 @@ class SVGTextContentElement : public SVGGraphicsElement {
|
|||
WEB_PLATFORM_OBJECT(SVGTextContentElement, SVGGraphicsElement);
|
||||
|
||||
public:
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override;
|
||||
|
||||
WebIDL::ExceptionOr<int> get_number_of_chars() const;
|
||||
|
||||
Gfx::FloatPoint get_offset() const;
|
||||
|
||||
protected:
|
||||
SVGTextContentElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual JS::ThrowCompletionOr<void> initialize(JS::Realm&) override;
|
||||
|
||||
private:
|
||||
float m_x { 0 };
|
||||
float m_y { 0 };
|
||||
float m_dx { 0 };
|
||||
float m_dy { 0 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue