@@ -457,21 +457,6 @@ void YGNodeCopyStyle(const YGNodeRef dstNode, const YGNodeRef srcNode) {
457
457
}
458
458
}
459
459
460
- static inline float YGResolveFlexGrow (const YGNodeRef node) {
461
- // Root nodes flexGrow should always be 0
462
- if (node->getParent () == nullptr ) {
463
- return 0.0 ;
464
- }
465
- if (!YGFloatIsUndefined (node->getStyle ().flexGrow )) {
466
- return node->getStyle ().flexGrow ;
467
- }
468
- if (!YGFloatIsUndefined (node->getStyle ().flex ) &&
469
- node->getStyle ().flex > 0 .0f ) {
470
- return node->getStyle ().flex ;
471
- }
472
- return kDefaultFlexGrow ;
473
- }
474
-
475
460
float YGNodeStyleGetFlexGrow (const YGNodeRef node) {
476
461
return YGFloatIsUndefined (node->getStyle ().flexGrow )
477
462
? kDefaultFlexGrow
@@ -1036,7 +1021,7 @@ static YGFlexDirection YGFlexDirectionCross(const YGFlexDirection flexDirection,
1036
1021
static inline bool YGNodeIsFlex (const YGNodeRef node) {
1037
1022
return (
1038
1023
node->getStyle ().positionType == YGPositionTypeRelative &&
1039
- (YGResolveFlexGrow ( node) != 0 || YGNodeResolveFlexShrink (node) != 0 ));
1024
+ (node-> resolveFlexGrow ( ) != 0 || YGNodeResolveFlexShrink (node) != 0 ));
1040
1025
}
1041
1026
1042
1027
static bool YGIsBaselineLayout (const YGNodeRef node) {
@@ -2041,7 +2026,9 @@ static void YGNodelayoutImpl(const YGNodeRef node,
2041
2026
singleFlexChild = nullptr ;
2042
2027
break ;
2043
2028
}
2044
- } else if (YGResolveFlexGrow (child) > 0 .0f && YGNodeResolveFlexShrink (child) > 0 .0f ) {
2029
+ } else if (
2030
+ child->resolveFlexGrow () > 0 .0f &&
2031
+ YGNodeResolveFlexShrink (child) > 0 .0f ) {
2045
2032
singleFlexChild = child;
2046
2033
}
2047
2034
}
@@ -2186,7 +2173,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
2186
2173
itemsOnLine++;
2187
2174
2188
2175
if (YGNodeIsFlex (child)) {
2189
- totalFlexGrowFactors += YGResolveFlexGrow ( child);
2176
+ totalFlexGrowFactors += child-> resolveFlexGrow ( );
2190
2177
2191
2178
// Unlike the grow factor, the shrink factor is scaled relative to the child dimension.
2192
2179
totalFlexShrinkScaledFactors += -YGNodeResolveFlexShrink (child) *
@@ -2240,7 +2227,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
2240
2227
availableInnerMainDim = maxInnerMainDim;
2241
2228
} else {
2242
2229
if (!node->getConfig ()->useLegacyStretchBehaviour &&
2243
- (totalFlexGrowFactors == 0 || YGResolveFlexGrow ( node) == 0 )) {
2230
+ (totalFlexGrowFactors == 0 || node-> resolveFlexGrow ( ) == 0 )) {
2244
2231
// If we don't have any children to flex or we can't flex the node itself,
2245
2232
// space we've used is all space we need. Root node also should be shrunk to minimum
2246
2233
availableInnerMainDim = sizeConsumedOnCurrentLine;
@@ -2333,7 +2320,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
2333
2320
}
2334
2321
}
2335
2322
} else if (remainingFreeSpace > 0 ) {
2336
- flexGrowFactor = YGResolveFlexGrow ( currentRelativeChild);
2323
+ flexGrowFactor = currentRelativeChild-> resolveFlexGrow ( );
2337
2324
2338
2325
// Is this child able to grow?
2339
2326
if (flexGrowFactor != 0 ) {
@@ -2402,7 +2389,7 @@ static void YGNodelayoutImpl(const YGNodeRef node,
2402
2389
availableInnerWidth);
2403
2390
}
2404
2391
} else if (remainingFreeSpace > 0 ) {
2405
- flexGrowFactor = YGResolveFlexGrow ( currentRelativeChild);
2392
+ flexGrowFactor = currentRelativeChild-> resolveFlexGrow ( );
2406
2393
2407
2394
// Is this child able to grow?
2408
2395
if (flexGrowFactor != 0 ) {
0 commit comments