| 298 | } |
| 299 | |
| 300 | void CSSNode::applyCss(ViewTransactionScope& viewTransactionScope, |
| 301 | const CSSDocument& cssDocument, |
| 302 | AttributesApplier& attributesApplier, |
| 303 | const SharedAnimator& animator) { |
| 304 | auto bestStyleDeclarationByKey = CSSNode::newStyleDeclarationMap(); |
| 305 | |
| 306 | insertDeclarations(cssDocument, cssDocument.getRootNode(), attributesApplier, *bestStyleDeclarationByKey); |
| 307 | |
| 308 | if (_lastStyleDeclarations != nullptr) { |
| 309 | for (const auto& it : *_lastStyleDeclarations) { |
| 310 | if (bestStyleDeclarationByKey->find(it.first) == bestStyleDeclarationByKey->end()) { |
| 311 | // If our applied CSS attribute is not among the new CSS attributes |
| 312 | // we remove it. |
| 313 | attributesApplier.removeAttribute(viewTransactionScope, it.first, this, animator); |
| 314 | } |
| 315 | } |
| 316 | CSSNode::releaseStyleDeclarationMap(std::move(_lastStyleDeclarations)); |
| 317 | } |
| 318 | |
| 319 | for (const auto& tuple : *bestStyleDeclarationByKey) { |
| 320 | const auto& property = tuple.first; |
| 321 | |
| 322 | setAttributeFromDeclaration(viewTransactionScope, property, attributesApplier, tuple.second, animator); |
| 323 | } |
| 324 | _lastStyleDeclarations = std::move(bestStyleDeclarationByKey); |
| 325 | } |
| 326 | |
| 327 | CSSNode* CSSNode::resolveParent(const CSSDocument& cssDocument) const { |
| 328 | if (_parentResolver == nullptr) { |
no test coverage detected