77 */
88
99// NOTE: this file is auto-copied from https://github.com/facebook/css-layout
10- // @generated SignedSource<<dcc87213906997ff353adb1148c8e77c >>
10+ // @generated SignedSource<<df03fd95c4520badeed398c76e70242d >>
1111
1212package com .facebook .csslayout ;
1313
@@ -258,7 +258,7 @@ private static void layoutNodeImpl(
258258 float paddingAndBorderAxisColumn = ((node .style .padding .getWithFallback (leadingSpacing [CSS_FLEX_DIRECTION_COLUMN ], leading [CSS_FLEX_DIRECTION_COLUMN ]) + node .style .border .getWithFallback (leadingSpacing [CSS_FLEX_DIRECTION_COLUMN ], leading [CSS_FLEX_DIRECTION_COLUMN ])) + (node .style .padding .getWithFallback (trailingSpacing [CSS_FLEX_DIRECTION_COLUMN ], trailing [CSS_FLEX_DIRECTION_COLUMN ]) + node .style .border .getWithFallback (trailingSpacing [CSS_FLEX_DIRECTION_COLUMN ], trailing [CSS_FLEX_DIRECTION_COLUMN ])));
259259
260260 if (isMeasureDefined (node )) {
261- boolean isResolvedRowDimDefined = ( !Float .isNaN (node .layout .dimensions [dim [resolvedRowAxis ]]) && node . layout . dimensions [ dim [ resolvedRowAxis ]] >= 0.0 );
261+ boolean isResolvedRowDimDefined = !Float .isNaN (node .layout .dimensions [dim [resolvedRowAxis ]]);
262262
263263 float width = CSSConstants .UNDEFINED ;
264264 if ((!Float .isNaN (node .style .dimensions [dim [resolvedRowAxis ]]) && node .style .dimensions [dim [resolvedRowAxis ]] >= 0.0 )) {
@@ -274,7 +274,7 @@ private static void layoutNodeImpl(
274274 float height = CSSConstants .UNDEFINED ;
275275 if ((!Float .isNaN (node .style .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]]) && node .style .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]] >= 0.0 )) {
276276 height = node .style .dimensions [DIMENSION_HEIGHT ];
277- } else if (( !Float .isNaN (node .layout .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]]) && node . layout . dimensions [ dim [ CSS_FLEX_DIRECTION_COLUMN ]] >= 0.0 )) {
277+ } else if (!Float .isNaN (node .layout .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]])) {
278278 height = node .layout .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]];
279279 } else {
280280 height = parentMaxHeight -
@@ -320,8 +320,8 @@ private static void layoutNodeImpl(
320320 float paddingAndBorderAxisMain = ((node .style .padding .getWithFallback (leadingSpacing [mainAxis ], leading [mainAxis ]) + node .style .border .getWithFallback (leadingSpacing [mainAxis ], leading [mainAxis ])) + (node .style .padding .getWithFallback (trailingSpacing [mainAxis ], trailing [mainAxis ]) + node .style .border .getWithFallback (trailingSpacing [mainAxis ], trailing [mainAxis ])));
321321 float paddingAndBorderAxisCross = ((node .style .padding .getWithFallback (leadingSpacing [crossAxis ], leading [crossAxis ]) + node .style .border .getWithFallback (leadingSpacing [crossAxis ], leading [crossAxis ])) + (node .style .padding .getWithFallback (trailingSpacing [crossAxis ], trailing [crossAxis ]) + node .style .border .getWithFallback (trailingSpacing [crossAxis ], trailing [crossAxis ])));
322322
323- boolean isMainDimDefined = ( !Float .isNaN (node .layout .dimensions [dim [mainAxis ]]) && node . layout . dimensions [ dim [ mainAxis ]] >= 0.0 );
324- boolean isCrossDimDefined = ( !Float .isNaN (node .layout .dimensions [dim [crossAxis ]]) && node . layout . dimensions [ dim [ crossAxis ]] >= 0.0 );
323+ boolean isMainDimDefined = !Float .isNaN (node .layout .dimensions [dim [mainAxis ]]);
324+ boolean isCrossDimDefined = !Float .isNaN (node .layout .dimensions [dim [crossAxis ]]);
325325 boolean isMainRowDirection = (mainAxis == CSS_FLEX_DIRECTION_ROW || mainAxis == CSS_FLEX_DIRECTION_ROW_REVERSE );
326326
327327 int i ;
@@ -383,8 +383,8 @@ private static void layoutNodeImpl(
383383 float mainDim = leadingPaddingAndBorderMain ;
384384 float crossDim = 0 ;
385385
386- float maxWidth = CSSConstants . UNDEFINED ;
387- float maxHeight = CSSConstants . UNDEFINED ;
386+ float maxWidth ;
387+ float maxHeight ;
388388 for (i = startLine ; i < childCount ; ++i ) {
389389 child = node .getChildAt (i );
390390 child .lineIndex = linesCount ;
@@ -421,7 +421,7 @@ private static void layoutNodeImpl(
421421 // left and right or top and bottom).
422422 for (ii = 0 ; ii < 2 ; ii ++) {
423423 axis = (ii != 0 ) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN ;
424- if (( !Float .isNaN (node .layout .dimensions [dim [axis ]]) && node . layout . dimensions [ dim [ axis ]] >= 0.0 ) &&
424+ if (!Float .isNaN (node .layout .dimensions [dim [axis ]]) &&
425425 !(!Float .isNaN (child .style .dimensions [dim [axis ]]) && child .style .dimensions [dim [axis ]] >= 0.0 ) &&
426426 !Float .isNaN (child .style .position [leading [axis ]]) &&
427427 !Float .isNaN (child .style .position [trailing [axis ]])) {
@@ -468,7 +468,7 @@ private static void layoutNodeImpl(
468468 maxHeight = CSSConstants .UNDEFINED ;
469469
470470 if (!isMainRowDirection ) {
471- if ((!Float .isNaN (node .layout .dimensions [dim [resolvedRowAxis ]]) && node .layout .dimensions [dim [resolvedRowAxis ]] >= 0.0 )) {
471+ if ((!Float .isNaN (node .style .dimensions [dim [resolvedRowAxis ]]) && node .style .dimensions [dim [resolvedRowAxis ]] >= 0.0 )) {
472472 maxWidth = node .layout .dimensions [dim [resolvedRowAxis ]] -
473473 paddingAndBorderAxisResolvedRow ;
474474 } else {
@@ -477,7 +477,7 @@ private static void layoutNodeImpl(
477477 paddingAndBorderAxisResolvedRow ;
478478 }
479479 } else {
480- if ((!Float .isNaN (node .layout .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]]) && node .layout .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]] >= 0.0 )) {
480+ if ((!Float .isNaN (node .style .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]]) && node .style .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]] >= 0.0 )) {
481481 maxHeight = node .layout .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]] -
482482 paddingAndBorderAxisColumn ;
483483 } else {
@@ -528,7 +528,7 @@ private static void layoutNodeImpl(
528528 if (isSimpleStackCross &&
529529 (child .style .positionType != CSSPositionType .RELATIVE ||
530530 (alignItem != CSSAlign .STRETCH && alignItem != CSSAlign .FLEX_START ) ||
531- ( alignItem == CSSAlign . STRETCH && ! isCrossDimDefined ))) {
531+ Float . isNaN ( child . layout . dimensions [ dim [ crossAxis ]] ))) {
532532 isSimpleStackCross = false ;
533533 firstComplexCross = i ;
534534 }
@@ -611,7 +611,7 @@ private static void layoutNodeImpl(
611611 );
612612
613613 maxWidth = CSSConstants .UNDEFINED ;
614- if ((!Float .isNaN (node .layout .dimensions [dim [resolvedRowAxis ]]) && node .layout .dimensions [dim [resolvedRowAxis ]] >= 0.0 )) {
614+ if ((!Float .isNaN (node .style .dimensions [dim [resolvedRowAxis ]]) && node .style .dimensions [dim [resolvedRowAxis ]] >= 0.0 )) {
615615 maxWidth = node .layout .dimensions [dim [resolvedRowAxis ]] -
616616 paddingAndBorderAxisResolvedRow ;
617617 } else if (!isMainRowDirection ) {
@@ -620,7 +620,7 @@ private static void layoutNodeImpl(
620620 paddingAndBorderAxisResolvedRow ;
621621 }
622622 maxHeight = CSSConstants .UNDEFINED ;
623- if ((!Float .isNaN (node .layout .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]]) && node .layout .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]] >= 0.0 )) {
623+ if ((!Float .isNaN (node .style .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]]) && node .style .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]] >= 0.0 )) {
624624 maxHeight = node .layout .dimensions [dim [CSS_FLEX_DIRECTION_COLUMN ]] -
625625 paddingAndBorderAxisColumn ;
626626 } else if (isMainRowDirection ) {
@@ -738,31 +738,15 @@ private static void layoutNodeImpl(
738738 CSSAlign alignItem = getAlignItem (node , child );
739739 /*eslint-enable */
740740 if (alignItem == CSSAlign .STRETCH ) {
741- // You can only stretch if the dimension has not already been defined
741+ // You can only stretch if the dimension has not already been set
742742 // previously.
743- if (!(!Float .isNaN (child .style .dimensions [dim [crossAxis ]]) && child .style .dimensions [dim [crossAxis ]] >= 0.0 )) {
744- float dimCrossAxis = child .layout .dimensions [dim [crossAxis ]];
743+ if (Float .isNaN (child .layout .dimensions [dim [crossAxis ]])) {
745744 child .layout .dimensions [dim [crossAxis ]] = Math .max (
746745 boundAxis (child , crossAxis , containerCrossAxis -
747746 paddingAndBorderAxisCross - (child .style .margin .getWithFallback (leadingSpacing [crossAxis ], leading [crossAxis ]) + child .style .margin .getWithFallback (trailingSpacing [crossAxis ], trailing [crossAxis ]))),
748747 // You never want to go smaller than padding
749748 ((child .style .padding .getWithFallback (leadingSpacing [crossAxis ], leading [crossAxis ]) + child .style .border .getWithFallback (leadingSpacing [crossAxis ], leading [crossAxis ])) + (child .style .padding .getWithFallback (trailingSpacing [crossAxis ], trailing [crossAxis ]) + child .style .border .getWithFallback (trailingSpacing [crossAxis ], trailing [crossAxis ])))
750749 );
751-
752- // If the size has changed, and this child has children we need to re-layout this child
753- if (dimCrossAxis != child .layout .dimensions [dim [crossAxis ]] && child .getChildCount () > 0 ) {
754- // Reset child margins before re-layout as they are added back in layoutNode and would be doubled
755- child .layout .position [leading [mainAxis ]] -= child .style .margin .getWithFallback (leadingSpacing [mainAxis ], leading [mainAxis ]) +
756- getRelativePosition (child , mainAxis );
757- child .layout .position [trailing [mainAxis ]] -= child .style .margin .getWithFallback (trailingSpacing [mainAxis ], trailing [mainAxis ]) +
758- getRelativePosition (child , mainAxis );
759- child .layout .position [leading [crossAxis ]] -= child .style .margin .getWithFallback (leadingSpacing [crossAxis ], leading [crossAxis ]) +
760- getRelativePosition (child , crossAxis );
761- child .layout .position [trailing [crossAxis ]] -= child .style .margin .getWithFallback (trailingSpacing [crossAxis ], trailing [crossAxis ]) +
762- getRelativePosition (child , crossAxis );
763-
764- layoutNode (layoutContext , child , maxWidth , maxHeight , direction );
765- }
766750 }
767751 } else if (alignItem != CSSAlign .FLEX_START ) {
768752 // The remaining space between the parent dimensions+padding and child
@@ -840,7 +824,7 @@ private static void layoutNodeImpl(
840824 if (child .lineIndex != i ) {
841825 break ;
842826 }
843- if (( !Float .isNaN (child .layout .dimensions [dim [crossAxis ]]) && child . layout . dimensions [ dim [ crossAxis ]] >= 0.0 )) {
827+ if (!Float .isNaN (child .layout .dimensions [dim [crossAxis ]])) {
844828 lineHeight = Math .max (
845829 lineHeight ,
846830 child .layout .dimensions [dim [crossAxis ]] + (child .style .margin .getWithFallback (leadingSpacing [crossAxis ], leading [crossAxis ]) + child .style .margin .getWithFallback (trailingSpacing [crossAxis ], trailing [crossAxis ]))
@@ -933,7 +917,7 @@ private static void layoutNodeImpl(
933917 for (ii = 0 ; ii < 2 ; ii ++) {
934918 axis = (ii != 0 ) ? CSS_FLEX_DIRECTION_ROW : CSS_FLEX_DIRECTION_COLUMN ;
935919
936- if (( !Float .isNaN (node .layout .dimensions [dim [axis ]]) && node . layout . dimensions [ dim [ axis ]] >= 0.0 ) &&
920+ if (!Float .isNaN (node .layout .dimensions [dim [axis ]]) &&
937921 !(!Float .isNaN (currentAbsoluteChild .style .dimensions [dim [axis ]]) && currentAbsoluteChild .style .dimensions [dim [axis ]] >= 0.0 ) &&
938922 !Float .isNaN (currentAbsoluteChild .style .position [leading [axis ]]) &&
939923 !Float .isNaN (currentAbsoluteChild .style .position [trailing [axis ]])) {
0 commit comments