flex-shrink-large-value-crash.html (1051B)
1 <!DOCTYPE html> 2 <title>CSS Flexbox: large flex-shrink value</title> 3 <link rel="help" href="https://drafts.csswg.org/css-flexbox/#scaled-flex-shrink-factor"> 4 <link rel="help" href="https://crbug.com/543614"> 5 <meta name="assert" content="This test ensures that large flex-shrink value does crash due to the lost of precision."> 6 <style> 7 .flex { 8 display: inline-flex; 9 width: 40px; 10 height: 40px; 11 } 12 13 .fractional { 14 height: 50px; 15 width: 50.5px; 16 min-width: 50.5px; 17 } 18 19 .high-shrink { 20 flex-shrink: 130000000000000; 21 height: 40px; 22 width: 40px; 23 min-width: 40px; 24 } 25 </style> 26 27 <div class="flex"> 28 <div class="fractional"></div> 29 <div class="high-shrink"></div> 30 </div> 31 32 <p>The high flex shrink factor can lead to loss of precision as we calculate the 33 <a href="https://drafts.csswg.org/css-flexbox/#scaled-flex-shrink-factor">sum of 34 scaled flex shrink factors</a> as required by the spec, and as we later subtract 35 the scaled flex factors for frozen violations, we can get to a negative value 36 due to that lost precision.</p>