| <!DOCTYPE HTML> |
| <style> |
| body { |
| margin: 0; |
| } |
| #top { |
| position: relative; |
| height: 500px; |
| width: 500px; |
| } |
| #container { |
| position: absolute; |
| top: 0px; |
| bottom: 0px; |
| left: 0px; |
| right: 0px; |
| overflow: hidden; |
| } |
| #test { |
| position: absolute; |
| top: 0px; |
| bottom: 0px; |
| left: 0px; |
| right: 140px; |
| overflow: hidden; |
| } |
| .contents { |
| display: inline-block; |
| background-color: green; |
| height: 100px; |
| width: 100px; |
| overflow: hidden; |
| } |
| </style> |
| <script> |
| |
| function addChildren(test) |
| { |
| for (i = 0; i < 20; i++) { |
| box = document.createElement("div"); |
| box.setAttribute('class', 'contents'); |
| box.setAttribute('id', i); |
| test.appendChild(box); |
| } |
| } |
| |
| function runTest() |
| { |
| test = document.getElementById("test"); |
| test.style['margin-left'] = '100%'; |
| addChildren(test); |
| |
| for (i = 0; i < 20; i++) { |
| box = document.getElementById(i); |
| test.removeChild(box); |
| } |
| document.body.offsetTop; |
| |
| addChildren(test); |
| document.body.offsetTop; |
| |
| test.style['margin-left'] = 'initial'; |
| } |
| window.onload = runTest; |
| </script> |
| <div id="top"> |
| <div id="container"> |
| <div id="test"></div> |
| </div> |
| </div> |
| crbug.com/426166: Tests positioned movement layout when it needs to layout children because it's width has changed. |