correctly detect duplicate layers
This commit is contained in:
@@ -102,9 +102,6 @@ private:
|
||||
// This maps ids to Layer objects, with all items being at the root level.
|
||||
std::unordered_map<std::string, std::pair<JSVal, std::shared_ptr<StyleLayer>>> layers;
|
||||
|
||||
// Layer IDs that we have encountered previously while parsing this stylesheet.
|
||||
std::set<std::string> existing_layer_ids;
|
||||
|
||||
// Store a stack of layers we're parsing right now. This is to prevent reference cycles.
|
||||
std::forward_list<StyleLayer *> stack;
|
||||
|
||||
|
||||
@@ -501,7 +501,7 @@ std::shared_ptr<StyleLayer> StyleParser::createLayer(JSVal value) {
|
||||
|
||||
const std::string layer_id = { id.GetString(), id.GetStringLength() };
|
||||
|
||||
if (existing_layer_ids.find(layer_id) != existing_layer_ids.end()) {
|
||||
if (layers.find(layer_id) != layers.end()) {
|
||||
fprintf(stderr, "[WARNING] duplicate layer id %s\n", layer_id.c_str());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user