| <!DOCTYPE html> |
| <!-- |
| | Test case which ensures that animations restart after display: none is |
| | applied to an ancestor of theirs, and then removed. |
| | From https://www.w3.org/TR/2013/WD-css3-animations-20130219/#animations, |
| | "Setting the display property to ‘none’ will terminate any running animation |
| | applied to the element and its descendants. If an element has a display of |
| | ‘none’, updating display to a value other than ‘none’ will start all |
| | animations applied to the element by the ‘animation-name’ property, as well |
| | as all animations applied to descendants with display other than ‘none’." |
| --> |
| <html> |
| <head> |
| <style> |
| @keyframes testAnimation{ |
| 0% { transform: translate(0, 0); } |
| 50% { transform: translate(100px,0); } |
| 100% { transform: translate(100px,100px); } |
| } |
| #block { |
| width: 100px; |
| height: 100px; |
| font-size: 30px; |
| background-color: red; |
| animation: testAnimation 1s forwards; |
| } |
| </style> |
| </head> |
| <body> |
| <div id="outer-container"> |
| <div id="inner-container"> |
| <div id="block"></div> |
| </div> |
| </div> |
| |
| <script> |
| if (window.testRunner) { |
| window.testRunner.waitUntilDone(); |
| } |
| |
| var containerDiv = document.getElementById('outer-container'); |
| |
| window.addEventListener('load', function() { |
| if (window.testRunner) { |
| // Run the transition to the half-way point. |
| window.testRunner.AdvanceClockByMs(500); |
| window.testRunner.DoNonMeasuredLayout(); |
| } |
| |
| containerDiv.style.display = "none"; |
| |
| if (window.testRunner) { |
| window.testRunner.DoNonMeasuredLayout(); |
| } |
| |
| containerDiv.style.display = "block"; |
| |
| if (window.testRunner) { |
| window.testRunner.DoNonMeasuredLayout(); |
| |
| window.testRunner.AdvanceClockByMs(500); |
| window.testRunner.notifyDone(); |
| } |
| }); |
| </script> |
| |
| </body> |
| </html> |