Pass `YGFloatOptional` by value, not reference
Summary: @public `YGFloatOptional` is a 32bit type now, and can be passed by value efficiently. Reviewed By: SidharthGuglani Differential Revision: D13439603 fbshipit-source-id: e12539ad5b3cccbd5bc27869866ca66c023b24a7
This commit is contained in:
parent
ada4831580
commit
688b3195c3
|
@ -175,7 +175,7 @@ void YGNode::setLayoutLastOwnerDirection(YGDirection direction) {
|
|||
}
|
||||
|
||||
void YGNode::setLayoutComputedFlexBasis(
|
||||
const YGFloatOptional& computedFlexBasis) {
|
||||
const YGFloatOptional computedFlexBasis) {
|
||||
layout_.computedFlexBasis = computedFlexBasis;
|
||||
}
|
||||
|
||||
|
@ -451,7 +451,7 @@ float YGNode::getTrailingBorder(const YGFlexDirection flexDirection) const {
|
|||
YGFloatOptional YGNode::getLeadingPadding(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
const YGFloatOptional& paddingEdgeStart =
|
||||
const YGFloatOptional paddingEdgeStart =
|
||||
YGResolveValue(style_.padding[YGEdgeStart], widthSize);
|
||||
if (YGFlexDirectionIsRow(axis) &&
|
||||
style_.padding[YGEdgeStart].unit != YGUnitUndefined &&
|
||||
|
@ -468,11 +468,10 @@ YGFloatOptional YGNode::getLeadingPadding(
|
|||
YGFloatOptional YGNode::getTrailingPadding(
|
||||
const YGFlexDirection axis,
|
||||
const float widthSize) const {
|
||||
if (YGFlexDirectionIsRow(axis) &&
|
||||
style_.padding[YGEdgeEnd].unit != YGUnitUndefined &&
|
||||
!YGResolveValue(style_.padding[YGEdgeEnd], widthSize).isUndefined() &&
|
||||
YGResolveValue(style_.padding[YGEdgeEnd], widthSize).unwrap() >= 0.0f) {
|
||||
return YGResolveValue(style_.padding[YGEdgeEnd], widthSize);
|
||||
const YGFloatOptional paddingEdgeEnd =
|
||||
YGResolveValue(style_.padding[YGEdgeEnd], widthSize);
|
||||
if (YGFlexDirectionIsRow(axis) && paddingEdgeEnd >= YGFloatOptional{0.0f}) {
|
||||
return paddingEdgeEnd;
|
||||
}
|
||||
|
||||
YGFloatOptional resolvedValue = YGResolveValue(
|
||||
|
|
|
@ -235,7 +235,7 @@ struct YGNode {
|
|||
|
||||
void setDirty(bool isDirty);
|
||||
void setLayoutLastOwnerDirection(YGDirection direction);
|
||||
void setLayoutComputedFlexBasis(const YGFloatOptional& computedFlexBasis);
|
||||
void setLayoutComputedFlexBasis(const YGFloatOptional computedFlexBasis);
|
||||
void setLayoutComputedFlexBasisGeneration(
|
||||
uint32_t computedFlexBasisGeneration);
|
||||
void setLayoutMeasuredDimension(float measuredDimension, int index);
|
||||
|
|
|
@ -1325,14 +1325,14 @@ static void YGNodeComputeFlexBasisForChild(
|
|||
child->getConfig(), YGExperimentalFeatureWebFlexBasis) &&
|
||||
child->getLayout().computedFlexBasisGeneration !=
|
||||
gCurrentGenerationCount)) {
|
||||
const YGFloatOptional& paddingAndBorder = YGFloatOptional(
|
||||
const YGFloatOptional paddingAndBorder = YGFloatOptional(
|
||||
YGNodePaddingAndBorderForAxis(child, mainAxis, ownerWidth));
|
||||
child->setLayoutComputedFlexBasis(
|
||||
YGFloatOptionalMax(resolvedFlexBasis, paddingAndBorder));
|
||||
}
|
||||
} else if (isMainAxisRow && isRowStyleDimDefined) {
|
||||
// The width is definite, so use that as the flex basis.
|
||||
const YGFloatOptional& paddingAndBorder = YGFloatOptional(
|
||||
const YGFloatOptional paddingAndBorder = YGFloatOptional(
|
||||
YGNodePaddingAndBorderForAxis(child, YGFlexDirectionRow, ownerWidth));
|
||||
|
||||
child->setLayoutComputedFlexBasis(YGFloatOptionalMax(
|
||||
|
@ -1341,7 +1341,7 @@ static void YGNodeComputeFlexBasisForChild(
|
|||
paddingAndBorder));
|
||||
} else if (!isMainAxisRow && isColumnStyleDimDefined) {
|
||||
// The height is definite, so use that as the flex basis.
|
||||
const YGFloatOptional& paddingAndBorder =
|
||||
const YGFloatOptional paddingAndBorder =
|
||||
YGFloatOptional(YGNodePaddingAndBorderForAxis(
|
||||
child, YGFlexDirectionColumn, ownerWidth));
|
||||
child->setLayoutComputedFlexBasis(YGFloatOptionalMax(
|
||||
|
|
Loading…
Reference in New Issue