Fix up some small issues with YGUnitAuto

Reviewed By: wwjholmes

Differential Revision: D4567045

fbshipit-source-id: ace5fd89bd534a6bb5ec7dba0c3afbf13d62d7c9
This commit is contained in:
Emil Sjolander 2017-02-16 06:47:28 -08:00 committed by Facebook Github Bot
parent 53b387638e
commit 1b5eb36e2f
3 changed files with 7 additions and 8 deletions

View File

@ -58,6 +58,7 @@ static void RCTPrint(YGNodeRef node)
#define RCT_SET_YGVALUE(ygvalue, setter, ...) \ #define RCT_SET_YGVALUE(ygvalue, setter, ...) \
switch (ygvalue.unit) { \ switch (ygvalue.unit) { \
case YGUnitAuto: \
case YGUnitUndefined: \ case YGUnitUndefined: \
setter(__VA_ARGS__, YGUndefined); \ setter(__VA_ARGS__, YGUndefined); \
break; \ break; \
@ -67,8 +68,6 @@ switch (ygvalue.unit) { \
case YGUnitPercent: \ case YGUnitPercent: \
setter##Percent(__VA_ARGS__, ygvalue.value); \ setter##Percent(__VA_ARGS__, ygvalue.value); \
break; \ break; \
case YGUnitAuto: \
break; \
} }
#define DEFINE_PROCESS_META_PROPS(type) \ #define DEFINE_PROCESS_META_PROPS(type) \

View File

@ -434,7 +434,7 @@ inline float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
} }
static inline const YGValue *YGNodeStyleGetFlexBasisPtr(const YGNodeRef node) { static inline const YGValue *YGNodeStyleGetFlexBasisPtr(const YGNodeRef node) {
if (node->style.flexBasis.unit != YGUnitAuto) { if (node->style.flexBasis.unit != YGUnitAuto && node->style.flexBasis.unit != YGUnitUndefined) {
return &node->style.flexBasis; return &node->style.flexBasis;
} }
if (!YGFloatIsUndefined(node->style.flex) && node->style.flex > 0.0f) { if (!YGFloatIsUndefined(node->style.flex) && node->style.flex > 0.0f) {
@ -477,7 +477,7 @@ void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
node->style.instanceName.unit != YGUnitPoint) { \ node->style.instanceName.unit != YGUnitPoint) { \
node->style.instanceName.value = paramName; \ node->style.instanceName.value = paramName; \
node->style.instanceName.unit = \ node->style.instanceName.unit = \
YGFloatIsUndefined(paramName) ? YGUnitUndefined : YGUnitPoint; \ YGFloatIsUndefined(paramName) ? YGUnitAuto : YGUnitPoint; \
YGNodeMarkDirtyInternal(node); \ YGNodeMarkDirtyInternal(node); \
} \ } \
} \ } \
@ -487,7 +487,7 @@ void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
node->style.instanceName.unit != YGUnitPercent) { \ node->style.instanceName.unit != YGUnitPercent) { \
node->style.instanceName.value = paramName; \ node->style.instanceName.value = paramName; \
node->style.instanceName.unit = \ node->style.instanceName.unit = \
YGFloatIsUndefined(paramName) ? YGUnitUndefined : YGUnitPercent; \ YGFloatIsUndefined(paramName) ? YGUnitAuto : YGUnitPercent; \
YGNodeMarkDirtyInternal(node); \ YGNodeMarkDirtyInternal(node); \
} \ } \
} }
@ -496,7 +496,7 @@ void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
void YGNodeStyleSet##name(const YGNodeRef node, const type paramName) { \ void YGNodeStyleSet##name(const YGNodeRef node, const type paramName) { \
if (node->style.instanceName.value != paramName || \ if (node->style.instanceName.value != paramName || \
node->style.instanceName.unit != YGUnitPoint) { \ node->style.instanceName.unit != YGUnitPoint) { \
node->style.instanceName.value = YGFloatIsUndefined(paramName) ? YGUndefined : paramName; \ node->style.instanceName.value = paramName; \
node->style.instanceName.unit = YGFloatIsUndefined(paramName) ? YGUnitAuto : YGUnitPoint; \ node->style.instanceName.unit = YGFloatIsUndefined(paramName) ? YGUnitAuto : YGUnitPoint; \
YGNodeMarkDirtyInternal(node); \ YGNodeMarkDirtyInternal(node); \
} \ } \
@ -505,7 +505,7 @@ void YGNodeStyleSetFlex(const YGNodeRef node, const float flex) {
void YGNodeStyleSet##name##Percent(const YGNodeRef node, const type paramName) { \ void YGNodeStyleSet##name##Percent(const YGNodeRef node, const type paramName) { \
if (node->style.instanceName.value != paramName || \ if (node->style.instanceName.value != paramName || \
node->style.instanceName.unit != YGUnitPercent) { \ node->style.instanceName.unit != YGUnitPercent) { \
node->style.instanceName.value = YGFloatIsUndefined(paramName) ? YGUndefined : paramName; \ node->style.instanceName.value = paramName; \
node->style.instanceName.unit = YGFloatIsUndefined(paramName) ? YGUnitAuto : YGUnitPercent; \ node->style.instanceName.unit = YGFloatIsUndefined(paramName) ? YGUnitAuto : YGUnitPercent; \
YGNodeMarkDirtyInternal(node); \ YGNodeMarkDirtyInternal(node); \
} \ } \

View File

@ -44,7 +44,7 @@ typedef struct YGValue {
} YGValue; } YGValue;
static const YGValue YGValueUndefined = {YGUndefined, YGUnitUndefined}; static const YGValue YGValueUndefined = {YGUndefined, YGUnitUndefined};
static const YGValue YGValueAuto = {0, YGUnitAuto}; static const YGValue YGValueAuto = {YGUndefined, YGUnitAuto};
typedef struct YGNode *YGNodeRef; typedef struct YGNode *YGNodeRef;
typedef YGSize (*YGMeasureFunc)(YGNodeRef node, typedef YGSize (*YGMeasureFunc)(YGNodeRef node,