Move trailing border function as a method on YGNode
Summary: Move trailing border function as a method on YGNode Reviewed By: emilsjolander Differential Revision: D6711666 fbshipit-source-id: fe4fdfc2db59d03beb763317e1a6f9de52f851d4
This commit is contained in:
committed by
Facebook Github Bot
parent
6efb4b90d4
commit
9d6af5b314
@@ -608,3 +608,16 @@ float YGNode::getLeadingBorder(const YGFlexDirection axis) {
|
|||||||
YGComputedEdgeValue(style_.border, leading[axis], &YGValueZero)->value,
|
YGComputedEdgeValue(style_.border, leading[axis], &YGValueZero)->value,
|
||||||
0.0f);
|
0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float YGNode::getTrailingBorder(const YGFlexDirection flexDirection) {
|
||||||
|
if (YGFlexDirectionIsRow(flexDirection) &&
|
||||||
|
style_.border[YGEdgeEnd].unit != YGUnitUndefined &&
|
||||||
|
style_.border[YGEdgeEnd].value >= 0.0f) {
|
||||||
|
return style_.border[YGEdgeEnd].value;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmaxf(
|
||||||
|
YGComputedEdgeValue(style_.border, trailing[flexDirection], &YGValueZero)
|
||||||
|
->value,
|
||||||
|
0.0f);
|
||||||
|
}
|
||||||
|
@@ -86,6 +86,7 @@ struct YGNode {
|
|||||||
float getLeadingMargin(const YGFlexDirection axis, const float widthSize);
|
float getLeadingMargin(const YGFlexDirection axis, const float widthSize);
|
||||||
float getTrailingMargin(const YGFlexDirection axis, const float widthSize);
|
float getTrailingMargin(const YGFlexDirection axis, const float widthSize);
|
||||||
float getLeadingBorder(const YGFlexDirection flexDirection);
|
float getLeadingBorder(const YGFlexDirection flexDirection);
|
||||||
|
float getTrailingBorder(const YGFlexDirection flexDirection);
|
||||||
// Setters
|
// Setters
|
||||||
|
|
||||||
void setContext(void* context);
|
void setContext(void* context);
|
||||||
|
@@ -797,21 +797,6 @@ static float YGNodeTrailingPadding(const YGNodeRef node,
|
|||||||
0.0f);
|
0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float YGNodeTrailingBorder(
|
|
||||||
const YGNodeRef node,
|
|
||||||
const YGFlexDirection axis) {
|
|
||||||
if (YGFlexDirectionIsRow(axis) &&
|
|
||||||
node->getStyle().border[YGEdgeEnd].unit != YGUnitUndefined &&
|
|
||||||
node->getStyle().border[YGEdgeEnd].value >= 0.0f) {
|
|
||||||
return node->getStyle().border[YGEdgeEnd].value;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmaxf(
|
|
||||||
YGComputedEdgeValue(node->getStyle().border, trailing[axis], &YGValueZero)
|
|
||||||
->value,
|
|
||||||
0.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline float YGNodeLeadingPaddingAndBorder(
|
static inline float YGNodeLeadingPaddingAndBorder(
|
||||||
const YGNodeRef node,
|
const YGNodeRef node,
|
||||||
const YGFlexDirection axis,
|
const YGFlexDirection axis,
|
||||||
@@ -823,7 +808,8 @@ 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) + YGNodeTrailingBorder(node, axis);
|
return YGNodeTrailingPadding(node, axis, widthSize) +
|
||||||
|
node->getTrailingBorder(axis);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline float YGNodeMarginForAxis(const YGNodeRef node,
|
static inline float YGNodeMarginForAxis(const YGNodeRef node,
|
||||||
@@ -1221,7 +1207,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||||||
child->isTrailingPosDefined(YGFlexDirectionRow)) {
|
child->isTrailingPosDefined(YGFlexDirectionRow)) {
|
||||||
childWidth = node->getLayout().measuredDimensions[YGDimensionWidth] -
|
childWidth = node->getLayout().measuredDimensions[YGDimensionWidth] -
|
||||||
(node->getLeadingBorder(YGFlexDirectionRow) +
|
(node->getLeadingBorder(YGFlexDirectionRow) +
|
||||||
YGNodeTrailingBorder(node, YGFlexDirectionRow)) -
|
node->getTrailingBorder(YGFlexDirectionRow)) -
|
||||||
(child->getLeadingPosition(YGFlexDirectionRow, width) +
|
(child->getLeadingPosition(YGFlexDirectionRow, width) +
|
||||||
child->getTrailingPosition(YGFlexDirectionRow, width));
|
child->getTrailingPosition(YGFlexDirectionRow, width));
|
||||||
childWidth = YGNodeBoundAxis(child, YGFlexDirectionRow, childWidth, width, width);
|
childWidth = YGNodeBoundAxis(child, YGFlexDirectionRow, childWidth, width, width);
|
||||||
@@ -1240,7 +1226,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||||||
child->isTrailingPosDefined(YGFlexDirectionColumn)) {
|
child->isTrailingPosDefined(YGFlexDirectionColumn)) {
|
||||||
childHeight = node->getLayout().measuredDimensions[YGDimensionHeight] -
|
childHeight = node->getLayout().measuredDimensions[YGDimensionHeight] -
|
||||||
(node->getLeadingBorder(YGFlexDirectionColumn) +
|
(node->getLeadingBorder(YGFlexDirectionColumn) +
|
||||||
YGNodeTrailingBorder(node, YGFlexDirectionColumn)) -
|
node->getTrailingBorder(YGFlexDirectionColumn)) -
|
||||||
(child->getLeadingPosition(YGFlexDirectionColumn, height) +
|
(child->getLeadingPosition(YGFlexDirectionColumn, height) +
|
||||||
child->getTrailingPosition(YGFlexDirectionColumn, height));
|
child->getTrailingPosition(YGFlexDirectionColumn, height));
|
||||||
childHeight = YGNodeBoundAxis(child, YGFlexDirectionColumn, childHeight, height, width);
|
childHeight = YGNodeBoundAxis(child, YGFlexDirectionColumn, childHeight, height, width);
|
||||||
@@ -1311,7 +1297,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||||||
child->setLayoutPosition(
|
child->setLayoutPosition(
|
||||||
node->getLayout().measuredDimensions[dim[mainAxis]] -
|
node->getLayout().measuredDimensions[dim[mainAxis]] -
|
||||||
child->getLayout().measuredDimensions[dim[mainAxis]] -
|
child->getLayout().measuredDimensions[dim[mainAxis]] -
|
||||||
YGNodeTrailingBorder(node, mainAxis) -
|
node->getTrailingBorder(mainAxis) -
|
||||||
child->getTrailingMargin(mainAxis, width) -
|
child->getTrailingMargin(mainAxis, width) -
|
||||||
child->getTrailingPosition(
|
child->getTrailingPosition(
|
||||||
mainAxis, isMainAxisRow ? width : height),
|
mainAxis, isMainAxisRow ? width : height),
|
||||||
@@ -1338,7 +1324,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||||||
child->setLayoutPosition(
|
child->setLayoutPosition(
|
||||||
node->getLayout().measuredDimensions[dim[crossAxis]] -
|
node->getLayout().measuredDimensions[dim[crossAxis]] -
|
||||||
child->getLayout().measuredDimensions[dim[crossAxis]] -
|
child->getLayout().measuredDimensions[dim[crossAxis]] -
|
||||||
YGNodeTrailingBorder(node, crossAxis) -
|
node->getTrailingBorder(crossAxis) -
|
||||||
child->getTrailingMargin(crossAxis, width) -
|
child->getTrailingMargin(crossAxis, width) -
|
||||||
child->getTrailingPosition(
|
child->getTrailingPosition(
|
||||||
crossAxis, isMainAxisRow ? height : width),
|
crossAxis, isMainAxisRow ? height : width),
|
||||||
@@ -1775,11 +1761,10 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
node->getTrailingMargin(flexColumnDirection, parentWidth), YGEdgeBottom);
|
node->getTrailingMargin(flexColumnDirection, parentWidth), YGEdgeBottom);
|
||||||
|
|
||||||
node->setLayoutBorder(node->getLeadingBorder(flexRowDirection), YGEdgeStart);
|
node->setLayoutBorder(node->getLeadingBorder(flexRowDirection), YGEdgeStart);
|
||||||
node->setLayoutBorder(
|
node->setLayoutBorder(node->getTrailingBorder(flexRowDirection), YGEdgeEnd);
|
||||||
YGNodeTrailingBorder(node, flexRowDirection), YGEdgeEnd);
|
|
||||||
node->setLayoutBorder(node->getLeadingBorder(flexColumnDirection), YGEdgeTop);
|
node->setLayoutBorder(node->getLeadingBorder(flexColumnDirection), YGEdgeTop);
|
||||||
node->setLayoutBorder(
|
node->setLayoutBorder(
|
||||||
YGNodeTrailingBorder(node, flexColumnDirection), YGEdgeBottom);
|
node->getTrailingBorder(flexColumnDirection), YGEdgeBottom);
|
||||||
|
|
||||||
node->setLayoutPadding(
|
node->setLayoutPadding(
|
||||||
YGNodeLeadingPadding(node, flexRowDirection, parentWidth), YGEdgeStart);
|
YGNodeLeadingPadding(node, flexRowDirection, parentWidth), YGEdgeStart);
|
||||||
|
Reference in New Issue
Block a user