mirror of
https://github.com/status-im/react-native.git
synced 2025-02-04 21:53:30 +00:00
Change the return type of getTrailingMargin to YGFloatOptional
Reviewed By: emilsjolander Differential Revision: D7350221 fbshipit-source-id: 61a67364c1975ec6dd1883bc2cb4968b830c73df
This commit is contained in:
parent
1024e98b95
commit
3a65fa56c5
@ -152,26 +152,25 @@ YGFloatOptional YGNode::getLeadingMargin(
|
||||
widthSize);
|
||||
}
|
||||
|
||||
float YGNode::getTrailingMargin(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
YGFloatOptional YGNode::getTrailingMargin(
|
||||
const YGFlexDirection& axis,
|
||||
const float& widthSize) const {
|
||||
if (YGFlexDirectionIsRow(axis) &&
|
||||
style_.margin[YGEdgeEnd].unit != YGUnitUndefined) {
|
||||
return YGUnwrapFloatOptional(
|
||||
YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize));
|
||||
return YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize);
|
||||
}
|
||||
|
||||
return YGUnwrapFloatOptional(YGResolveValueMargin(
|
||||
return YGResolveValueMargin(
|
||||
*YGComputedEdgeValue(style_.margin, trailing[axis], &YGValueZero),
|
||||
widthSize));
|
||||
widthSize);
|
||||
}
|
||||
|
||||
// TODO: Make its return type to YGFloatOptional
|
||||
float YGNode::getMarginForAxis(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
return YGUnwrapFloatOptional(getLeadingMargin(axis, widthSize)) +
|
||||
getTrailingMargin(axis, widthSize);
|
||||
return YGUnwrapFloatOptional(
|
||||
getLeadingMargin(axis, widthSize) + getTrailingMargin(axis, widthSize));
|
||||
}
|
||||
|
||||
// Setters
|
||||
@ -378,16 +377,16 @@ void YGNode::setPosition(
|
||||
getLeadingMargin(mainAxis, ownerWidth) + relativePositionMain),
|
||||
leading[mainAxis]);
|
||||
setLayoutPosition(
|
||||
getTrailingMargin(mainAxis, ownerWidth) +
|
||||
YGUnwrapFloatOptional(relativePositionMain),
|
||||
YGUnwrapFloatOptional(
|
||||
getTrailingMargin(mainAxis, ownerWidth) + relativePositionMain),
|
||||
trailing[mainAxis]);
|
||||
setLayoutPosition(
|
||||
YGUnwrapFloatOptional(
|
||||
getLeadingMargin(crossAxis, ownerWidth) + relativePositionCross),
|
||||
leading[crossAxis]);
|
||||
setLayoutPosition(
|
||||
getTrailingMargin(crossAxis, ownerWidth) +
|
||||
YGUnwrapFloatOptional(relativePositionCross),
|
||||
YGUnwrapFloatOptional(
|
||||
getTrailingMargin(crossAxis, ownerWidth) + relativePositionCross),
|
||||
trailing[crossAxis]);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,9 @@ struct YGNode {
|
||||
YGFloatOptional getLeadingMargin(
|
||||
const YGFlexDirection& axis,
|
||||
const float& widthSize) const;
|
||||
float getTrailingMargin(const YGFlexDirection axis, const float widthSize) const;
|
||||
YGFloatOptional getTrailingMargin(
|
||||
const YGFlexDirection& axis,
|
||||
const float& widthSize) const;
|
||||
float getLeadingBorder(const YGFlexDirection& flexDirection) const;
|
||||
float getTrailingBorder(const YGFlexDirection& flexDirection) const;
|
||||
YGFloatOptional getLeadingPadding(
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user