add bool css_style_ member variable to control CSS style processing.

This commit is contained in:
Artem Pavlenko 2020-02-04 17:30:58 +00:00
parent cc9e8e3db3
commit 2ddbff46d5
2 changed files with 4 additions and 1 deletions

View file

@ -84,6 +84,7 @@ public:
bool is_defs_;
bool strict_;
bool ignore_;
bool css_style_;
std::map<std::string, gradient> gradient_map_;
std::map<std::string, boost::property_tree::detail::rapidxml::xml_node<char> const*> node_cache_;
mapnik::css_data css_data_;

View file

@ -467,8 +467,9 @@ void traverse_tree(svg_parser & parser, rapidxml::xml_node<char> const* node)
char const* last = first + child->value_size();
std::vector<std::string> 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() {}