| 1616 | // values, so it would not notice the style no longer matches and would never re-apply. |
| 1617 | // |
| 1618 | // reapplyAttribute markDirty()s first, so it re-applies even though the cached value is |
| 1619 | // unchanged, and it no-ops when `position` was never set — leaving the Relative default in |
| 1620 | // place for the common case. |
| 1621 | _attributesApplier.reapplyAttribute(viewTransactionScope, getAttributeIds().getIdForName("position")); |
| 1622 | } |
| 1623 | } |
| 1624 | |
| 1625 | void ViewNode::appendChild(ViewTransactionScope& viewTransactionScope, const Ref<ViewNode>& child) { |
| 1626 | insertChildAt(viewTransactionScope, child, getLiveChildCount()); |
| 1627 | } |
| 1628 | |
| 1629 | void ViewNode::insertChildAt(ViewTransactionScope& viewTransactionScope, const Ref<ViewNode>& child, size_t index) { |
| 1630 | SC_ASSERT(child.get() != this); |
| 1631 | |
| 1632 | [[maybe_unused]] auto childHadParent = child->hasParent(); |
| 1633 | child->removeFromParent(viewTransactionScope); |
| 1634 | child->_parent = weakRef(this); |
| 1635 | child->setHasParent(true); |
| 1636 | child->_flags[kParentManagesChildFrames] = managesChildFrames(); |
| 1637 | |
| 1638 | auto* yogaContainer = getYogaNodeForInsertingChildren(); |
| 1639 | if (static_cast<size_t>(YGNodeGetChildCount(yogaContainer)) < index) { |
| 1640 | VALDI_ERROR(getLogger(), |
| 1641 | "Cannot insert child at index {} into container with size {} (child had parent: {})", |
| 1642 | index, |