Fixing the edge case in Yoga with percentage absolute position and infinite constraint
Summary: Yoga has an edge case that cause layout to return NaN. This happened when we used absolute position with percentage and infinite constraint in that dimension. This diff fixes that case to default to border+padding Reviewed By: emilsjolander Differential Revision: D6199731 fbshipit-source-id: f40ddf00614b2f507848fb35f348a9dfef14b323
This commit is contained in:
committed by
Facebook Github Bot
parent
58d14ee557
commit
bfb4dabf0c
@@ -2892,12 +2892,15 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
||||
// top/left/bottom/right
|
||||
// set, override all the previously computed positions to set it
|
||||
// correctly.
|
||||
if (YGNodeIsLeadingPosDefined(child, crossAxis)) {
|
||||
const bool isChildLeadingPosDefined = YGNodeIsLeadingPosDefined(child, crossAxis);
|
||||
if (isChildLeadingPosDefined) {
|
||||
child->layout.position[pos[crossAxis]] =
|
||||
YGNodeLeadingPosition(child, crossAxis, availableInnerCrossDim) +
|
||||
YGNodeLeadingBorder(node, crossAxis) +
|
||||
YGNodeLeadingMargin(child, crossAxis, availableInnerWidth);
|
||||
} else {
|
||||
}
|
||||
// If leading position is not defined or calculations result in Nan, default to border + margin
|
||||
if (!isChildLeadingPosDefined || YGFloatIsUndefined(child->layout.position[pos[crossAxis]])) {
|
||||
child->layout.position[pos[crossAxis]] =
|
||||
YGNodeLeadingBorder(node, crossAxis) +
|
||||
YGNodeLeadingMargin(child, crossAxis, availableInnerWidth);
|
||||
|
Reference in New Issue
Block a user