| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style> | |
| .container { | |
| position: absolute; | |
| margin: 40px; | |
| padding: 50px; | |
| width: 400px; | |
| height: 300px; | |
| border: 1px solid black; | |
| } | |
| .caption-container { | |
| position: absolute; | |
| top: 0; | |
| left: 0; | |
| width: 100%; | |
| height: 100%; | |
| box-shadow: 0 0 10px black; | |
| } | |
| .caption { | |
| position: absolute; | |
| width: 300px; | |
| bottom: 200px; | |
| text-align: center; | |
| height: 100px; | |
| background-color: blue; | |
| } | |
| .child { | |
| position: absolute; | |
| top: 10px; | |
| left: 320px; | |
| width: 100px; | |
| height: 100px; | |
| background-color: blue; | |
| } | |
| body.changed .caption { | |
| bottom: 20px; | |
| } | |
| .composited { | |
| transform: translateZ(0); | |
| background-color: silver; | |
| } | |
| </style> | |
| <script> | |
| if (window.testRunner) | |
| testRunner.waitUntilDone(); | |
| window.addEventListener('load', () => { | |
| requestAnimationFrame(() => { | |
| document.getElementById('trigger').classList.add('composited'); | |
| requestAnimationFrame(() => { | |
| document.body.classList.add('changed'); | |
| if (window.testRunner) | |
| testRunner.notifyDone(); | |
| }); | |
| }); | |
| }, false); | |
| </script> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <div id="trigger">composited</div> | |
| <div class="caption-container"> | |
| <div class="caption"> | |
| This should move, not duplicate | |
| <div class="child"> | |
| child | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </body> | |
| </html> |