YGNode
: Field for web defaults
Summary: In order to remove the config pointer from nodes, we have to keep track of whether the node is using web defaults. This information fits into one bit that we can place in padding (i.e. no extra memory needed). This allows us to get rid of config usage withing `YGNode` with some exceptions: - `iterChildrenAfterCloningIfNeeded` -- this function will simply receive the configuration, or the cloning callback. - `setAndPropogateUseLegacyFlag` -- will be removed in D15316863 - in `YGNode::reset` -- will go away utomatically once we remove the config pointer Reviewed By: SidharthGuglani Differential Revision: D15391536 fbshipit-source-id: 0fa0d0805c6862bd741fe4a7d9b637ed534f56a4
This commit is contained in:
committed by
Facebook Github Bot
parent
aa71dbb5bd
commit
1938792517
@@ -210,18 +210,13 @@ void YGNodeMarkDirtyAndPropogateToDescendants(const YGNodeRef node) {
|
||||
int32_t gConfigInstanceCount = 0;
|
||||
|
||||
WIN_EXPORT YGNodeRef YGNodeNewWithConfig(const YGConfigRef config) {
|
||||
const YGNodeRef node = new YGNode();
|
||||
const YGNodeRef node = new YGNode{config};
|
||||
YGAssertWithConfig(
|
||||
config, node != nullptr, "Could not allocate memory for node");
|
||||
#ifdef YG_ENABLE_EVENTS
|
||||
Event::publish<Event::NodeAllocation>(node, {config});
|
||||
#endif
|
||||
|
||||
if (config->useWebDefaults) {
|
||||
node->getStyle().flexDirection() = YGFlexDirectionRow;
|
||||
node->getStyle().alignContent() = YGAlignStretch;
|
||||
}
|
||||
node->setConfig(config);
|
||||
return node;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user