`YGNodeComputeFlexBasisForChildren`: remove output param

Summary:
@public

`YGNodeComputeFlexBasisForChildren` was using an output parameter (`float&`) that is always initialised to `0.0f`.
Here, we move the initialisation inside `YGNodeComputeFlexBasisForChildren`, and simply return the result.

Reviewed By: astreet

Differential Revision: D13167509

fbshipit-source-id: cbea20e2deb82ec75a1c158b16c94f4a3e5e4c99
This commit is contained in:
David Aurelio 2018-11-22 08:06:25 -08:00 committed by Facebook Github Bot
parent c34ad17c94
commit 8f283b93ea
1 changed files with 7 additions and 8 deletions

View File

@ -1911,7 +1911,7 @@ static float YGNodeCalculateAvailableInnerDim(
return availableInnerDim; return availableInnerDim;
} }
static void YGNodeComputeFlexBasisForChildren( static float YGNodeComputeFlexBasisForChildren(
const YGNodeRef node, const YGNodeRef node,
const float availableInnerWidth, const float availableInnerWidth,
const float availableInnerHeight, const float availableInnerHeight,
@ -1920,8 +1920,8 @@ static void YGNodeComputeFlexBasisForChildren(
YGDirection direction, YGDirection direction,
YGFlexDirection mainAxis, YGFlexDirection mainAxis,
const YGConfigRef config, const YGConfigRef config,
bool performLayout, bool performLayout) {
float& totalOuterFlexBasis) { float totalOuterFlexBasis = 0.0f;
YGNodeRef singleFlexChild = nullptr; YGNodeRef singleFlexChild = nullptr;
YGVector children = node->getChildren(); YGVector children = node->getChildren();
YGMeasureMode measureModeMainDim = YGMeasureMode measureModeMainDim =
@ -1991,6 +1991,8 @@ static void YGNodeComputeFlexBasisForChildren(
child->getLayout().computedFlexBasis + child->getLayout().computedFlexBasis +
child->getMarginForAxis(mainAxis, availableInnerWidth)); child->getMarginForAxis(mainAxis, availableInnerWidth));
} }
return totalOuterFlexBasis;
} }
// This function assumes that all the children of node have their // This function assumes that all the children of node have their
@ -2902,11 +2904,9 @@ static void YGNodelayoutImpl(
const float availableInnerCrossDim = const float availableInnerCrossDim =
isMainAxisRow ? availableInnerHeight : availableInnerWidth; isMainAxisRow ? availableInnerHeight : availableInnerWidth;
float totalOuterFlexBasis = 0;
// STEP 3: DETERMINE FLEX BASIS FOR EACH ITEM // STEP 3: DETERMINE FLEX BASIS FOR EACH ITEM
YGNodeComputeFlexBasisForChildren( float totalOuterFlexBasis = YGNodeComputeFlexBasisForChildren(
node, node,
availableInnerWidth, availableInnerWidth,
availableInnerHeight, availableInnerHeight,
@ -2915,8 +2915,7 @@ static void YGNodelayoutImpl(
direction, direction,
mainAxis, mainAxis,
config, config,
performLayout, performLayout);
totalOuterFlexBasis);
const bool flexBasisOverflows = measureModeMainDim == YGMeasureModeUndefined const bool flexBasisOverflows = measureModeMainDim == YGMeasureModeUndefined
? false ? false