Move node cloning to YGConfig
Summary: @public Encapsulates node cloning within `YGConfig`. This is necessary for allowing for context-aware cloning functions, which will ultimately allow for removal of weak global JNI references. Reviewed By: shergin Differential Revision: D14132608 fbshipit-source-id: 0dec114c8e172b1e34a4b7fd146c43f13c151ade
This commit is contained in:
committed by
Facebook Github Bot
parent
2643b96589
commit
367a93de88
@@ -404,16 +404,9 @@ void YGNode::cloneChildrenIfNeeded() {
|
||||
return;
|
||||
}
|
||||
|
||||
const YGCloneNodeFunc cloneNodeCallback = config_->cloneNodeCallback;
|
||||
for (uint32_t i = 0; i < childCount; ++i) {
|
||||
const YGNodeRef oldChild = children_[i];
|
||||
YGNodeRef newChild = nullptr;
|
||||
if (cloneNodeCallback) {
|
||||
newChild = cloneNodeCallback(oldChild, this, i);
|
||||
}
|
||||
if (newChild == nullptr) {
|
||||
newChild = YGNodeClone(oldChild);
|
||||
}
|
||||
YGNodeRef newChild = config_->cloneNode(oldChild, this, i);
|
||||
replaceChild(newChild, i);
|
||||
newChild->setOwner(this);
|
||||
}
|
||||
|
Reference in New Issue
Block a user