Add flag in YGConfig for running experiments
Summary: Add flag in YGConfig for running experiments Reviewed By: emilsjolander Differential Revision: D6948702 fbshipit-source-id: 009fe2d64b6098f8c3a0289f0e6939dea5ce0d37
This commit is contained in:
committed by
Facebook Github Bot
parent
402ee11273
commit
b08bd572ef
@@ -215,6 +215,7 @@ struct YGConfig {
|
|||||||
bool experimentalFeatures[YGExperimentalFeatureCount + 1];
|
bool experimentalFeatures[YGExperimentalFeatureCount + 1];
|
||||||
bool useWebDefaults;
|
bool useWebDefaults;
|
||||||
bool useLegacyStretchBehaviour;
|
bool useLegacyStretchBehaviour;
|
||||||
|
bool shouldDiffLayoutWithoutLegacyStretchBehaviour;
|
||||||
float pointScaleFactor;
|
float pointScaleFactor;
|
||||||
YGLogger logger;
|
YGLogger logger;
|
||||||
YGNodeClonedFunc cloneNodeCallback;
|
YGNodeClonedFunc cloneNodeCallback;
|
||||||
|
@@ -47,6 +47,7 @@ static YGConfig gYGConfigDefaults = {
|
|||||||
},
|
},
|
||||||
.useWebDefaults = false,
|
.useWebDefaults = false,
|
||||||
.useLegacyStretchBehaviour = false,
|
.useLegacyStretchBehaviour = false,
|
||||||
|
.shouldDiffLayoutWithoutLegacyStretchBehaviour = false,
|
||||||
.pointScaleFactor = 1.0f,
|
.pointScaleFactor = 1.0f,
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
.logger = &YGAndroidLog,
|
.logger = &YGAndroidLog,
|
||||||
@@ -3613,14 +3614,15 @@ void YGNodeCalculateLayout(const YGNodeRef node,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool didUseLegacyFlag = node->didUseLegacyFlag();
|
|
||||||
|
|
||||||
// We want to get rid off `useLegacyStretchBehaviour` from YGConfig. But we
|
// We want to get rid off `useLegacyStretchBehaviour` from YGConfig. But we
|
||||||
// aren't sure whether client's of yoga have gotten rid off this flag or not.
|
// aren't sure whether client's of yoga have gotten rid off this flag or not.
|
||||||
// So logging this in YGLayout would help to find out the call sites depending
|
// So logging this in YGLayout would help to find out the call sites depending
|
||||||
// on this flag. This check would be removed once we are sure no one is
|
// on this flag. This check would be removed once we are sure no one is
|
||||||
// dependent on this flag anymore.
|
// dependent on this flag anymore. The flag
|
||||||
if (didUseLegacyFlag) {
|
// `shouldDiffLayoutWithoutLegacyStretchBehaviour` in YGConfig will help to
|
||||||
|
// run experiments.
|
||||||
|
if (node->getConfig()->shouldDiffLayoutWithoutLegacyStretchBehaviour &&
|
||||||
|
node->didUseLegacyFlag()) {
|
||||||
const YGNodeRef originalNode = YGNodeDeepClone(node);
|
const YGNodeRef originalNode = YGNodeDeepClone(node);
|
||||||
originalNode->resolveDimension();
|
originalNode->resolveDimension();
|
||||||
// Recursively mark nodes as dirty
|
// Recursively mark nodes as dirty
|
||||||
|
Reference in New Issue
Block a user