MCPcopy Create free account
hub / github.com/Snapchat/Valdi / insertDeclarationIfNeeded

Function insertDeclarationIfNeeded

valdi/src/valdi/runtime/CSS/CSSNode.cpp:154–164  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152}
153
154void insertDeclarationIfNeeded(const CSSStyleDeclaration& declaration,
155 FlatMap<AttributeId, const CSSStyleDeclaration*>& bestStyleDeclarationByKey) {
156 auto attributeId = declaration.attribute.id;
157
158 auto it = bestStyleDeclarationByKey.try_emplace(attributeId, &declaration);
159 if (!it.second) {
160 if (shouldReplaceDeclaration(*it.first->second, declaration)) {
161 it.first->second = &declaration;
162 }
163 }
164}
165
166void CSSNode::insertDeclarations(const CSSDocument& cssDocument,
167 const CSSStyleNode& styleNode,

Callers 1

insertDeclarationsMethod · 0.85

Calls 1

shouldReplaceDeclarationFunction · 0.85

Tested by

no test coverage detected