@@ -49,6 +49,7 @@ typedef struct CSSLayout {
4949 float dimensions [2 ];
5050 CSSDirection direction ;
5151
52+ uint32_t computedFlexBasisGeneration ;
5253 float computedFlexBasis ;
5354
5455 // Instead of recomputing the entire layout every single time, we
@@ -967,7 +968,8 @@ static void computeChildFlexBasis(const CSSNodeRef node,
967968
968969 if (!CSSValueIsUndefined (CSSNodeStyleGetFlexBasis (child )) &&
969970 !CSSValueIsUndefined (isMainAxisRow ? width : height )) {
970- if (CSSValueIsUndefined (child -> layout .computedFlexBasis )) {
971+ if (CSSValueIsUndefined (child -> layout .computedFlexBasis ) ||
972+ child -> layout .computedFlexBasisGeneration != gCurrentGenerationCount ) {
971973 child -> layout .computedFlexBasis =
972974 fmaxf (CSSNodeStyleGetFlexBasis (child ), getPaddingAndBorderAxis (child , mainAxis ));
973975 }
@@ -1052,6 +1054,8 @@ static void computeChildFlexBasis(const CSSNodeRef node,
10521054 : child -> layout .measuredDimensions [CSSDimensionHeight ],
10531055 getPaddingAndBorderAxis (child , mainAxis ));
10541056 }
1057+
1058+ child -> layout .computedFlexBasisGeneration = gCurrentGenerationCount ;
10551059}
10561060
10571061static void absoluteLayoutChild (const CSSNodeRef node ,
@@ -1477,6 +1481,7 @@ static void layoutNodeImpl(const CSSNodeRef node,
14771481 child -> nextChild = NULL ;
14781482 } else {
14791483 if (child == singleFlexChild ) {
1484+ child -> layout .computedFlexBasisGeneration = gCurrentGenerationCount ;
14801485 child -> layout .computedFlexBasis = 0 ;
14811486 } else {
14821487 computeChildFlexBasis (node ,
@@ -1813,8 +1818,8 @@ static void layoutNodeImpl(const CSSNodeRef node,
18131818 if (!CSSValueIsUndefined (node -> style .minDimensions [dim [mainAxis ]]) &&
18141819 node -> style .minDimensions [dim [mainAxis ]] >= 0 ) {
18151820 remainingFreeSpace = fmaxf (0 ,
1816- node -> style .minDimensions [dim [mainAxis ]] -
1817- (availableInnerMainDim - remainingFreeSpace ));
1821+ node -> style .minDimensions [dim [mainAxis ]] -
1822+ (availableInnerMainDim - remainingFreeSpace ));
18181823 } else {
18191824 remainingFreeSpace = 0 ;
18201825 }
@@ -2542,10 +2547,9 @@ void CSSLayoutSetMemoryFuncs(CSSMalloc cssMalloc,
25422547 CSSCalloc cssCalloc ,
25432548 CSSRealloc cssRealloc ,
25442549 CSSFree cssFree ) {
2545- CSS_ASSERT (gNodeInstanceCount == 0 ,
2546- "Cannot set memory functions: all node must be freed first" );
2550+ CSS_ASSERT (gNodeInstanceCount == 0 , "Cannot set memory functions: all node must be freed first" );
25472551 CSS_ASSERT ((cssMalloc == NULL && cssCalloc == NULL && cssRealloc == NULL && cssFree == NULL ) ||
2548- (cssMalloc != NULL && cssCalloc != NULL && cssRealloc != NULL && cssFree != NULL ),
2552+ (cssMalloc != NULL && cssCalloc != NULL && cssRealloc != NULL && cssFree != NULL ),
25492553 "Cannot set memory functions: functions must be all NULL or Non-NULL" );
25502554
25512555 if (cssMalloc == NULL || cssCalloc == NULL || cssRealloc == NULL || cssFree == NULL ) {
0 commit comments