Moved leadingpaddingnandborder function as a method on YGNode

Reviewed By: emilsjolander

Differential Revision: D6711991

fbshipit-source-id: 41ad7191bf8df6fe3131106436dc0c87e9dee297
This commit is contained in:
Pritesh Nandgaonkar 2018-01-15 10:09:55 -08:00 committed by Facebook Github Bot
parent 2fe65b032e
commit 831a1bb4b1
3 changed files with 13 additions and 12 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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);