From 53288c5dd248823cb768992896f7f09a64814a2e Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Mon, 19 Dec 2022 12:29:04 +0000 Subject: [PATCH] SVG parser - only set SVG dimensions top level element --- include/mapnik/svg/svg_parser.hpp | 1 + src/svg/svg_parser.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/mapnik/svg/svg_parser.hpp b/include/mapnik/svg/svg_parser.hpp index db0e2fe9c..b3e118984 100644 --- a/include/mapnik/svg/svg_parser.hpp +++ b/include/mapnik/svg/svg_parser.hpp @@ -106,6 +106,7 @@ class MAPNIK_DECL svg_parser : private util::noncopyable bool strict_; bool ignore_; bool css_style_; + bool dimensions_ = false; std::map gradient_map_; std::map const*> node_cache_; mapnik::css_data css_data_; diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index 829dd326c..fb7efa285 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -1000,7 +1000,11 @@ void parse_dimensions(svg_parser& parser, rapidxml::xml_node const* node) parser.path_.set_dimensions(0, 0); return; } - parser.path_.set_dimensions(width, height); + if (!parser.dimensions_) + { + parser.dimensions_ = true; + parser.path_.set_dimensions(width, height); + } } void parse_path(svg_parser& parser, rapidxml::xml_node const* node)