@@ -63,16 +63,17 @@ static inline bool styleDefinesDimension(
63
63
const FlexDirection axis,
64
64
const float ownerSize) {
65
65
bool isDefined =
66
- yoga::isDefined ( node->getResolvedDimension (dimension (axis)).value );
66
+ node->getResolvedDimension (dimension (axis)).value (). isDefined ( );
67
67
68
68
auto resolvedDimension = node->getResolvedDimension (dimension (axis));
69
69
return !(
70
- resolvedDimension.unit == YGUnitAuto ||
71
- resolvedDimension.unit == YGUnitUndefined ||
72
- (resolvedDimension.unit == YGUnitPoint && isDefined &&
73
- resolvedDimension.value < 0 .0f ) ||
74
- (resolvedDimension.unit == YGUnitPercent && isDefined &&
75
- (resolvedDimension.value < 0 .0f || yoga::isUndefined (ownerSize))));
70
+ resolvedDimension.unit () == Unit::Auto ||
71
+ resolvedDimension.unit () == Unit::Undefined ||
72
+ (resolvedDimension.unit () == Unit::Point && isDefined &&
73
+ resolvedDimension.value ().unwrap () < 0 .0f ) ||
74
+ (resolvedDimension.unit () == Unit::Percent && isDefined &&
75
+ (resolvedDimension.value ().unwrap () < 0 .0f ||
76
+ yoga::isUndefined (ownerSize))));
76
77
}
77
78
78
79
static inline bool isLayoutDimensionDefined (
@@ -947,9 +948,9 @@ static float distributeFreeSpaceSecondPass(
947
948
sizingModeCrossDim == SizingMode::StretchFit &&
948
949
!(isNodeFlexWrap && mainAxisOverflows) &&
949
950
resolveChildAlignment (node, currentLineChild) == Align::Stretch &&
950
- currentLineChild->getFlexStartMarginValue (crossAxis).unit !=
951
- YGUnitAuto &&
952
- currentLineChild->marginTrailingValue (crossAxis).unit != YGUnitAuto ) {
951
+ currentLineChild->getFlexStartMarginValue (crossAxis).unit () !=
952
+ Unit::Auto &&
953
+ currentLineChild->marginTrailingValue (crossAxis).unit () != Unit::Auto ) {
953
954
childCrossSize = availableInnerCrossDim;
954
955
childCrossSizingMode = SizingMode::StretchFit;
955
956
} else if (!styleDefinesDimension (
@@ -966,8 +967,8 @@ static float distributeFreeSpaceSecondPass(
966
967
.unwrap () +
967
968
marginCross;
968
969
const bool isLoosePercentageMeasurement =
969
- currentLineChild->getResolvedDimension (dimension (crossAxis)).unit ==
970
- YGUnitPercent &&
970
+ currentLineChild->getResolvedDimension (dimension (crossAxis)).unit () ==
971
+ Unit::Percent &&
971
972
sizingModeCrossDim != SizingMode::StretchFit;
972
973
childCrossSizingMode =
973
974
yoga::isUndefined (childCrossSize) || isLoosePercentageMeasurement
@@ -994,9 +995,9 @@ static float distributeFreeSpaceSecondPass(
994
995
!styleDefinesDimension (
995
996
currentLineChild, crossAxis, availableInnerCrossDim) &&
996
997
resolveChildAlignment (node, currentLineChild) == Align::Stretch &&
997
- currentLineChild->getFlexStartMarginValue (crossAxis).unit !=
998
- YGUnitAuto &&
999
- currentLineChild->marginTrailingValue (crossAxis).unit != YGUnitAuto ;
998
+ currentLineChild->getFlexStartMarginValue (crossAxis).unit () !=
999
+ Unit::Auto &&
1000
+ currentLineChild->marginTrailingValue (crossAxis).unit () != Unit::Auto ;
1000
1001
1001
1002
const float childWidth = isMainAxisRow ? childMainSize : childCrossSize;
1002
1003
const float childHeight = !isMainAxisRow ? childMainSize : childCrossSize;
@@ -1243,10 +1244,10 @@ static void justifyMainAxis(
1243
1244
for (size_t i = startOfLineIndex; i < flexLine.endOfLineIndex ; i++) {
1244
1245
auto child = node->getChild (i);
1245
1246
if (child->getStyle ().positionType () != PositionType::Absolute) {
1246
- if (child->getFlexStartMarginValue (mainAxis).unit == YGUnitAuto ) {
1247
+ if (child->getFlexStartMarginValue (mainAxis).unit () == Unit::Auto ) {
1247
1248
numberOfAutoMarginsOnCurrentLine++;
1248
1249
}
1249
- if (child->marginTrailingValue (mainAxis).unit == YGUnitAuto ) {
1250
+ if (child->marginTrailingValue (mainAxis).unit () == Unit::Auto ) {
1250
1251
numberOfAutoMarginsOnCurrentLine++;
1251
1252
}
1252
1253
}
@@ -1323,7 +1324,7 @@ static void justifyMainAxis(
1323
1324
// We need to do that only for relative elements. Absolute elements do not
1324
1325
// take part in that phase.
1325
1326
if (childStyle.positionType () != PositionType::Absolute) {
1326
- if (child->getFlexStartMarginValue (mainAxis).unit == YGUnitAuto ) {
1327
+ if (child->getFlexStartMarginValue (mainAxis).unit () == Unit::Auto ) {
1327
1328
flexLine.layout .mainDim += flexLine.layout .remainingFreeSpace /
1328
1329
static_cast <float >(numberOfAutoMarginsOnCurrentLine);
1329
1330
}
@@ -1339,7 +1340,7 @@ static void justifyMainAxis(
1339
1340
flexLine.layout .mainDim += betweenMainDim;
1340
1341
}
1341
1342
1342
- if (child->marginTrailingValue (mainAxis).unit == YGUnitAuto ) {
1343
+ if (child->marginTrailingValue (mainAxis).unit () == Unit::Auto ) {
1343
1344
flexLine.layout .mainDim += flexLine.layout .remainingFreeSpace /
1344
1345
static_cast <float >(numberOfAutoMarginsOnCurrentLine);
1345
1346
}
@@ -1886,8 +1887,8 @@ static void calculateLayoutImpl(
1886
1887
// time, this time forcing the cross-axis size to be the computed
1887
1888
// cross size for the current line.
1888
1889
if (alignItem == Align::Stretch &&
1889
- child->getFlexStartMarginValue (crossAxis).unit != YGUnitAuto &&
1890
- child->marginTrailingValue (crossAxis).unit != YGUnitAuto ) {
1890
+ child->getFlexStartMarginValue (crossAxis).unit () != Unit::Auto &&
1891
+ child->marginTrailingValue (crossAxis).unit () != Unit::Auto ) {
1891
1892
// If the child defines a definite size for its cross axis, there's
1892
1893
// no need to stretch.
1893
1894
if (!styleDefinesDimension (
@@ -1960,15 +1961,17 @@ static void calculateLayoutImpl(
1960
1961
const float remainingCrossDim = containerCrossAxis -
1961
1962
dimensionWithMargin (child, crossAxis, availableInnerWidth);
1962
1963
1963
- if (child->getFlexStartMarginValue (crossAxis).unit == YGUnitAuto &&
1964
- child->marginTrailingValue (crossAxis).unit == YGUnitAuto) {
1964
+ if (child->getFlexStartMarginValue (crossAxis).unit () ==
1965
+ Unit::Auto &&
1966
+ child->marginTrailingValue (crossAxis).unit () == Unit::Auto) {
1965
1967
leadingCrossDim +=
1966
1968
yoga::maxOrDefined (0 .0f , remainingCrossDim / 2 );
1967
1969
} else if (
1968
- child->marginTrailingValue (crossAxis).unit == YGUnitAuto ) {
1970
+ child->marginTrailingValue (crossAxis).unit () == Unit::Auto ) {
1969
1971
// No-Op
1970
1972
} else if (
1971
- child->getFlexStartMarginValue (crossAxis).unit == YGUnitAuto) {
1973
+ child->getFlexStartMarginValue (crossAxis).unit () ==
1974
+ Unit::Auto) {
1972
1975
leadingCrossDim += yoga::maxOrDefined (0 .0f , remainingCrossDim);
1973
1976
} else if (alignItem == Align::FlexStart) {
1974
1977
// No-Op
0 commit comments