| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 |
| 5 <div id="parent"></div> |
| 6 |
| 7 <script> |
| 8 var keyframeValueMap = { |
| 9 translate: '10px 10px 10px', |
| 10 scale: '1 2 3', |
| 11 rotate: '45deg', |
| 12 transform: 'translate(10px, 20px)' }; |
| 13 |
| 14 /* Test that animation on compositableProperty on compositor is cancelled when |
| 15 cancelProperty is applied (not animated) to the element */ |
| 16 function assertAnimationComposited(compositableProperty, cancelProperty, isStill
Composited) { |
| 17 var element = document.createElement('div'); |
| 18 document.getElementById('parent').appendChild(element); |
| 19 |
| 20 var keyframe = {}; |
| 21 keyframe[compositableProperty] = 'initial'; |
| 22 |
| 23 var animation = element.animate([keyframe, keyframe], { |
| 24 duration: 4000, |
| 25 iterations: Infinity |
| 26 }); |
| 27 |
| 28 var description = "Compositor Animation on " + compositableProperty + (isStill
Composited ? " is not " : " is ") + "cancelled by " + cancelProperty; |
| 29 var asyncHandle = async_test(description); |
| 30 requestAnimationFrame(function() { |
| 31 requestAnimationFrame(function() { |
| 32 |
| 33 asyncHandle.step(function() { |
| 34 assert_true(internals.isCompositedAnimation(animation), compositableProp
erty + " animation should be composited"); |
| 35 }); |
| 36 element.style[cancelProperty] = keyframeValueMap[cancelProperty]; |
| 37 |
| 38 requestAnimationFrame(function() { |
| 39 requestAnimationFrame(function() { |
| 40 |
| 41 asyncHandle.step(function() { |
| 42 assert_equals(internals.isCompositedAnimation(animation), isStillCom
posited, description) |
| 43 }); |
| 44 |
| 45 animation.cancel(); |
| 46 asyncHandle.done(); |
| 47 }); |
| 48 }); |
| 49 }); |
| 50 }); |
| 51 } |
| 52 |
| 53 assertAnimationComposited('transform', 'transform', true); |
| 54 assertAnimationComposited('translate', 'translate', true); |
| 55 assertAnimationComposited('rotate', 'rotate', true); |
| 56 assertAnimationComposited('scale', 'scale', true); |
| 57 |
| 58 assertAnimationComposited('transform', 'translate', false); |
| 59 assertAnimationComposited('transform', 'rotate', false); |
| 60 assertAnimationComposited('transform', 'scale', false); |
| 61 |
| 62 assertAnimationComposited('translate', 'transform', false); |
| 63 assertAnimationComposited('translate', 'rotate', false); |
| 64 assertAnimationComposited('translate', 'scale', false); |
| 65 |
| 66 assertAnimationComposited('rotate', 'transform', false); |
| 67 assertAnimationComposited('rotate', 'scale', false); |
| 68 assertAnimationComposited('rotate', 'translate', false); |
| 69 |
| 70 assertAnimationComposited('scale', 'transform', false); |
| 71 assertAnimationComposited('scale', 'rotate', false); |
| 72 assertAnimationComposited('scale', 'translate', false); |
| 73 |
| 74 assertAnimationComposited('opacity', 'transform', true); |
| 75 assertAnimationComposited('opacity', 'translate', true); |
| 76 assertAnimationComposited('opacity', 'rotate', true); |
| 77 assertAnimationComposited('opacity', 'scale', true); |
| 78 </script> |
| OLD | NEW |