Move reset logic to YGNode::reset()
Summary: @public Moving logic from free C functions to the C++ layer. This will allow us to get rid of the dangerous copy / move assignment operators of `YGNode`. Reviewed By: SidharthGuglani Differential Revision: D14241564 fbshipit-source-id: aae9f2a7ffd23bb839f1747e4a0694578bae86ae
This commit is contained in:
committed by
Facebook Github Bot
parent
e25fe994b3
commit
15668aceb6
@@ -323,25 +323,8 @@ void YGNodeFreeRecursive(const YGNodeRef root) {
|
||||
return YGNodeFreeRecursiveWithCleanupFunc(root, nullptr);
|
||||
}
|
||||
|
||||
void YGNodeReset(const YGNodeRef node) {
|
||||
YGAssertWithNode(
|
||||
node,
|
||||
YGNodeGetChildCount(node) == 0,
|
||||
"Cannot reset a node which still has children attached");
|
||||
YGAssertWithNode(
|
||||
node,
|
||||
node->getOwner() == nullptr,
|
||||
"Cannot reset a node still attached to a owner");
|
||||
|
||||
node->clearChildren();
|
||||
|
||||
const YGConfigRef config = node->getConfig();
|
||||
*node = YGNode();
|
||||
if (config->useWebDefaults) {
|
||||
node->setStyleFlexDirection(YGFlexDirectionRow);
|
||||
node->setStyleAlignContent(YGAlignStretch);
|
||||
}
|
||||
node->setConfig(config);
|
||||
void YGNodeReset(YGNodeRef node) {
|
||||
node->reset();
|
||||
}
|
||||
|
||||
int32_t YGNodeGetInstanceCount(void) {
|
||||
|
Reference in New Issue
Block a user