From 02a2309b2a8208e652e351cf8a195c17694b1f01 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 22 Nov 2018 08:06:25 -0800 Subject: [PATCH] `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 --- yoga/Yoga.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/yoga/Yoga.cpp b/yoga/Yoga.cpp index d05e0da9..10f27bf0 100644 --- a/yoga/Yoga.cpp +++ b/yoga/Yoga.cpp @@ -1911,7 +1911,7 @@ static float YGNodeCalculateAvailableInnerDim( return availableInnerDim; } -static void YGNodeComputeFlexBasisForChildren( +static float YGNodeComputeFlexBasisForChildren( const YGNodeRef node, const float availableInnerWidth, const float availableInnerHeight, @@ -1920,8 +1920,8 @@ static void YGNodeComputeFlexBasisForChildren( YGDirection direction, YGFlexDirection mainAxis, const YGConfigRef config, - bool performLayout, - float& totalOuterFlexBasis) { + bool performLayout) { + float totalOuterFlexBasis = 0.0f; YGNodeRef singleFlexChild = nullptr; YGVector children = node->getChildren(); YGMeasureMode measureModeMainDim = @@ -1991,6 +1991,8 @@ static void YGNodeComputeFlexBasisForChildren( child->getLayout().computedFlexBasis + child->getMarginForAxis(mainAxis, availableInnerWidth)); } + + return totalOuterFlexBasis; } // This function assumes that all the children of node have their @@ -2902,11 +2904,9 @@ static void YGNodelayoutImpl( const float availableInnerCrossDim = isMainAxisRow ? availableInnerHeight : availableInnerWidth; - float totalOuterFlexBasis = 0; - // STEP 3: DETERMINE FLEX BASIS FOR EACH ITEM - YGNodeComputeFlexBasisForChildren( + float totalOuterFlexBasis = YGNodeComputeFlexBasisForChildren( node, availableInnerWidth, availableInnerHeight, @@ -2915,8 +2915,7 @@ static void YGNodelayoutImpl( direction, mainAxis, config, - performLayout, - totalOuterFlexBasis); + performLayout); const bool flexBasisOverflows = measureModeMainDim == YGMeasureModeUndefined ? false