Changed the return type of YGResolveValue
Summary: Changed the return type of YGResolveValue Reviewed By: emilsjolander Differential Revision: D7195099 fbshipit-source-id: 72c4163cd08691cf6e40df05394cc52e83b0de14
This commit is contained in:
committed by
Facebook Github Bot
parent
47ad3f63cf
commit
b3f8851bc2
@@ -53,3 +53,7 @@ bool YGFloatsEqual(const float a, const float b) {
|
|||||||
float YGFloatSanitize(const float& val) {
|
float YGFloatSanitize(const float& val) {
|
||||||
return YGFloatIsUndefined(val) ? 0 : val;
|
return YGFloatIsUndefined(val) ? 0 : val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float YGUnwrapFloatOptional(const YGFloatOptional& op) {
|
||||||
|
return op.isUndefined ? YGUndefined : op.value;
|
||||||
|
}
|
||||||
|
17
yoga/Utils.h
17
yoga/Utils.h
@@ -89,6 +89,11 @@ bool YGFloatArrayEqual(
|
|||||||
// This function returns 0 if YGFloatIsUndefined(val) is true and val otherwise
|
// This function returns 0 if YGFloatIsUndefined(val) is true and val otherwise
|
||||||
float YGFloatSanitize(const float& val);
|
float YGFloatSanitize(const float& val);
|
||||||
|
|
||||||
|
// This function unwraps optional and returns YGUndefined if not defined or
|
||||||
|
// op.value otherwise
|
||||||
|
// TODO: Get rid off this function
|
||||||
|
float YGUnwrapFloatOptional(const YGFloatOptional& op);
|
||||||
|
|
||||||
YGFlexDirection YGFlexDirectionCross(
|
YGFlexDirection YGFlexDirectionCross(
|
||||||
const YGFlexDirection flexDirection,
|
const YGFlexDirection flexDirection,
|
||||||
const YGDirection direction);
|
const YGDirection direction);
|
||||||
@@ -98,17 +103,17 @@ inline bool YGFlexDirectionIsRow(const YGFlexDirection flexDirection) {
|
|||||||
flexDirection == YGFlexDirectionRowReverse;
|
flexDirection == YGFlexDirectionRowReverse;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float YGResolveValue(const YGValue value, const float parentSize) {
|
inline YGFloatOptional YGResolveValue(const YGValue value, const float parentSize) {
|
||||||
switch (value.unit) {
|
switch (value.unit) {
|
||||||
case YGUnitUndefined:
|
case YGUnitUndefined:
|
||||||
case YGUnitAuto:
|
case YGUnitAuto:
|
||||||
return YGUndefined;
|
return {true, 0};
|
||||||
case YGUnitPoint:
|
case YGUnitPoint:
|
||||||
return value.value;
|
return {false, value.value};
|
||||||
case YGUnitPercent:
|
case YGUnitPercent:
|
||||||
return value.value * parentSize * 0.01;
|
return {false, static_cast<float>(value.value * parentSize * 0.01)};
|
||||||
}
|
}
|
||||||
return YGUndefined;
|
return {true, 0};
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool YGFlexDirectionIsColumn(const YGFlexDirection flexDirection) {
|
inline bool YGFlexDirectionIsColumn(const YGFlexDirection flexDirection) {
|
||||||
@@ -133,5 +138,5 @@ inline YGFlexDirection YGResolveFlexDirection(
|
|||||||
static inline float YGResolveValueMargin(
|
static inline float YGResolveValueMargin(
|
||||||
const YGValue value,
|
const YGValue value,
|
||||||
const float parentSize) {
|
const float parentSize) {
|
||||||
return value.unit == YGUnitAuto ? 0 : YGResolveValue(value, parentSize);
|
return value.unit == YGUnitAuto ? 0 : YGUnwrapFloatOptional(YGResolveValue(value, parentSize));
|
||||||
}
|
}
|
||||||
|
@@ -92,7 +92,7 @@ float YGNode::getLeadingPosition(
|
|||||||
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 YGResolveValue(*leadingPosition, axisSize);
|
return YGUnwrapFloatOptional(YGResolveValue(*leadingPosition, axisSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ float YGNode::getLeadingPosition(
|
|||||||
|
|
||||||
return leadingPosition->unit == YGUnitUndefined
|
return leadingPosition->unit == YGUnitUndefined
|
||||||
? 0.0f
|
? 0.0f
|
||||||
: YGResolveValue(*leadingPosition, axisSize);
|
: YGUnwrapFloatOptional(YGResolveValue(*leadingPosition, axisSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
float YGNode::getTrailingPosition(
|
float YGNode::getTrailingPosition(
|
||||||
@@ -111,7 +111,7 @@ float YGNode::getTrailingPosition(
|
|||||||
const YGValue* trailingPosition =
|
const YGValue* trailingPosition =
|
||||||
YGComputedEdgeValue(style_.position, YGEdgeEnd, &YGValueUndefined);
|
YGComputedEdgeValue(style_.position, YGEdgeEnd, &YGValueUndefined);
|
||||||
if (trailingPosition->unit != YGUnitUndefined) {
|
if (trailingPosition->unit != YGUnitUndefined) {
|
||||||
return YGResolveValue(*trailingPosition, axisSize);
|
return YGUnwrapFloatOptional(YGResolveValue(*trailingPosition, axisSize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ float YGNode::getTrailingPosition(
|
|||||||
|
|
||||||
return trailingPosition->unit == YGUnitUndefined
|
return trailingPosition->unit == YGUnitUndefined
|
||||||
? 0.0f
|
? 0.0f
|
||||||
: YGResolveValue(*trailingPosition, axisSize);
|
: YGUnwrapFloatOptional(YGResolveValue(*trailingPosition, axisSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool YGNode::isLeadingPositionDefined(const YGFlexDirection axis) {
|
bool YGNode::isLeadingPositionDefined(const YGFlexDirection axis) {
|
||||||
@@ -653,15 +653,14 @@ float YGNode::getLeadingPadding(
|
|||||||
const float widthSize) {
|
const float widthSize) {
|
||||||
if (YGFlexDirectionIsRow(axis) &&
|
if (YGFlexDirectionIsRow(axis) &&
|
||||||
style_.padding[YGEdgeStart].unit != YGUnitUndefined &&
|
style_.padding[YGEdgeStart].unit != YGUnitUndefined &&
|
||||||
!YGFloatIsUndefined(
|
!YGResolveValue(style_.padding[YGEdgeStart], widthSize).isUndefined &&
|
||||||
YGResolveValue(style_.padding[YGEdgeStart], widthSize)) &&
|
YGUnwrapFloatOptional(YGResolveValue(style_.padding[YGEdgeStart], widthSize)) > 0.0f) {
|
||||||
YGResolveValue(style_.padding[YGEdgeStart], widthSize) > 0.0f) {
|
return YGUnwrapFloatOptional(YGResolveValue(style_.padding[YGEdgeStart], widthSize));
|
||||||
return YGResolveValue(style_.padding[YGEdgeStart], widthSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float resolvedValue = YGResolveValue(
|
float resolvedValue = YGUnwrapFloatOptional(YGResolveValue(
|
||||||
*YGComputedEdgeValue(style_.padding, leading[axis], &YGValueZero),
|
*YGComputedEdgeValue(style_.padding, leading[axis], &YGValueZero),
|
||||||
widthSize);
|
widthSize));
|
||||||
return YGFloatMax(resolvedValue, 0.0f);
|
return YGFloatMax(resolvedValue, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -670,15 +669,14 @@ float YGNode::getTrailingPadding(
|
|||||||
const float widthSize) {
|
const float widthSize) {
|
||||||
if (YGFlexDirectionIsRow(axis) &&
|
if (YGFlexDirectionIsRow(axis) &&
|
||||||
style_.padding[YGEdgeEnd].unit != YGUnitUndefined &&
|
style_.padding[YGEdgeEnd].unit != YGUnitUndefined &&
|
||||||
!YGFloatIsUndefined(
|
!YGResolveValue(style_.padding[YGEdgeEnd], widthSize).isUndefined &&
|
||||||
YGResolveValue(style_.padding[YGEdgeEnd], widthSize)) &&
|
YGUnwrapFloatOptional(YGResolveValue(style_.padding[YGEdgeEnd], widthSize)) >= 0.0f) {
|
||||||
YGResolveValue(style_.padding[YGEdgeEnd], widthSize) >= 0.0f) {
|
return YGUnwrapFloatOptional(YGResolveValue(style_.padding[YGEdgeEnd], widthSize));
|
||||||
return YGResolveValue(style_.padding[YGEdgeEnd], widthSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float resolvedValue = YGResolveValue(
|
float resolvedValue = YGUnwrapFloatOptional(YGResolveValue(
|
||||||
*YGComputedEdgeValue(style_.padding, trailing[axis], &YGValueZero),
|
*YGComputedEdgeValue(style_.padding, trailing[axis], &YGValueZero),
|
||||||
widthSize);
|
widthSize));
|
||||||
|
|
||||||
return YGFloatMax(resolvedValue, 0.0f);
|
return YGFloatMax(resolvedValue, 0.0f);
|
||||||
}
|
}
|
||||||
|
106
yoga/Yoga.cpp
106
yoga/Yoga.cpp
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "Yoga.h"
|
#include "Yoga.h"
|
||||||
|
#include <float.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
@@ -967,15 +968,15 @@ static float YGNodeBoundAxisWithinMinAndMax(const YGNodeRef node,
|
|||||||
float max = YGUndefined;
|
float max = YGUndefined;
|
||||||
|
|
||||||
if (YGFlexDirectionIsColumn(axis)) {
|
if (YGFlexDirectionIsColumn(axis)) {
|
||||||
min = YGResolveValue(
|
min = YGUnwrapFloatOptional(YGResolveValue(
|
||||||
node->getStyle().minDimensions[YGDimensionHeight], axisSize);
|
node->getStyle().minDimensions[YGDimensionHeight], axisSize));
|
||||||
max = YGResolveValue(
|
max = YGUnwrapFloatOptional(YGResolveValue(
|
||||||
node->getStyle().maxDimensions[YGDimensionHeight], axisSize);
|
node->getStyle().maxDimensions[YGDimensionHeight], axisSize));
|
||||||
} else if (YGFlexDirectionIsRow(axis)) {
|
} else if (YGFlexDirectionIsRow(axis)) {
|
||||||
min = YGResolveValue(
|
min = YGUnwrapFloatOptional(YGResolveValue(
|
||||||
node->getStyle().minDimensions[YGDimensionWidth], axisSize);
|
node->getStyle().minDimensions[YGDimensionWidth], axisSize));
|
||||||
max = YGResolveValue(
|
max = YGUnwrapFloatOptional(YGResolveValue(
|
||||||
node->getStyle().maxDimensions[YGDimensionWidth], axisSize);
|
node->getStyle().maxDimensions[YGDimensionWidth], axisSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
float boundValue = value;
|
float boundValue = value;
|
||||||
@@ -1021,8 +1022,8 @@ static void YGConstrainMaxSizeForMode(const YGNodeRef node,
|
|||||||
YGMeasureMode *mode,
|
YGMeasureMode *mode,
|
||||||
float *size) {
|
float *size) {
|
||||||
const float maxSize =
|
const float maxSize =
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(
|
||||||
node->getStyle().maxDimensions[dim[axis]], parentAxisSize) +
|
node->getStyle().maxDimensions[dim[axis]], parentAxisSize)) +
|
||||||
node->getMarginForAxis(axis, parentWidth);
|
node->getMarginForAxis(axis, parentWidth);
|
||||||
switch (*mode) {
|
switch (*mode) {
|
||||||
case YGMeasureModeExactly:
|
case YGMeasureModeExactly:
|
||||||
@@ -1060,7 +1061,7 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node,
|
|||||||
YGMeasureMode childHeightMeasureMode;
|
YGMeasureMode childHeightMeasureMode;
|
||||||
|
|
||||||
const float resolvedFlexBasis =
|
const float resolvedFlexBasis =
|
||||||
YGResolveValue(child->resolveFlexBasisPtr(), mainAxisParentSize);
|
YGUnwrapFloatOptional(YGResolveValue(child->resolveFlexBasisPtr(), mainAxisParentSize));
|
||||||
const bool isRowStyleDimDefined = YGNodeIsStyleDimDefined(child, YGFlexDirectionRow, parentWidth);
|
const bool isRowStyleDimDefined = YGNodeIsStyleDimDefined(child, YGFlexDirectionRow, parentWidth);
|
||||||
const bool isColumnStyleDimDefined =
|
const bool isColumnStyleDimDefined =
|
||||||
YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn, parentHeight);
|
YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn, parentHeight);
|
||||||
@@ -1078,14 +1079,14 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node,
|
|||||||
} else if (isMainAxisRow && isRowStyleDimDefined) {
|
} else if (isMainAxisRow && isRowStyleDimDefined) {
|
||||||
// The width is definite, so use that as the flex basis.
|
// The width is definite, so use that as the flex basis.
|
||||||
child->setLayoutComputedFlexBasis(YGFloatMax(
|
child->setLayoutComputedFlexBasis(YGFloatMax(
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(
|
||||||
child->getResolvedDimension(YGDimensionWidth), parentWidth),
|
child->getResolvedDimension(YGDimensionWidth), parentWidth)),
|
||||||
YGNodePaddingAndBorderForAxis(child, YGFlexDirectionRow, parentWidth)));
|
YGNodePaddingAndBorderForAxis(child, YGFlexDirectionRow, parentWidth)));
|
||||||
} else if (!isMainAxisRow && isColumnStyleDimDefined) {
|
} else if (!isMainAxisRow && isColumnStyleDimDefined) {
|
||||||
// The height is definite, so use that as the flex basis.
|
// The height is definite, so use that as the flex basis.
|
||||||
child->setLayoutComputedFlexBasis(YGFloatMax(
|
child->setLayoutComputedFlexBasis(YGFloatMax(
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(
|
||||||
child->getResolvedDimension(YGDimensionHeight), parentHeight),
|
child->getResolvedDimension(YGDimensionHeight), parentHeight)),
|
||||||
YGNodePaddingAndBorderForAxis(
|
YGNodePaddingAndBorderForAxis(
|
||||||
child, YGFlexDirectionColumn, parentWidth)));
|
child, YGFlexDirectionColumn, parentWidth)));
|
||||||
} else {
|
} else {
|
||||||
@@ -1103,15 +1104,15 @@ static void YGNodeComputeFlexBasisForChild(const YGNodeRef node,
|
|||||||
|
|
||||||
if (isRowStyleDimDefined) {
|
if (isRowStyleDimDefined) {
|
||||||
childWidth =
|
childWidth =
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(
|
||||||
child->getResolvedDimension(YGDimensionWidth), parentWidth) +
|
child->getResolvedDimension(YGDimensionWidth), parentWidth)) +
|
||||||
marginRow;
|
marginRow;
|
||||||
childWidthMeasureMode = YGMeasureModeExactly;
|
childWidthMeasureMode = YGMeasureModeExactly;
|
||||||
}
|
}
|
||||||
if (isColumnStyleDimDefined) {
|
if (isColumnStyleDimDefined) {
|
||||||
childHeight =
|
childHeight =
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(
|
||||||
child->getResolvedDimension(YGDimensionHeight), parentHeight) +
|
child->getResolvedDimension(YGDimensionHeight), parentHeight)) +
|
||||||
marginColumn;
|
marginColumn;
|
||||||
childHeightMeasureMode = YGMeasureModeExactly;
|
childHeightMeasureMode = YGMeasureModeExactly;
|
||||||
}
|
}
|
||||||
@@ -1228,7 +1229,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||||||
|
|
||||||
if (YGNodeIsStyleDimDefined(child, YGFlexDirectionRow, width)) {
|
if (YGNodeIsStyleDimDefined(child, YGFlexDirectionRow, width)) {
|
||||||
childWidth =
|
childWidth =
|
||||||
YGResolveValue(child->getResolvedDimension(YGDimensionWidth), width) +
|
YGUnwrapFloatOptional(YGResolveValue(child->getResolvedDimension(YGDimensionWidth), width)) +
|
||||||
marginRow;
|
marginRow;
|
||||||
} else {
|
} else {
|
||||||
// If the child doesn't have a specified width, compute the width based
|
// If the child doesn't have a specified width, compute the width based
|
||||||
@@ -1247,7 +1248,7 @@ static void YGNodeAbsoluteLayoutChild(const YGNodeRef node,
|
|||||||
|
|
||||||
if (YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn, height)) {
|
if (YGNodeIsStyleDimDefined(child, YGFlexDirectionColumn, height)) {
|
||||||
childHeight =
|
childHeight =
|
||||||
YGResolveValue(child->getResolvedDimension(YGDimensionHeight), height) +
|
YGUnwrapFloatOptional(YGResolveValue(child->getResolvedDimension(YGDimensionHeight), height)) +
|
||||||
marginColumn;
|
marginColumn;
|
||||||
} else {
|
} else {
|
||||||
// If the child doesn't have a specified height, compute the height
|
// If the child doesn't have a specified height, compute the height
|
||||||
@@ -1584,15 +1585,14 @@ static float YGNodeCalculateAvailableInnerDim(
|
|||||||
if (!YGFloatIsUndefined(availableInnerDim)) {
|
if (!YGFloatIsUndefined(availableInnerDim)) {
|
||||||
// We want to make sure our available height does not violate min and max
|
// We want to make sure our available height does not violate min and max
|
||||||
// constraints
|
// constraints
|
||||||
const float minInnerDim =
|
const YGFloatOptional minDimensionOptional = YGResolveValue(node->getStyle().minDimensions[dimension], parentDim);
|
||||||
YGFloatIsUndefined(YGResolveValue(
|
const float minInnerDim = minDimensionOptional.isUndefined
|
||||||
node->getStyle().minDimensions[dimension], parentDim))
|
|
||||||
? 0.0f
|
? 0.0f
|
||||||
: YGResolveValue(node->getStyle().minDimensions[dimension], parentDim) -
|
: minDimensionOptional.value - paddingAndBorder;
|
||||||
paddingAndBorder;
|
|
||||||
const float maxInnerDim =
|
const YGFloatOptional maxDimensionOptional = YGResolveValue(node->getStyle().maxDimensions[dimension], parentDim) ;
|
||||||
YGResolveValue(node->getStyle().maxDimensions[dimension], parentDim) -
|
|
||||||
paddingAndBorder;
|
const float maxInnerDim = maxDimensionOptional.isUndefined ? FLT_MAX : maxDimensionOptional.value - paddingAndBorder;
|
||||||
availableInnerDim =
|
availableInnerDim =
|
||||||
YGFloatMax(YGFloatMin(availableInnerDim, maxInnerDim), minInnerDim);
|
YGFloatMax(YGFloatMin(availableInnerDim, maxInnerDim), minInnerDim);
|
||||||
}
|
}
|
||||||
@@ -1881,9 +1881,9 @@ static float YGDistributeFreeSpaceSecondPass(
|
|||||||
: YGMeasureModeAtMost;
|
: YGMeasureModeAtMost;
|
||||||
} else {
|
} else {
|
||||||
childCrossSize =
|
childCrossSize =
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(
|
||||||
currentRelativeChild->getResolvedDimension(dim[crossAxis]),
|
currentRelativeChild->getResolvedDimension(dim[crossAxis]),
|
||||||
availableInnerCrossDim) +
|
availableInnerCrossDim)) +
|
||||||
marginCross;
|
marginCross;
|
||||||
const bool isLoosePercentageMeasurement =
|
const bool isLoosePercentageMeasurement =
|
||||||
currentRelativeChild->getResolvedDimension(dim[crossAxis]).unit ==
|
currentRelativeChild->getResolvedDimension(dim[crossAxis]).unit ==
|
||||||
@@ -2124,12 +2124,11 @@ static void YGJustifyMainAxis(
|
|||||||
if (measureModeMainDim == YGMeasureModeAtMost &&
|
if (measureModeMainDim == YGMeasureModeAtMost &&
|
||||||
collectedFlexItemsValues.remainingFreeSpace > 0) {
|
collectedFlexItemsValues.remainingFreeSpace > 0) {
|
||||||
if (style.minDimensions[dim[mainAxis]].unit != YGUnitUndefined &&
|
if (style.minDimensions[dim[mainAxis]].unit != YGUnitUndefined &&
|
||||||
!YGFloatIsUndefined(YGResolveValue(
|
!YGResolveValue(style.minDimensions[dim[mainAxis]], mainAxisParentSize).isUndefined) {
|
||||||
style.minDimensions[dim[mainAxis]], mainAxisParentSize))) {
|
|
||||||
collectedFlexItemsValues.remainingFreeSpace = YGFloatMax(
|
collectedFlexItemsValues.remainingFreeSpace = YGFloatMax(
|
||||||
0,
|
0,
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(
|
||||||
style.minDimensions[dim[mainAxis]], mainAxisParentSize) -
|
style.minDimensions[dim[mainAxis]], mainAxisParentSize)) -
|
||||||
(availableInnerMainDim -
|
(availableInnerMainDim -
|
||||||
collectedFlexItemsValues.remainingFreeSpace));
|
collectedFlexItemsValues.remainingFreeSpace));
|
||||||
} else {
|
} else {
|
||||||
@@ -2487,20 +2486,17 @@ static void YGNodelayoutImpl(const YGNodeRef node,
|
|||||||
node->getMarginForAxis(YGFlexDirectionColumn, parentWidth);
|
node->getMarginForAxis(YGFlexDirectionColumn, parentWidth);
|
||||||
|
|
||||||
const float minInnerWidth =
|
const float minInnerWidth =
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(node->getStyle().minDimensions[YGDimensionWidth], parentWidth)) -
|
||||||
node->getStyle().minDimensions[YGDimensionWidth], parentWidth) -
|
|
||||||
paddingAndBorderAxisRow;
|
paddingAndBorderAxisRow;
|
||||||
const float maxInnerWidth =
|
const float maxInnerWidth =
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(node->getStyle().maxDimensions[YGDimensionWidth], parentWidth)) -
|
||||||
node->getStyle().maxDimensions[YGDimensionWidth], parentWidth) -
|
|
||||||
paddingAndBorderAxisRow;
|
paddingAndBorderAxisRow;
|
||||||
const float minInnerHeight =
|
const float minInnerHeight =
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(node->getStyle().minDimensions[YGDimensionHeight], parentHeight)) -
|
||||||
node->getStyle().minDimensions[YGDimensionHeight], parentHeight) -
|
|
||||||
paddingAndBorderAxisColumn;
|
paddingAndBorderAxisColumn;
|
||||||
const float maxInnerHeight =
|
const float maxInnerHeight =
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(
|
||||||
node->getStyle().maxDimensions[YGDimensionHeight], parentHeight) -
|
node->getStyle().maxDimensions[YGDimensionHeight], parentHeight)) -
|
||||||
paddingAndBorderAxisColumn;
|
paddingAndBorderAxisColumn;
|
||||||
|
|
||||||
const float minInnerMainDim = isMainAxisRow ? minInnerWidth : minInnerHeight;
|
const float minInnerMainDim = isMainAxisRow ? minInnerWidth : minInnerHeight;
|
||||||
@@ -3629,15 +3625,15 @@ void YGNodeCalculateLayout(
|
|||||||
YGMeasureMode widthMeasureMode = YGMeasureModeUndefined;
|
YGMeasureMode widthMeasureMode = YGMeasureModeUndefined;
|
||||||
if (YGNodeIsStyleDimDefined(node, YGFlexDirectionRow, parentWidth)) {
|
if (YGNodeIsStyleDimDefined(node, YGFlexDirectionRow, parentWidth)) {
|
||||||
width =
|
width =
|
||||||
YGResolveValue(
|
YGUnwrapFloatOptional(YGResolveValue(
|
||||||
node->getResolvedDimension(dim[YGFlexDirectionRow]), parentWidth) +
|
node->getResolvedDimension(dim[YGFlexDirectionRow]), parentWidth)) +
|
||||||
node->getMarginForAxis(YGFlexDirectionRow, parentWidth);
|
node->getMarginForAxis(YGFlexDirectionRow, parentWidth);
|
||||||
widthMeasureMode = YGMeasureModeExactly;
|
widthMeasureMode = YGMeasureModeExactly;
|
||||||
} else if (!YGFloatIsUndefined(YGResolveValue(
|
} else if (!YGResolveValue(
|
||||||
node->getStyle().maxDimensions[YGDimensionWidth],
|
node->getStyle().maxDimensions[YGDimensionWidth],
|
||||||
parentWidth))) {
|
parentWidth).isUndefined) {
|
||||||
width = YGResolveValue(
|
width = YGUnwrapFloatOptional(YGResolveValue(
|
||||||
node->getStyle().maxDimensions[YGDimensionWidth], parentWidth);
|
node->getStyle().maxDimensions[YGDimensionWidth], parentWidth));
|
||||||
widthMeasureMode = YGMeasureModeAtMost;
|
widthMeasureMode = YGMeasureModeAtMost;
|
||||||
} else {
|
} else {
|
||||||
width = parentWidth;
|
width = parentWidth;
|
||||||
@@ -3648,16 +3644,14 @@ void YGNodeCalculateLayout(
|
|||||||
float height = YGUndefined;
|
float height = YGUndefined;
|
||||||
YGMeasureMode heightMeasureMode = YGMeasureModeUndefined;
|
YGMeasureMode heightMeasureMode = YGMeasureModeUndefined;
|
||||||
if (YGNodeIsStyleDimDefined(node, YGFlexDirectionColumn, parentHeight)) {
|
if (YGNodeIsStyleDimDefined(node, YGFlexDirectionColumn, parentHeight)) {
|
||||||
height = YGResolveValue(
|
height = YGUnwrapFloatOptional(YGResolveValue(
|
||||||
node->getResolvedDimension(dim[YGFlexDirectionColumn]),
|
node->getResolvedDimension(dim[YGFlexDirectionColumn]),
|
||||||
parentHeight) +
|
parentHeight)) +
|
||||||
node->getMarginForAxis(YGFlexDirectionColumn, parentWidth);
|
node->getMarginForAxis(YGFlexDirectionColumn, parentWidth);
|
||||||
heightMeasureMode = YGMeasureModeExactly;
|
heightMeasureMode = YGMeasureModeExactly;
|
||||||
} else if (!YGFloatIsUndefined(YGResolveValue(
|
} else if (!YGResolveValue(node->getStyle().maxDimensions[YGDimensionHeight],
|
||||||
node->getStyle().maxDimensions[YGDimensionHeight],
|
parentHeight).isUndefined) {
|
||||||
parentHeight))) {
|
height = YGUnwrapFloatOptional(YGResolveValue(node->getStyle().maxDimensions[YGDimensionHeight], parentHeight));
|
||||||
height = YGResolveValue(
|
|
||||||
node->getStyle().maxDimensions[YGDimensionHeight], parentHeight);
|
|
||||||
heightMeasureMode = YGMeasureModeAtMost;
|
heightMeasureMode = YGMeasureModeAtMost;
|
||||||
} else {
|
} else {
|
||||||
height = parentHeight;
|
height = parentHeight;
|
||||||
|
Reference in New Issue
Block a user