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

@@ -39,6 +39,15 @@ static void appendFormatedString(string* str, const char* fmt, ...) {
str->append(result);
}
static void appendFloatOptionalIfDefined(
string* base,
const string key,
const YGFloatOptional num) {
if (!num.isUndefined) {
appendFormatedString(base, "%s: %g; ", key.c_str(), num.value);
}
}
static void
appendFloatIfNotUndefined(string* base, const string key, const float num) {
if (!YGFloatIsUndefined(num)) {
@@ -155,7 +164,7 @@ void YGNodeToString(
appendFloatIfNotUndefined(str, "flex-grow", node->getStyle().flexGrow);
appendFloatIfNotUndefined(str, "flex-shrink", node->getStyle().flexShrink);
appendNumberIfNotAuto(str, "flex-basis", node->getStyle().flexBasis);
appendFloatIfNotUndefined(str, "flex", node->getStyle().flex);
appendFloatOptionalIfDefined(str, "flex", node->getStyle().flex);
if (node->getStyle().flexWrap != YGNode().getStyle().flexWrap) {
appendFormatedString(