From 2ddbff46d59019e83fd863af1a68da7929b883d9 Mon Sep 17 00:00:00 2001 From: Artem Pavlenko Date: Tue, 4 Feb 2020 17:30:58 +0000 Subject: [PATCH] add bool css_style_ member variable to control CSS style processing. --- include/mapnik/svg/svg_parser.hpp | 1 + src/svg/svg_parser.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/mapnik/svg/svg_parser.hpp b/include/mapnik/svg/svg_parser.hpp index a1062a84a..6017b5bcc 100644 --- a/include/mapnik/svg/svg_parser.hpp +++ b/include/mapnik/svg/svg_parser.hpp @@ -84,6 +84,7 @@ public: bool is_defs_; bool strict_; bool ignore_; + bool css_style_; 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 25bb1ad34..f918ad81a 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -467,8 +467,9 @@ void traverse_tree(svg_parser & parser, rapidxml::xml_node const* node) char const* last = first + child->value_size(); std::vector classes; bool result = boost::spirit::x3::phrase_parse(first, last, grammar, skipper, parser.css_data_); - if (result && !parser.css_data_.empty()) + if (result && first == last && !parser.css_data_.empty()) { + parser.css_style_ = true; print_css(parser.css_data_); } } @@ -1445,6 +1446,7 @@ svg_parser::svg_parser(svg_converter_type & path, bool strict) : path_(path), is_defs_(false), ignore_(false), + css_style_(false), err_handler_(strict) {} svg_parser::~svg_parser() {}