Changed the type of return value of getLeadingPosition to YGFloatOptional
Summary: Changed the type of return value of getLeadingPosition to YGFloatOptional Reviewed By: emilsjolander Differential Revision: D7344367 fbshipit-source-id: 0f5a667ca357b2ce056c86763aa3e9e4c54b82f0
This commit is contained in:
committed by
Facebook Github Bot
parent
5b109578d3
commit
572546088f
@@ -85,14 +85,14 @@ std::array<YGValue, 2> YGNode::getResolvedDimensions() const {
|
|||||||
return resolvedDimensions_;
|
return resolvedDimensions_;
|
||||||
}
|
}
|
||||||
|
|
||||||
float YGNode::getLeadingPosition(
|
YGFloatOptional YGNode::getLeadingPosition(
|
||||||
const YGFlexDirection axis,
|
const YGFlexDirection& axis,
|
||||||
const float axisSize) const {
|
const float& axisSize) const {
|
||||||
if (YGFlexDirectionIsRow(axis)) {
|
if (YGFlexDirectionIsRow(axis)) {
|
||||||
const YGValue* leadingPosition =
|
const YGValue* leadingPosition =
|
||||||
YGComputedEdgeValue(style_.position, YGEdgeStart, &YGValueUndefined);
|
YGComputedEdgeValue(style_.position, YGEdgeStart, &YGValueUndefined);
|
||||||
if (leadingPosition->unit != YGUnitUndefined) {
|
if (leadingPosition->unit != YGUnitUndefined) {
|
||||||
return YGUnwrapFloatOptional(YGResolveValue(*leadingPosition, axisSize));
|
return YGResolveValue(*leadingPosition, axisSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,8 +100,8 @@ float YGNode::getLeadingPosition(
|
|||||||
YGComputedEdgeValue(style_.position, leading[axis], &YGValueUndefined);
|
YGComputedEdgeValue(style_.position, leading[axis], &YGValueUndefined);
|
||||||
|
|
||||||
return leadingPosition->unit == YGUnitUndefined
|
return leadingPosition->unit == YGUnitUndefined
|
||||||
? 0.0f
|
? YGFloatOptional(0)
|
||||||
: YGUnwrapFloatOptional(YGResolveValue(*leadingPosition, axisSize));
|
: YGResolveValue(*leadingPosition, axisSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
float YGNode::getTrailingPosition(
|
float YGNode::getTrailingPosition(
|
||||||
@@ -343,8 +343,9 @@ void YGNode::setLayoutDimension(float dimension, int index) {
|
|||||||
float YGNode::relativePosition(
|
float YGNode::relativePosition(
|
||||||
const YGFlexDirection axis,
|
const YGFlexDirection axis,
|
||||||
const float axisSize) {
|
const float axisSize) {
|
||||||
return isLeadingPositionDefined(axis) ? getLeadingPosition(axis, axisSize)
|
return isLeadingPositionDefined(axis)
|
||||||
: -getTrailingPosition(axis, axisSize);
|
? YGUnwrapFloatOptional(getLeadingPosition(axis, axisSize))
|
||||||
|
: -getTrailingPosition(axis, axisSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
void YGNode::setPosition(
|
void YGNode::setPosition(
|
||||||
|
@@ -85,7 +85,8 @@ struct YGNode {
|
|||||||
YGValue getResolvedDimension(int index);
|
YGValue getResolvedDimension(int index);
|
||||||
|
|
||||||
// Methods related to positions, margin, padding and border
|
// Methods related to positions, margin, padding and border
|
||||||
float getLeadingPosition(const YGFlexDirection axis, const float axisSize) const;
|
YGFloatOptional getLeadingPosition(const YGFlexDirection& axis,
|
||||||
|
const float& axisSize) const;
|
||||||
bool isLeadingPositionDefined(const YGFlexDirection axis) const;
|
bool isLeadingPositionDefined(const YGFlexDirection axis) const;
|
||||||
bool isTrailingPosDefined(const YGFlexDirection axis) const;
|
bool isTrailingPosDefined(const YGFlexDirection axis) const;
|
||||||
float getTrailingPosition(const YGFlexDirection axis, const float axisSize) const;
|
float getTrailingPosition(const YGFlexDirection axis, const float axisSize) const;
|
||||||
|
@@ -1408,7 +1408,8 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||||||
childWidth = node->getLayout().measuredDimensions[YGDimensionWidth] -
|
childWidth = node->getLayout().measuredDimensions[YGDimensionWidth] -
|
||||||
(node->getLeadingBorder(YGFlexDirectionRow) +
|
(node->getLeadingBorder(YGFlexDirectionRow) +
|
||||||
node->getTrailingBorder(YGFlexDirectionRow)) -
|
node->getTrailingBorder(YGFlexDirectionRow)) -
|
||||||
(child->getLeadingPosition(YGFlexDirectionRow, width) +
|
(YGUnwrapFloatOptional(
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
@@ -1427,7 +1428,8 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||||||
childHeight = node->getLayout().measuredDimensions[YGDimensionHeight] -
|
childHeight = node->getLayout().measuredDimensions[YGDimensionHeight] -
|
||||||
(node->getLeadingBorder(YGFlexDirectionColumn) +
|
(node->getLeadingBorder(YGFlexDirectionColumn) +
|
||||||
node->getTrailingBorder(YGFlexDirectionColumn)) -
|
node->getTrailingBorder(YGFlexDirectionColumn)) -
|
||||||
(child->getLeadingPosition(YGFlexDirectionColumn, height) +
|
(YGUnwrapFloatOptional(
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
@@ -2390,7 +2392,8 @@ static void YGJustifyMainAxis(
|
|||||||
// defined, we override the position to whatever the user said
|
// defined, we override the position to whatever the user said
|
||||||
// (and margin/border).
|
// (and margin/border).
|
||||||
child->setLayoutPosition(
|
child->setLayoutPosition(
|
||||||
child->getLeadingPosition(mainAxis, availableInnerMainDim) +
|
YGUnwrapFloatOptional(
|
||||||
|
child->getLeadingPosition(mainAxis, availableInnerMainDim)) +
|
||||||
node->getLeadingBorder(mainAxis) +
|
node->getLeadingBorder(mainAxis) +
|
||||||
child->getLeadingMargin(mainAxis, availableInnerWidth),
|
child->getLeadingMargin(mainAxis, availableInnerWidth),
|
||||||
pos[mainAxis]);
|
pos[mainAxis]);
|
||||||
@@ -2893,7 +2896,8 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
child->isLeadingPositionDefined(crossAxis);
|
child->isLeadingPositionDefined(crossAxis);
|
||||||
if (isChildLeadingPosDefined) {
|
if (isChildLeadingPosDefined) {
|
||||||
child->setLayoutPosition(
|
child->setLayoutPosition(
|
||||||
child->getLeadingPosition(crossAxis, availableInnerCrossDim) +
|
YGUnwrapFloatOptional(child->getLeadingPosition(
|
||||||
|
crossAxis, availableInnerCrossDim)) +
|
||||||
node->getLeadingBorder(crossAxis) +
|
node->getLeadingBorder(crossAxis) +
|
||||||
child->getLeadingMargin(crossAxis, availableInnerWidth),
|
child->getLeadingMargin(crossAxis, availableInnerWidth),
|
||||||
pos[crossAxis]);
|
pos[crossAxis]);
|
||||||
@@ -3178,8 +3182,8 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
case YGAlignBaseline: {
|
case YGAlignBaseline: {
|
||||||
child->setLayoutPosition(
|
child->setLayoutPosition(
|
||||||
currentLead + maxAscentForCurrentLine - YGBaseline(child) +
|
currentLead + maxAscentForCurrentLine - YGBaseline(child) +
|
||||||
child->getLeadingPosition(
|
YGUnwrapFloatOptional(child->getLeadingPosition(
|
||||||
YGFlexDirectionColumn, availableInnerCrossDim),
|
YGFlexDirectionColumn, availableInnerCrossDim)),
|
||||||
YGEdgeTop);
|
YGEdgeTop);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user