Change the type of flex to YGFloatOptional

Summary: Change the type of flex to YGFloatOptional internally, but keeping the public facing API the same as before

Reviewed By: emilsjolander

Differential Revision: D7211327

fbshipit-source-id: 0d979b6ba00317317b98bbc6e63979c7f1feb2da
This commit is contained in:
Pritesh Nandgaonkar
2018-03-14 04:17:09 -07:00
committed by Facebook Github Bot
parent b3f8851bc2
commit 2232d7603a
8 changed files with 61 additions and 16 deletions

View File

@@ -7,6 +7,9 @@
#include "YGStyle.h"
#define YGFloatOptionalUndefined \
{ true, 0 }
const YGValue kYGValueUndefined = {0, YGUnitUndefined};
const YGValue kYGValueAuto = {YGUndefined, YGUnitAuto};
@@ -39,7 +42,7 @@ YGStyle::YGStyle()
flexWrap(YGWrapNoWrap),
overflow(YGOverflowVisible),
display(YGDisplayFlex),
flex(YGUndefined),
flex(YGFloatOptionalUndefined),
flexGrow(YGUndefined),
flexShrink(YGUndefined),
flexBasis(kYGValueAuto),
@@ -69,8 +72,11 @@ bool YGStyle::operator==(const YGStyle& style) {
YGValueArrayEqual(minDimensions, style.minDimensions) &&
YGValueArrayEqual(maxDimensions, style.maxDimensions);
if (!(YGFloatIsUndefined(flex) && YGFloatIsUndefined(style.flex))) {
areNonFloatValuesEqual = areNonFloatValuesEqual && flex == style.flex;
areNonFloatValuesEqual =
areNonFloatValuesEqual && flex.isUndefined == style.flex.isUndefined;
if (areNonFloatValuesEqual && !flex.isUndefined && !style.flex.isUndefined) {
areNonFloatValuesEqual =
areNonFloatValuesEqual && flex.value == style.flex.value;
}
if (!(YGFloatIsUndefined(flexGrow) && YGFloatIsUndefined(style.flexGrow))) {