@@ -87,8 +87,9 @@ public static IList<IList<FlexItemInfo>> CalculateChildrenRectangles(Rectangle f
87
87
mainSize = layoutBox . GetWidth ( ) ;
88
88
}
89
89
// We need to have crossSize only if its value is definite.
90
- // The calculation differs from width calculation because if width isn't definite, parent's width shall be taken
91
- float ? crossSize = flexContainerRenderer . RetrieveMinHeight ( ) ;
90
+ float ? crossSize = flexContainerRenderer . RetrieveHeight ( ) ;
91
+ float ? minCrossSize = flexContainerRenderer . RetrieveMinHeight ( ) ;
92
+ float ? maxCrossSize = flexContainerRenderer . RetrieveMaxHeight ( ) ;
92
93
DetermineFlexBasisAndHypotheticalMainSizeForFlexItems ( flexItemCalculationInfos , ( float ) mainSize ) ;
93
94
// 9.3. Main Size Determination
94
95
// 5. Collect flex items into flex lines:
@@ -105,7 +106,8 @@ public static IList<IList<FlexItemInfo>> CalculateChildrenRectangles(Rectangle f
105
106
// performing layout with the used main size and the available space, treating auto as fit-content.
106
107
DetermineHypotheticalCrossSizeForFlexItems ( lines ) ;
107
108
// 8. Calculate the cross size of each flex line.
108
- IList < float > lineCrossSizes = CalculateCrossSizeOfEachFlexLine ( lines , isSingleLine , crossSize ) ;
109
+ IList < float > lineCrossSizes = CalculateCrossSizeOfEachFlexLine ( lines , isSingleLine , minCrossSize , crossSize
110
+ , maxCrossSize ) ;
109
111
// TODO DEVSIX-5003 min/max height calculations are not supported
110
112
// If the flex container is single-line, then clamp the line’s cross-size to be within
111
113
// the container’s computed min and max cross sizes. Note that if CSS 2.1’s definition of min/max-width/height
@@ -353,7 +355,7 @@ internal static void DetermineHypotheticalCrossSizeForFlexItems(IList<IList<Flex
353
355
}
354
356
355
357
internal static IList < float > CalculateCrossSizeOfEachFlexLine ( IList < IList < FlexUtil . FlexItemCalculationInfo
356
- > > lines , bool isSingleLine , float ? crossSize ) {
358
+ > > lines , bool isSingleLine , float ? minCrossSize , float ? crossSize , float ? maxCrossSize ) {
357
359
IList < float > lineCrossSizes = new List < float > ( ) ;
358
360
if ( isSingleLine && crossSize != null && ! lines . IsEmpty ( ) ) {
359
361
lineCrossSizes . Add ( ( float ) crossSize ) ;
@@ -378,6 +380,16 @@ internal static IList<float> CalculateCrossSizeOfEachFlexLine(IList<IList<FlexUt
378
380
}
379
381
flexLinesCrossSize = Math . Max ( 0 , largestHypotheticalCrossSize ) ;
380
382
}
383
+ // 3. If the flex container is single-line, then clamp the line’s cross-size to be
384
+ // within the container’s computed min and max cross sizes
385
+ if ( isSingleLine && ! lines . IsEmpty ( ) ) {
386
+ if ( null != minCrossSize ) {
387
+ flexLinesCrossSize = Math . Max ( ( float ) minCrossSize , flexLinesCrossSize ) ;
388
+ }
389
+ if ( null != maxCrossSize ) {
390
+ flexLinesCrossSize = Math . Min ( ( float ) maxCrossSize , flexLinesCrossSize ) ;
391
+ }
392
+ }
381
393
lineCrossSizes . Add ( flexLinesCrossSize ) ;
382
394
}
383
395
}
0 commit comments