diff --git a/ReactCommon/yoga/yoga/YGNode.cpp b/ReactCommon/yoga/yoga/YGNode.cpp index e56350dcad4dbb..8add290f11fc1c 100644 --- a/ReactCommon/yoga/yoga/YGNode.cpp +++ b/ReactCommon/yoga/yoga/YGNode.cpp @@ -678,6 +678,12 @@ float YGNode::getLeadingPaddingAndBorder( return getLeadingPadding(axis, widthSize) + getLeadingBorder(axis); } +float YGNode::getTrailingPaddingAndBorder( + const YGFlexDirection axis, + const float widthSize) { + return getTrailingPadding(axis, widthSize) + getTrailingBorder(axis); +} + bool YGNode::didUseLegacyFlag() { bool didUseLegacyFlag = layout_.didUseLegacyFlag; if (didUseLegacyFlag) { diff --git a/ReactCommon/yoga/yoga/YGNode.h b/ReactCommon/yoga/yoga/YGNode.h index 9d0c1029de9094..1d5260dc0f97c6 100644 --- a/ReactCommon/yoga/yoga/YGNode.h +++ b/ReactCommon/yoga/yoga/YGNode.h @@ -94,6 +94,9 @@ struct YGNode { float getLeadingPaddingAndBorder( const YGFlexDirection axis, const float widthSize); + float getTrailingPaddingAndBorder( + const YGFlexDirection axis, + const float widthSize); // Setters void setContext(void* context); diff --git a/ReactCommon/yoga/yoga/Yoga.cpp b/ReactCommon/yoga/yoga/Yoga.cpp index 6987a5cab45c80..42272e4fa08386 100644 --- a/ReactCommon/yoga/yoga/Yoga.cpp +++ b/ReactCommon/yoga/yoga/Yoga.cpp @@ -797,13 +797,6 @@ static const std::array pos = {{ static const std::array dim = { {YGDimensionHeight, YGDimensionHeight, YGDimensionWidth, YGDimensionWidth}}; -static inline float YGNodeTrailingPaddingAndBorder(const YGNodeRef node, - const YGFlexDirection axis, - const float widthSize) { - return node->getTrailingPadding(axis, widthSize) + - node->getTrailingBorder(axis); -} - static inline float YGNodeMarginForAxis(const YGNodeRef node, const YGFlexDirection axis, const float widthSize) { @@ -815,7 +808,7 @@ static inline float YGNodePaddingAndBorderForAxis(const YGNodeRef node, const YGFlexDirection axis, const float widthSize) { return node->getLeadingPaddingAndBorder(axis, widthSize) + - YGNodeTrailingPaddingAndBorder(node, axis, widthSize); + node->getTrailingPaddingAndBorder(axis, widthSize); } static inline YGAlign YGNodeAlignItem(const YGNodeRef node, const YGNodeRef child) { @@ -2202,7 +2195,7 @@ static void YGJustifyMainAxis( } } collectedFlexItemsValues.mainDim += - YGNodeTrailingPaddingAndBorder(node, mainAxis, parentWidth); + node->getTrailingPaddingAndBorder(mainAxis, parentWidth); } //