Moved getTrailingPosition function as a method on YGNode

Summary: Moved getTrailingPosition function as a method on YGNode

Reviewed By: emilsjolander

Differential Revision: D6683205

fbshipit-source-id: d30003d90d634c644d92c833e58165b073d4d13e
This commit is contained in:
Pritesh Nandgaonkar
2018-01-11 04:47:41 -08:00
committed by Facebook Github Bot
parent b985b6c377
commit 681b580fd8
3 changed files with 27 additions and 26 deletions

View File

@@ -102,6 +102,25 @@ float YGNode::getLeadingPosition(
: YGResolveValue(*leadingPosition, axisSize);
}
float YGNode::getTrailingPosition(
const YGFlexDirection axis,
const float axisSize) {
if (YGFlexDirectionIsRow(axis)) {
const YGValue* trailingPosition =
YGComputedEdgeValue(style_.position, YGEdgeEnd, &YGValueUndefined);
if (trailingPosition->unit != YGUnitUndefined) {
return YGResolveValue(*trailingPosition, axisSize);
}
}
const YGValue* trailingPosition =
YGComputedEdgeValue(style_.position, trailing[axis], &YGValueUndefined);
return trailingPosition->unit == YGUnitUndefined
? 0.0f
: YGResolveValue(*trailingPosition, axisSize);
}
bool YGNode::isLeadingPositionDefined(const YGFlexDirection axis) {
return (YGFlexDirectionIsRow(axis) &&
YGComputedEdgeValue(style_.position, YGEdgeStart, &YGValueUndefined)