From 4b760fa9bc10bf175837d8506b380f257fc5d411 Mon Sep 17 00:00:00 2001 From: Pritesh Nandgaonkar Date: Tue, 3 Apr 2018 14:56:34 -0700 Subject: [PATCH] Changed the return type of YGResolveValueMargin to YGFloatOptional Summary: Changed the return type of YGResolveValueMargin to YGFloatOptional Reviewed By: emilsjolander Differential Revision: D7304090 fbshipit-source-id: cbec03a9367cf34976d083ad475d4da0b736e6d2 --- yoga/Utils.h | 5 +++-- yoga/YGNode.cpp | 14 ++++++++------ 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/yoga/Utils.h b/yoga/Utils.h index 328ccef7..1de614ce 100644 --- a/yoga/Utils.h +++ b/yoga/Utils.h @@ -136,8 +136,9 @@ inline YGFlexDirection YGResolveFlexDirection( return flexDirection; } -static inline float YGResolveValueMargin( +static inline YGFloatOptional YGResolveValueMargin( const YGValue value, const float ownerSize) { - return value.unit == YGUnitAuto ? 0 : YGUnwrapFloatOptional(YGResolveValue(value, ownerSize)); + return value.unit == YGUnitAuto ? YGFloatOptional(0) + : YGResolveValue(value, ownerSize); } diff --git a/yoga/YGNode.cpp b/yoga/YGNode.cpp index 01be3a7c..87a92b39 100644 --- a/yoga/YGNode.cpp +++ b/yoga/YGNode.cpp @@ -144,12 +144,13 @@ float YGNode::getLeadingMargin( const float widthSize) const { if (YGFlexDirectionIsRow(axis) && style_.margin[YGEdgeStart].unit != YGUnitUndefined) { - return YGResolveValueMargin(style_.margin[YGEdgeStart], widthSize); + return YGUnwrapFloatOptional( + YGResolveValueMargin(style_.margin[YGEdgeStart], widthSize)); } - return YGResolveValueMargin( + return YGUnwrapFloatOptional(YGResolveValueMargin( *YGComputedEdgeValue(style_.margin, leading[axis], &YGValueZero), - widthSize); + widthSize)); } float YGNode::getTrailingMargin( @@ -157,12 +158,13 @@ float YGNode::getTrailingMargin( const float widthSize) const { if (YGFlexDirectionIsRow(axis) && style_.margin[YGEdgeEnd].unit != YGUnitUndefined) { - return YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize); + return YGUnwrapFloatOptional( + YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize)); } - return YGResolveValueMargin( + return YGUnwrapFloatOptional(YGResolveValueMargin( *YGComputedEdgeValue(style_.margin, trailing[axis], &YGValueZero), - widthSize); + widthSize)); } float YGNode::getMarginForAxis(