| <!DOCTYPE html> |
| <p>There should be a green square below. No red.</p> |
| <div style="float:left; position:relative; background:red;"> |
| <div id="abspos" style="position:absolute; top:0; right:0; bottom:0; left:0; background:green;"></div> |
| <div style="width:150px; max-height:150px; overflow:auto;"> |
| <div id="child" style="width:100px; height:100px;"></div> |
| </div> |
| </div> |
| <div style="clear:both;"></div> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script> |
| test(() => { |
| var abspos = document.getElementById("abspos"); |
| var child = document.getElementById("child"); |
| assert_equals(abspos.offsetWidth, 150); |
| assert_equals(abspos.offsetHeight, 100); |
| document.body.offsetLeft; |
| child.style.height = "400px"; |
| assert_equals(abspos.offsetWidth, 150); |
| assert_equals(abspos.offsetHeight, 150); |
| }, "Add content to an overflow:auto container, so that scrollbars appear"); |
| </script> |