mirror of
https://github.com/status-im/react-native.git
synced 2025-02-10 00:23:26 +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);
|
widthSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
float YGNode::getTrailingMargin(
|
YGFloatOptional YGNode::getTrailingMargin(
|
||||||
const YGFlexDirection axis,
|
const YGFlexDirection& axis,
|
||||||
const float widthSize) const {
|
const float& widthSize) const {
|
||||||
if (YGFlexDirectionIsRow(axis) &&
|
if (YGFlexDirectionIsRow(axis) &&
|
||||||
style_.margin[YGEdgeEnd].unit != YGUnitUndefined) {
|
style_.margin[YGEdgeEnd].unit != YGUnitUndefined) {
|
||||||
return YGUnwrapFloatOptional(
|
return YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize);
|
||||||
YGResolveValueMargin(style_.margin[YGEdgeEnd], widthSize));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return YGUnwrapFloatOptional(YGResolveValueMargin(
|
return YGResolveValueMargin(
|
||||||
*YGComputedEdgeValue(style_.margin, trailing[axis], &YGValueZero),
|
*YGComputedEdgeValue(style_.margin, trailing[axis], &YGValueZero),
|
||||||
widthSize));
|
widthSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Make its return type to YGFloatOptional
|
// TODO: Make its return type to YGFloatOptional
|
||||||
float YGNode::getMarginForAxis(
|
float YGNode::getMarginForAxis(
|
||||||
const YGFlexDirection axis,
|
const YGFlexDirection axis,
|
||||||
const float widthSize) const {
|
const float widthSize) const {
|
||||||
return YGUnwrapFloatOptional(getLeadingMargin(axis, widthSize)) +
|
return YGUnwrapFloatOptional(
|
||||||
getTrailingMargin(axis, widthSize);
|
getLeadingMargin(axis, widthSize) + getTrailingMargin(axis, widthSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setters
|
// Setters
|
||||||
@ -378,16 +377,16 @@ void YGNode::setPosition(
|
|||||||
getLeadingMargin(mainAxis, ownerWidth) + relativePositionMain),
|
getLeadingMargin(mainAxis, ownerWidth) + relativePositionMain),
|
||||||
leading[mainAxis]);
|
leading[mainAxis]);
|
||||||
setLayoutPosition(
|
setLayoutPosition(
|
||||||
getTrailingMargin(mainAxis, ownerWidth) +
|
YGUnwrapFloatOptional(
|
||||||
YGUnwrapFloatOptional(relativePositionMain),
|
getTrailingMargin(mainAxis, ownerWidth) + relativePositionMain),
|
||||||
trailing[mainAxis]);
|
trailing[mainAxis]);
|
||||||
setLayoutPosition(
|
setLayoutPosition(
|
||||||
YGUnwrapFloatOptional(
|
YGUnwrapFloatOptional(
|
||||||
getLeadingMargin(crossAxis, ownerWidth) + relativePositionCross),
|
getLeadingMargin(crossAxis, ownerWidth) + relativePositionCross),
|
||||||
leading[crossAxis]);
|
leading[crossAxis]);
|
||||||
setLayoutPosition(
|
setLayoutPosition(
|
||||||
getTrailingMargin(crossAxis, ownerWidth) +
|
YGUnwrapFloatOptional(
|
||||||
YGUnwrapFloatOptional(relativePositionCross),
|
getTrailingMargin(crossAxis, ownerWidth) + relativePositionCross),
|
||||||
trailing[crossAxis]);
|
trailing[crossAxis]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,9 @@ struct YGNode {
|
|||||||
YGFloatOptional getLeadingMargin(
|
YGFloatOptional getLeadingMargin(
|
||||||
const YGFlexDirection& axis,
|
const YGFlexDirection& axis,
|
||||||
const float& widthSize) const;
|
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 getLeadingBorder(const YGFlexDirection& flexDirection) const;
|
||||||
float getTrailingBorder(const YGFlexDirection& flexDirection) const;
|
float getTrailingBorder(const YGFlexDirection& flexDirection) const;
|
||||||
YGFloatOptional getLeadingPadding(
|
YGFloatOptional getLeadingPadding(
|
||||||
|
@ -1093,8 +1093,9 @@ static inline float YGNodeDimWithMargin(const YGNodeRef node,
|
|||||||
const YGFlexDirection axis,
|
const YGFlexDirection axis,
|
||||||
const float widthSize) {
|
const float widthSize) {
|
||||||
return node->getLayout().measuredDimensions[dim[axis]] +
|
return node->getLayout().measuredDimensions[dim[axis]] +
|
||||||
YGUnwrapFloatOptional(node->getLeadingMargin(axis, widthSize)) +
|
YGUnwrapFloatOptional(
|
||||||
node->getTrailingMargin(axis, widthSize);
|
node->getLeadingMargin(axis, widthSize) +
|
||||||
|
node->getTrailingMargin(axis, widthSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool YGNodeIsStyleDimDefined(const YGNodeRef node,
|
static inline bool YGNodeIsStyleDimDefined(const YGNodeRef node,
|
||||||
@ -1503,7 +1504,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||||||
node->getLayout().measuredDimensions[dim[mainAxis]] -
|
node->getLayout().measuredDimensions[dim[mainAxis]] -
|
||||||
child->getLayout().measuredDimensions[dim[mainAxis]] -
|
child->getLayout().measuredDimensions[dim[mainAxis]] -
|
||||||
node->getTrailingBorder(mainAxis) -
|
node->getTrailingBorder(mainAxis) -
|
||||||
child->getTrailingMargin(mainAxis, width) -
|
YGUnwrapFloatOptional(child->getTrailingMargin(mainAxis, width)) -
|
||||||
YGUnwrapFloatOptional(child->getTrailingPosition(
|
YGUnwrapFloatOptional(child->getTrailingPosition(
|
||||||
mainAxis, isMainAxisRow ? width : height)),
|
mainAxis, isMainAxisRow ? width : height)),
|
||||||
leading[mainAxis]);
|
leading[mainAxis]);
|
||||||
@ -1530,7 +1531,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||||||
node->getLayout().measuredDimensions[dim[crossAxis]] -
|
node->getLayout().measuredDimensions[dim[crossAxis]] -
|
||||||
child->getLayout().measuredDimensions[dim[crossAxis]] -
|
child->getLayout().measuredDimensions[dim[crossAxis]] -
|
||||||
node->getTrailingBorder(crossAxis) -
|
node->getTrailingBorder(crossAxis) -
|
||||||
child->getTrailingMargin(crossAxis, width) -
|
YGUnwrapFloatOptional(child->getTrailingMargin(crossAxis, width)) -
|
||||||
YGUnwrapFloatOptional(child->getTrailingPosition(
|
YGUnwrapFloatOptional(child->getTrailingPosition(
|
||||||
crossAxis, isMainAxisRow ? height : width)),
|
crossAxis, isMainAxisRow ? height : width)),
|
||||||
leading[crossAxis]);
|
leading[crossAxis]);
|
||||||
@ -2578,13 +2579,17 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
node->getLeadingMargin(flexRowDirection, ownerWidth)),
|
node->getLeadingMargin(flexRowDirection, ownerWidth)),
|
||||||
YGEdgeStart);
|
YGEdgeStart);
|
||||||
node->setLayoutMargin(
|
node->setLayoutMargin(
|
||||||
node->getTrailingMargin(flexRowDirection, ownerWidth), YGEdgeEnd);
|
YGUnwrapFloatOptional(
|
||||||
|
node->getTrailingMargin(flexRowDirection, ownerWidth)),
|
||||||
|
YGEdgeEnd);
|
||||||
node->setLayoutMargin(
|
node->setLayoutMargin(
|
||||||
YGUnwrapFloatOptional(
|
YGUnwrapFloatOptional(
|
||||||
node->getLeadingMargin(flexColumnDirection, ownerWidth)),
|
node->getLeadingMargin(flexColumnDirection, ownerWidth)),
|
||||||
YGEdgeTop);
|
YGEdgeTop);
|
||||||
node->setLayoutMargin(
|
node->setLayoutMargin(
|
||||||
node->getTrailingMargin(flexColumnDirection, ownerWidth), YGEdgeBottom);
|
YGUnwrapFloatOptional(
|
||||||
|
node->getTrailingMargin(flexColumnDirection, ownerWidth)),
|
||||||
|
YGEdgeBottom);
|
||||||
|
|
||||||
node->setLayoutBorder(node->getLeadingBorder(flexRowDirection), YGEdgeStart);
|
node->setLayoutBorder(node->getLeadingBorder(flexRowDirection), YGEdgeStart);
|
||||||
node->setLayoutBorder(node->getTrailingBorder(flexRowDirection), YGEdgeEnd);
|
node->setLayoutBorder(node->getTrailingBorder(flexRowDirection), YGEdgeEnd);
|
||||||
@ -3128,8 +3133,8 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
case YGAlignFlexEnd: {
|
case YGAlignFlexEnd: {
|
||||||
child->setLayoutPosition(
|
child->setLayoutPosition(
|
||||||
currentLead + lineHeight -
|
currentLead + lineHeight -
|
||||||
child->getTrailingMargin(
|
YGUnwrapFloatOptional(child->getTrailingMargin(
|
||||||
crossAxis, availableInnerWidth) -
|
crossAxis, availableInnerWidth)) -
|
||||||
child->getLayout().measuredDimensions[dim[crossAxis]],
|
child->getLayout().measuredDimensions[dim[crossAxis]],
|
||||||
pos[crossAxis]);
|
pos[crossAxis]);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user