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