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
This commit is contained in:
Pritesh Nandgaonkar
2018-04-03 14:56:34 -07:00
committed by Facebook Github Bot
parent 5730be093e
commit 4b760fa9bc
2 changed files with 11 additions and 8 deletions

View File

@@ -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);
}

View File

@@ -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(