Simplify getting padding + border for cross axis in algorithm (#1437)

Summary:
Pull Request resolved: https://github.com/facebook/yoga/pull/1437

X-link: https://github.com/facebook/react-native/pull/41208

Reading through the sizing logic and this seemed a bit redundant/confusing. Lets use the same function we just used for the main axis for the cross axis as well so people do not think its special. Also we will need one less variable. The reason this was done it seems is because we need the leading padding + border elsewhere so this is technically a few less steps but this is cleaner

Reviewed By: NickGerleman

Differential Revision: D50704177

fbshipit-source-id: 1a091edbfee6482a2bf472aca2980702bd75ad94
This commit is contained in:
Joe Vilches
2023-11-07 11:02:20 -08:00
committed by Facebook GitHub Bot
parent 484118c89b
commit e90f2a8e2c

View File

@@ -1612,12 +1612,10 @@ static void calculateLayoutImpl(
const float paddingAndBorderAxisMain =
paddingAndBorderForAxis(node, mainAxis, ownerWidth);
const float paddingAndBorderAxisCross =
paddingAndBorderForAxis(node, crossAxis, ownerWidth);
const float leadingPaddingAndBorderCross =
node->getInlineStartPaddingAndBorder(crossAxis, direction, ownerWidth);
const float trailingPaddingAndBorderCross =
node->getInlineEndPaddingAndBorder(crossAxis, direction, ownerWidth);
const float paddingAndBorderAxisCross =
leadingPaddingAndBorderCross + trailingPaddingAndBorderCross;
MeasureMode measureModeMainDim =
isMainAxisRow ? widthMeasureMode : heightMeasureMode;