fix(parser): Ignore sequential duplicates in color stacks

This commit is contained in:
Michael Carlberg 2017-05-17 23:11:59 +02:00
parent 0bd8f1f69a
commit 2e8cc7f503

View File

@ -192,7 +192,7 @@ unsigned int parser::parse_color(std::stack<unsigned int>& color_stack, string&
color_stack.pop();
}
auto parsed_value = parse_color_string(value, !color_stack.empty() ? color_stack.top() : fallback);
if (!value.empty() && value[0] != '-') {
if (!value.empty() && value[0] != '-' && (color_stack.empty() || (parsed_value != color_stack.top()))) {
color_stack.push(parsed_value);
}
return parsed_value;