From 24d9036e6e2c8c84bf4b544cb5aca0c88d7b274a Mon Sep 17 00:00:00 2001 From: Samuel Ugochukwu Date: Fri, 3 Jan 2025 19:55:24 +0100 Subject: [PATCH] Set `needsLayout` when `TextNode` is modified --- source/svgelement.cpp | 6 ++++++ source/svgelement.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/source/svgelement.cpp b/source/svgelement.cpp index d3d9f72..acb3e62 100644 --- a/source/svgelement.cpp +++ b/source/svgelement.cpp @@ -53,6 +53,12 @@ SVGTextNode::SVGTextNode(Document* document) { } +void SVGTextNode::setData(const std::string& data) +{ + rootElement()->setNeedsLayout(); + m_data.assign(data); +} + std::unique_ptr SVGTextNode::clone(bool deep) const { auto node = std::make_unique(document()); diff --git a/source/svgelement.h b/source/svgelement.h index f9421a8..ce04837 100644 --- a/source/svgelement.h +++ b/source/svgelement.h @@ -50,8 +50,8 @@ class SVGTextNode final : public SVGNode { bool isTextNode() const final { return true; } - void setData(const std::string& data) { m_data = data; } const std::string& data() const { return m_data; } + void setData(const std::string& data); std::unique_ptr clone(bool deep) const final;