Fix getters and setters if min and max Dimension

Summary: Fix getters and setters of min and max Dimension to behave exactly the same way as it was before fast math changes

Reviewed By: emilsjolander

Differential Revision: D7274807

fbshipit-source-id: 7c1a4c19e8d0552b089a410c3330392cb26a6a47
This commit is contained in:
Pritesh Nandgaonkar
2018-03-15 07:13:03 -07:00
committed by Facebook Github Bot
parent 369c9ad12a
commit 0dde40ce0b

View File

@@ -538,7 +538,7 @@ float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
type, name, paramName, instanceName) \ type, name, paramName, instanceName) \
void YGNodeStyleSet##name(const YGNodeRef node, const type paramName) { \ void YGNodeStyleSet##name(const YGNodeRef node, const type paramName) { \
YGValue value = { \ YGValue value = { \
.value = paramName, \ .value = YGFloatSanitize(paramName), \
.unit = YGFloatIsUndefined(paramName) ? YGUnitUndefined : YGUnitPoint, \ .unit = YGFloatIsUndefined(paramName) ? YGUnitUndefined : YGUnitPoint, \
}; \ }; \
if ((node->getStyle().instanceName.value != value.value && \ if ((node->getStyle().instanceName.value != value.value && \
@@ -554,7 +554,7 @@ float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
void YGNodeStyleSet##name##Percent( \ void YGNodeStyleSet##name##Percent( \
const YGNodeRef node, const type paramName) { \ const YGNodeRef node, const type paramName) { \
YGValue value = { \ YGValue value = { \
.value = paramName, \ .value = YGFloatSanitize(paramName), \
.unit = \ .unit = \
YGFloatIsUndefined(paramName) ? YGUnitUndefined : YGUnitPercent, \ YGFloatIsUndefined(paramName) ? YGUnitUndefined : YGUnitPercent, \
}; \ }; \
@@ -621,7 +621,11 @@ float YGNodeStyleGetFlexShrink(const YGNodeRef node) {
float, name, paramName, instanceName) \ float, name, paramName, instanceName) \
\ \
type YGNodeStyleGet##name(const YGNodeRef node) { \ type YGNodeStyleGet##name(const YGNodeRef node) { \
return node->getStyle().instanceName; \ YGValue value = node->getStyle().instanceName; \
if (value.unit == YGUndefined || value.unit == YGUnitAuto) { \
value.value = YGUndefined; \
} \
return value; \
} }
#define YG_NODE_STYLE_PROPERTY_UNIT_AUTO_IMPL( \ #define YG_NODE_STYLE_PROPERTY_UNIT_AUTO_IMPL( \