Refactor cloning of YogaNode
Summary: see Test Plan Reviewed By: priteshrnandgaonkar Differential Revision: D7339832 fbshipit-source-id: 2de6f47ae7601ac083d3b9fbe10ffaf6307ae760
This commit is contained in:
committed by
Facebook Github Bot
parent
187fc54596
commit
17901ea5c2
@@ -558,15 +558,18 @@ void YGNode::cloneChildrenIfNeeded() {
|
||||
return;
|
||||
}
|
||||
|
||||
const YGNodeClonedFunc cloneNodeCallback = config_->cloneNodeCallback;
|
||||
const YGCloneNodeFunc cloneNodeCallback = config_->cloneNodeCallback;
|
||||
for (uint32_t i = 0; i < childCount; ++i) {
|
||||
const YGNodeRef oldChild = children_[i];
|
||||
const YGNodeRef newChild = YGNodeClone(oldChild);
|
||||
YGNodeRef newChild = nullptr;
|
||||
if (cloneNodeCallback) {
|
||||
newChild = cloneNodeCallback(oldChild, this, i);
|
||||
}
|
||||
if (newChild == nullptr) {
|
||||
newChild = YGNodeClone(oldChild);
|
||||
}
|
||||
replaceChild(newChild, i);
|
||||
newChild->setParent(this);
|
||||
if (cloneNodeCallback) {
|
||||
cloneNodeCallback(oldChild, newChild, this, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user