Skip to content

Commit 1475fc4

Browse files
Moved trailing padding and border function as a method on YGNode
Reviewed By: emilsjolander Differential Revision: D6899571 fbshipit-source-id: 7f686e8771d5a94aae502191516557b20c557d7c
1 parent 9daa174 commit 1475fc4

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

ReactCommon/yoga/yoga/YGNode.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,12 @@ float YGNode::getLeadingPaddingAndBorder(
678678
return getLeadingPadding(axis, widthSize) + getLeadingBorder(axis);
679679
}
680680

681+
float YGNode::getTrailingPaddingAndBorder(
682+
const YGFlexDirection axis,
683+
const float widthSize) {
684+
return getTrailingPadding(axis, widthSize) + getTrailingBorder(axis);
685+
}
686+
681687
bool YGNode::didUseLegacyFlag() {
682688
bool didUseLegacyFlag = layout_.didUseLegacyFlag;
683689
if (didUseLegacyFlag) {

ReactCommon/yoga/yoga/YGNode.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ struct YGNode {
9494
float getLeadingPaddingAndBorder(
9595
const YGFlexDirection axis,
9696
const float widthSize);
97+
float getTrailingPaddingAndBorder(
98+
const YGFlexDirection axis,
99+
const float widthSize);
97100
// Setters
98101

99102
void setContext(void* context);

ReactCommon/yoga/yoga/Yoga.cpp

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -797,13 +797,6 @@ static const std::array<YGEdge, 4> pos = {{
797797
static const std::array<YGDimension, 4> dim = {
798798
{YGDimensionHeight, YGDimensionHeight, YGDimensionWidth, YGDimensionWidth}};
799799

800-
static inline float YGNodeTrailingPaddingAndBorder(const YGNodeRef node,
801-
const YGFlexDirection axis,
802-
const float widthSize) {
803-
return node->getTrailingPadding(axis, widthSize) +
804-
node->getTrailingBorder(axis);
805-
}
806-
807800
static inline float YGNodeMarginForAxis(const YGNodeRef node,
808801
const YGFlexDirection axis,
809802
const float widthSize) {
@@ -815,7 +808,7 @@ static inline float YGNodePaddingAndBorderForAxis(const YGNodeRef node,
815808
const YGFlexDirection axis,
816809
const float widthSize) {
817810
return node->getLeadingPaddingAndBorder(axis, widthSize) +
818-
YGNodeTrailingPaddingAndBorder(node, axis, widthSize);
811+
node->getTrailingPaddingAndBorder(axis, widthSize);
819812
}
820813

821814
static inline YGAlign YGNodeAlignItem(const YGNodeRef node, const YGNodeRef child) {
@@ -2202,7 +2195,7 @@ static void YGJustifyMainAxis(
22022195
}
22032196
}
22042197
collectedFlexItemsValues.mainDim +=
2205-
YGNodeTrailingPaddingAndBorder(node, mainAxis, parentWidth);
2198+
node->getTrailingPaddingAndBorder(mainAxis, parentWidth);
22062199
}
22072200

22082201
//

0 commit comments

Comments
 (0)