| <!DOCTYPE html> |
| |
| <html> |
| <head> |
| <style> |
| #container { |
| position: relative; |
| width: 400px; |
| height: 100px; |
| border: 1px solid black; |
| } |
| .box { |
| position: absolute; |
| width: 100px; |
| height: 100px; |
| background-color: green; |
| } |
| .indicator { |
| left: 150px; |
| top: 0; |
| background-color: red; |
| } |
| #container.moved .software { |
| left: 300px; |
| } |
| #container.moved .hardware { |
| transform: translateX(300px); |
| } |
| .hardware { |
| transform-style: preserve-3d; |
| transition: transform 300ms linear; |
| transform: translateX(0); |
| } |
| </style> |
| <script type="text/javascript"> |
| 'use strict'; |
| function waitForCompositor() { |
| var container = document.getElementById('container'); |
| return container.animate({opacity: [1, 1]}, 1).ready; |
| } |
| |
| function testEnded() |
| { |
| var testDiv = document.getElementById('tester'); |
| testDiv.style.transitionProperty = 'none'; |
| testDiv.style.transitionDuration = '0'; |
| |
| testDiv.style.transform = 'translateX(150px)'; |
| waitForCompositor().then(() => { |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| }); |
| } |
| |
| function startTest() |
| { |
| if (window.testRunner) |
| testRunner.waitUntilDone(); |
| |
| document.body.offsetHeight; // Force style recalc |
| document.getElementById('tester').addEventListener('transitionend', testEnded, false); |
| document.getElementById('container').className = 'moved'; |
| } |
| |
| window.addEventListener('load', startTest, false); |
| </script> |
| </head> |
| <body> |
| |
| <p>At the end of the test the green box should obscure the red box.</p> |
| <div id="container"> |
| <div class="indicator box"></div> |
| <div id="tester" class="hardware box"></div> |
| </div> |
| |
| <div id="result"> |
| </div> |
| |
| </body> |
| </html> |