Remove the use of YGUnwrapOptional from YGConstrainedMaxSizeForMode

Summary: Remove the use of YGUnwrapOptional from YGConstrainedMaxSizeForMode

Reviewed By: emilsjolander

Differential Revision: D7322743

fbshipit-source-id: d825c60bcdc9ecdc0c784a215dc6b1b8a7a7860e
This commit is contained in:
Pritesh Nandgaonkar
2018-04-04 07:55:25 -07:00
committed by Facebook Github Bot
parent 08743a42e2
commit bb139d3f91
4 changed files with 28 additions and 9 deletions

View File

@@ -1178,19 +1178,21 @@ static void YGConstrainMaxSizeForMode(const YGNodeRef node,
const float ownerWidth,
YGMeasureMode *mode,
float *size) {
const float maxSize =
YGUnwrapFloatOptional(YGResolveValue(
node->getStyle().maxDimensions[dim[axis]], ownerAxisSize)) +
node->getMarginForAxis(axis, ownerWidth);
const YGFloatOptional maxSize =
YGResolveValue(
node->getStyle().maxDimensions[dim[axis]], ownerAxisSize) +
YGFloatOptional(node->getMarginForAxis(axis, ownerWidth));
switch (*mode) {
case YGMeasureModeExactly:
case YGMeasureModeAtMost:
*size = (YGFloatIsUndefined(maxSize) || *size < maxSize) ? *size : maxSize;
*size = (maxSize.isUndefined() || *size < maxSize.getValue())
? *size
: maxSize.getValue();
break;
case YGMeasureModeUndefined:
if (!YGFloatIsUndefined(maxSize)) {
if (!maxSize.isUndefined()) {
*mode = YGMeasureModeAtMost;
*size = maxSize;
*size = maxSize.getValue();
}
break;
}