Change the return type of getTrailingMargin to YGFloatOptional

Summary: Change the return type of getTrailingMargin to YGFloatOptional

Reviewed By: emilsjolander

Differential Revision: D7350221

fbshipit-source-id: 61a67364c1975ec6dd1883bc2cb4968b830c73df
This commit is contained in:
Pritesh Nandgaonkar
2018-04-04 07:55:51 -07:00
committed by Facebook Github Bot
parent 6a77a6939e
commit 3c6c10075a
3 changed files with 28 additions and 22 deletions

View File

@@ -1093,8 +1093,9 @@ static inline float YGNodeDimWithMargin(const YGNodeRef node,
const YGFlexDirection axis,
const float widthSize) {
return node->getLayout().measuredDimensions[dim[axis]] +
YGUnwrapFloatOptional(node->getLeadingMargin(axis, widthSize)) +
node->getTrailingMargin(axis, widthSize);
YGUnwrapFloatOptional(
node->getLeadingMargin(axis, widthSize) +
node->getTrailingMargin(axis, widthSize));
}
static inline bool YGNodeIsStyleDimDefined(const YGNodeRef node,
@@ -1503,7 +1504,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
node->getLayout().measuredDimensions[dim[mainAxis]] -
child->getLayout().measuredDimensions[dim[mainAxis]] -
node->getTrailingBorder(mainAxis) -
child->getTrailingMargin(mainAxis, width) -
YGUnwrapFloatOptional(child->getTrailingMargin(mainAxis, width)) -
YGUnwrapFloatOptional(child->getTrailingPosition(
mainAxis, isMainAxisRow ? width : height)),
leading[mainAxis]);
@@ -1530,7 +1531,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
node->getLayout().measuredDimensions[dim[crossAxis]] -
child->getLayout().measuredDimensions[dim[crossAxis]] -
node->getTrailingBorder(crossAxis) -
child->getTrailingMargin(crossAxis, width) -
YGUnwrapFloatOptional(child->getTrailingMargin(crossAxis, width)) -
YGUnwrapFloatOptional(child->getTrailingPosition(
crossAxis, isMainAxisRow ? height : width)),
leading[crossAxis]);
@@ -2578,13 +2579,17 @@ static void YGNodelayoutImpl(const YGNodeRef node,
node->getLeadingMargin(flexRowDirection, ownerWidth)),
YGEdgeStart);
node->setLayoutMargin(
node->getTrailingMargin(flexRowDirection, ownerWidth), YGEdgeEnd);
YGUnwrapFloatOptional(
node->getTrailingMargin(flexRowDirection, ownerWidth)),
YGEdgeEnd);
node->setLayoutMargin(
YGUnwrapFloatOptional(
node->getLeadingMargin(flexColumnDirection, ownerWidth)),
YGEdgeTop);
node->setLayoutMargin(
node->getTrailingMargin(flexColumnDirection, ownerWidth), YGEdgeBottom);
YGUnwrapFloatOptional(
node->getTrailingMargin(flexColumnDirection, ownerWidth)),
YGEdgeBottom);
node->setLayoutBorder(node->getLeadingBorder(flexRowDirection), YGEdgeStart);
node->setLayoutBorder(node->getTrailingBorder(flexRowDirection), YGEdgeEnd);
@@ -3128,8 +3133,8 @@ static void YGNodelayoutImpl(const YGNodeRef node,
case YGAlignFlexEnd: {
child->setLayoutPosition(
currentLead + lineHeight -
child->getTrailingMargin(
crossAxis, availableInnerWidth) -
YGUnwrapFloatOptional(child->getTrailingMargin(
crossAxis, availableInnerWidth)) -
child->getLayout().measuredDimensions[dim[crossAxis]],
pos[crossAxis]);
break;