Permalink
Browse files

Moved leadingpaddingnandborder function as a method on YGNode

Reviewed By: emilsjolander

Differential Revision: D6711991

fbshipit-source-id: 41ad7191bf8df6fe3131106436dc0c87e9dee297
  • Loading branch information...
priteshrnandgaonkar authored and facebook-github-bot committed Jan 15, 2018
1 parent 2fe65b0 commit 831a1bb4b1cc201b53685874a9dbdd6c3c1615ad
Showing with 13 additions and 12 deletions.
  1. +6 −0 ReactCommon/yoga/yoga/YGNode.cpp
  2. +3 −0 ReactCommon/yoga/yoga/YGNode.h
  3. +4 −12 ReactCommon/yoga/yoga/Yoga.cpp
@@ -660,3 +660,9 @@ float YGNode::getTrailingPadding(
widthSize),
0.0f);
}
float YGNode::getLeadingPaddingAndBorder(
const YGFlexDirection axis,
const float widthSize) {
return getLeadingPadding(axis, widthSize) + getLeadingBorder(axis);
}
@@ -90,6 +90,9 @@ struct YGNode {
float getTrailingBorder(const YGFlexDirection flexDirection);
float getLeadingPadding(const YGFlexDirection axis, const float widthSize);
float getTrailingPadding(const YGFlexDirection axis, const float widthSize);
float getLeadingPaddingAndBorder(
const YGFlexDirection axis,
const float widthSize);
// Setters
void setContext(void* context);
@@ -762,14 +762,6 @@ static const std::array<YGEdge, 4> pos = {{
static const std::array<YGDimension, 4> dim = {
{YGDimensionHeight, YGDimensionHeight, YGDimensionWidth, YGDimensionWidth}};
static inline float YGNodeLeadingPaddingAndBorder(
const YGNodeRef node,
const YGFlexDirection axis,
const float widthSize) {
return node->getLeadingPadding(axis, widthSize) +
node->getLeadingBorder(axis);
}
static inline float YGNodeTrailingPaddingAndBorder(const YGNodeRef node,
const YGFlexDirection axis,
const float widthSize) {
@@ -787,8 +779,8 @@ static inline float YGNodeMarginForAxis(const YGNodeRef node,
static inline float YGNodePaddingAndBorderForAxis(const YGNodeRef node,
const YGFlexDirection axis,
const float widthSize) {
return YGNodeLeadingPaddingAndBorder(node, axis, widthSize) +
YGNodeTrailingPaddingAndBorder(node, axis, widthSize);
return node->getLeadingPaddingAndBorder(axis, widthSize) +
YGNodeTrailingPaddingAndBorder(node, axis, widthSize);
}
static inline YGAlign YGNodeAlignItem(const YGNodeRef node, const YGNodeRef child) {
@@ -1785,11 +1777,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
YGNodeRef currentAbsoluteChild = nullptr;
const float leadingPaddingAndBorderMain =
YGNodeLeadingPaddingAndBorder(node, mainAxis, parentWidth);
node->getLeadingPaddingAndBorder(mainAxis, parentWidth);
const float trailingPaddingAndBorderMain =
YGNodeTrailingPaddingAndBorder(node, mainAxis, parentWidth);
const float leadingPaddingAndBorderCross =
YGNodeLeadingPaddingAndBorder(node, crossAxis, parentWidth);
node->getLeadingPaddingAndBorder(crossAxis, parentWidth);
const float paddingAndBorderAxisMain = YGNodePaddingAndBorderForAxis(node, mainAxis, parentWidth);
const float paddingAndBorderAxisCross =
YGNodePaddingAndBorderForAxis(node, crossAxis, parentWidth);

0 comments on commit 831a1bb

Please sign in to comment.