Move trailing padding function as a method on YGNode
Summary: Move trailing padding function as a method on YGNode Reviewed By: emilsjolander Differential Revision: D6711897 fbshipit-source-id: fa2e1a8e31242358a6e94aef51368e2c2c58b79d
This commit is contained in:
committed by
Facebook Github Bot
parent
adb2e0fdd6
commit
130b5beca2
@@ -645,3 +645,18 @@ float YGNode::getLeadingPadding(
|
|||||||
widthSize),
|
widthSize),
|
||||||
0.0f);
|
0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float YGNode::getTrailingPadding(
|
||||||
|
const YGFlexDirection axis,
|
||||||
|
const float widthSize) {
|
||||||
|
if (YGFlexDirectionIsRow(axis) &&
|
||||||
|
style_.padding[YGEdgeEnd].unit != YGUnitUndefined &&
|
||||||
|
YGResolveValue(style_.padding[YGEdgeEnd], widthSize) >= 0.0f) {
|
||||||
|
return YGResolveValue(style_.padding[YGEdgeEnd], widthSize);
|
||||||
|
}
|
||||||
|
return fmaxf(
|
||||||
|
YGResolveValue(
|
||||||
|
*YGComputedEdgeValue(style_.padding, trailing[axis], &YGValueZero),
|
||||||
|
widthSize),
|
||||||
|
0.0f);
|
||||||
|
}
|
||||||
|
@@ -89,6 +89,7 @@ struct YGNode {
|
|||||||
float getLeadingBorder(const YGFlexDirection flexDirection);
|
float getLeadingBorder(const YGFlexDirection flexDirection);
|
||||||
float getTrailingBorder(const YGFlexDirection flexDirection);
|
float getTrailingBorder(const YGFlexDirection flexDirection);
|
||||||
float getLeadingPadding(const YGFlexDirection axis, const float widthSize);
|
float getLeadingPadding(const YGFlexDirection axis, const float widthSize);
|
||||||
|
float getTrailingPadding(const YGFlexDirection axis, const float widthSize);
|
||||||
// Setters
|
// Setters
|
||||||
|
|
||||||
void setContext(void* context);
|
void setContext(void* context);
|
||||||
|
@@ -762,23 +762,6 @@ static const std::array<YGEdge, 4> pos = {{
|
|||||||
static const std::array<YGDimension, 4> dim = {
|
static const std::array<YGDimension, 4> dim = {
|
||||||
{YGDimensionHeight, YGDimensionHeight, YGDimensionWidth, YGDimensionWidth}};
|
{YGDimensionHeight, YGDimensionHeight, YGDimensionWidth, YGDimensionWidth}};
|
||||||
|
|
||||||
static float YGNodeTrailingPadding(const YGNodeRef node,
|
|
||||||
const YGFlexDirection axis,
|
|
||||||
const float widthSize) {
|
|
||||||
if (YGFlexDirectionIsRow(axis) &&
|
|
||||||
node->getStyle().padding[YGEdgeEnd].unit != YGUnitUndefined &&
|
|
||||||
YGResolveValue(node->getStyle().padding[YGEdgeEnd], widthSize) >= 0.0f) {
|
|
||||||
return YGResolveValue(node->getStyle().padding[YGEdgeEnd], widthSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmaxf(
|
|
||||||
YGResolveValue(
|
|
||||||
*YGComputedEdgeValue(
|
|
||||||
node->getStyle().padding, trailing[axis], &YGValueZero),
|
|
||||||
widthSize),
|
|
||||||
0.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline float YGNodeLeadingPaddingAndBorder(
|
static inline float YGNodeLeadingPaddingAndBorder(
|
||||||
const YGNodeRef node,
|
const YGNodeRef node,
|
||||||
const YGFlexDirection axis,
|
const YGFlexDirection axis,
|
||||||
@@ -790,7 +773,7 @@ static inline float YGNodeLeadingPaddingAndBorder(
|
|||||||
static inline float YGNodeTrailingPaddingAndBorder(const YGNodeRef node,
|
static inline float YGNodeTrailingPaddingAndBorder(const YGNodeRef node,
|
||||||
const YGFlexDirection axis,
|
const YGFlexDirection axis,
|
||||||
const float widthSize) {
|
const float widthSize) {
|
||||||
return YGNodeTrailingPadding(node, axis, widthSize) +
|
return node->getTrailingPadding(axis, widthSize) +
|
||||||
node->getTrailingBorder(axis);
|
node->getTrailingBorder(axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1741,12 +1724,11 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
node->setLayoutPadding(
|
node->setLayoutPadding(
|
||||||
node->getLeadingPadding(flexRowDirection, parentWidth), YGEdgeStart);
|
node->getLeadingPadding(flexRowDirection, parentWidth), YGEdgeStart);
|
||||||
node->setLayoutPadding(
|
node->setLayoutPadding(
|
||||||
YGNodeTrailingPadding(node, flexRowDirection, parentWidth), YGEdgeEnd);
|
node->getTrailingPadding(flexRowDirection, parentWidth), YGEdgeEnd);
|
||||||
node->setLayoutPadding(
|
node->setLayoutPadding(
|
||||||
node->getLeadingPadding(flexColumnDirection, parentWidth), YGEdgeTop);
|
node->getLeadingPadding(flexColumnDirection, parentWidth), YGEdgeTop);
|
||||||
node->setLayoutPadding(
|
node->setLayoutPadding(
|
||||||
YGNodeTrailingPadding(node, flexColumnDirection, parentWidth),
|
node->getTrailingPadding(flexColumnDirection, parentWidth), YGEdgeBottom);
|
||||||
YGEdgeBottom);
|
|
||||||
|
|
||||||
if (node->getMeasure() != nullptr) {
|
if (node->getMeasure() != nullptr) {
|
||||||
YGNodeWithMeasureFuncSetMeasuredDimensions(node,
|
YGNodeWithMeasureFuncSetMeasuredDimensions(node,
|
||||||
|
Reference in New Issue
Block a user