dynamic-isize-change-004.html (1455B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Flexbox Test: Dynamic change to the inline-size of a row flex container</title> 4 <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> 5 <link rel="author" title="Mozilla" href="https://www.mozilla.org/"> 6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1700580"> 7 <link rel="stylesheet" href="/fonts/ahem.css"> 8 <link rel="match" href="../reference/ref-filled-green-100px-square.xht"> 9 <meta name="assert" content="This test verifies that the dynamic change to the flex container's inline-size triggers the reflow for flex items with percentage padding."> 10 11 <style> 12 #flexbox { 13 display: flex; 14 inline-size: 100px; 15 block-size: 100px; 16 font: 50px/1 Ahem; 17 color: green; 18 word-break: break-all; 19 } 20 21 #flexbox > div { 22 /* The following flex-basis and padding will give our flex item a border-box 23 inline-size of 100px, both before and after this test's dynamic 24 modification. */ 25 flex-basis: 50%; 26 padding-right: calc(100px - 50%); 27 background: red; 28 } 29 </style> 30 31 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 32 <div id="flexbox"> 33 <div>XXXX</div> 34 </div> 35 36 <script> 37 /* Make sure the layout is up-to-date, which is essential to trigger the bug. */ 38 document.documentElement.offsetHeight; 39 40 /* Change the flexbox's inline-size to trigger incremental reflow. */ 41 document.getElementById("flexbox").style.inlineSize = "200px"; 42 </script>