diff --git a/ReactCommon/yoga/yoga/YGNode.cpp b/ReactCommon/yoga/yoga/YGNode.cpp index 913ec329e..9f6c6a2a8 100644 --- a/ReactCommon/yoga/yoga/YGNode.cpp +++ b/ReactCommon/yoga/yoga/YGNode.cpp @@ -671,22 +671,21 @@ YGFloatOptional YGNode::getLeadingPadding( return YGFloatOptionalMax(resolvedValue, YGFloatOptional(0.0f)); } -float YGNode::getTrailingPadding( - const YGFlexDirection axis, - const float widthSize) const { +YGFloatOptional YGNode::getTrailingPadding( + const YGFlexDirection& axis, + const float& widthSize) const { if (YGFlexDirectionIsRow(axis) && style_.padding[YGEdgeEnd].unit != YGUnitUndefined && !YGResolveValue(style_.padding[YGEdgeEnd], widthSize).isUndefined() && - YGUnwrapFloatOptional( - YGResolveValue(style_.padding[YGEdgeEnd], widthSize)) >= 0.0f) { - return YGUnwrapFloatOptional(YGResolveValue(style_.padding[YGEdgeEnd], widthSize)); + YGResolveValue(style_.padding[YGEdgeEnd], widthSize).getValue() >= 0.0f) { + return YGResolveValue(style_.padding[YGEdgeEnd], widthSize); } - float resolvedValue = YGUnwrapFloatOptional(YGResolveValue( + YGFloatOptional resolvedValue = YGResolveValue( *YGComputedEdgeValue(style_.padding, trailing[axis], &YGValueZero), - widthSize)); + widthSize); - return YGFloatMax(resolvedValue, 0.0f); + return YGFloatOptionalMax(resolvedValue, YGFloatOptional(0.0f)); } float YGNode::getLeadingPaddingAndBorder( @@ -699,7 +698,8 @@ float YGNode::getLeadingPaddingAndBorder( float YGNode::getTrailingPaddingAndBorder( const YGFlexDirection axis, const float widthSize) const { - return getTrailingPadding(axis, widthSize) + getTrailingBorder(axis); + return YGUnwrapFloatOptional(getTrailingPadding(axis, widthSize)) + + getTrailingBorder(axis); } bool YGNode::didUseLegacyFlag() { diff --git a/ReactCommon/yoga/yoga/YGNode.h b/ReactCommon/yoga/yoga/YGNode.h index cdb6fae47..010b0dc7a 100644 --- a/ReactCommon/yoga/yoga/YGNode.h +++ b/ReactCommon/yoga/yoga/YGNode.h @@ -96,7 +96,9 @@ struct YGNode { YGFloatOptional getLeadingPadding( const YGFlexDirection& axis, const float& widthSize) const; - float getTrailingPadding(const YGFlexDirection axis, const float widthSize) const; + YGFloatOptional getTrailingPadding( + const YGFlexDirection& axis, + const float& widthSize) const; float getLeadingPaddingAndBorder( const YGFlexDirection axis, const float widthSize) const; diff --git a/ReactCommon/yoga/yoga/Yoga.cpp b/ReactCommon/yoga/yoga/Yoga.cpp index 12f8facb1..8740c6667 100644 --- a/ReactCommon/yoga/yoga/Yoga.cpp +++ b/ReactCommon/yoga/yoga/Yoga.cpp @@ -2577,13 +2577,17 @@ static void YGNodelayoutImpl(const YGNodeRef node, node->getLeadingPadding(flexRowDirection, ownerWidth)), YGEdgeStart); node->setLayoutPadding( - node->getTrailingPadding(flexRowDirection, ownerWidth), YGEdgeEnd); + YGUnwrapFloatOptional( + node->getTrailingPadding(flexRowDirection, ownerWidth)), + YGEdgeEnd); node->setLayoutPadding( YGUnwrapFloatOptional( node->getLeadingPadding(flexColumnDirection, ownerWidth)), YGEdgeTop); node->setLayoutPadding( - node->getTrailingPadding(flexColumnDirection, ownerWidth), YGEdgeBottom); + YGUnwrapFloatOptional( + node->getTrailingPadding(flexColumnDirection, ownerWidth)), + YGEdgeBottom); if (node->getMeasure() != nullptr) { YGNodeWithMeasureFuncSetMeasuredDimensions(node,