Permalink
Browse files

Moved trailing padding and border function as a method on YGNode

Reviewed By: emilsjolander

Differential Revision: D6899571

fbshipit-source-id: 7f686e8771d5a94aae502191516557b20c557d7c
  • Loading branch information...
priteshrnandgaonkar authored and facebook-github-bot committed Feb 6, 2018
1 parent 9daa174 commit 1475fc4856d366f8ec2027374971ed5aefcdeafa
Showing with 11 additions and 9 deletions.
  1. +6 −0 ReactCommon/yoga/yoga/YGNode.cpp
  2. +3 −0 ReactCommon/yoga/yoga/YGNode.h
  3. +2 −9 ReactCommon/yoga/yoga/Yoga.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) {
@@ -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);
@@ -797,13 +797,6 @@ static const std::array<YGEdge, 4> pos = {{
static const std::array<YGDimension, 4> 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);
}
//

0 comments on commit 1475fc4

Please sign in to comment.