| 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 function assertComposited(properties, isComposited) { |
| 9 var element = document.createElement('div'); |
| 10 document.getElementById('parent').appendChild(element); |
| 11 |
| 12 var properties = typeof properties == "string" ? [properties] : properties; |
| 13 var keyframe = {}; |
| 14 |
| 15 properties.forEach(function(property) { |
| 16 keyframe[property] = 'initial'; |
| 17 }); |
| 18 |
| 19 var animation = element.animate([keyframe, keyframe], { |
| 20 duration: 4000, |
| 21 iterations: Infinity |
| 22 }); |
| 23 |
| 24 var asyncHandle = async_test("Animation on " + properties.join(", ") + (isComp
osited ? " is " : " is not ") + "composited"); |
| 25 requestAnimationFrame(function() { |
| 26 requestAnimationFrame(function() { |
| 27 asyncHandle.step(function() { |
| 28 assert_equals(internals.isCompositedAnimation(animation), isComposited,
properties.join(", ") + (isComposited ? " should " : " should not ") + "be compo
sited"); |
| 29 }); |
| 30 |
| 31 animation.cancel(); |
| 32 asyncHandle.done(); |
| 33 }); |
| 34 }); |
| 35 } |
| 36 |
| 37 var assertIsComposited = function(properties) { return assertComposited(properti
es, true); } |
| 38 var assertIsNotComposited = function(properties) { return assertComposited(prope
rties, false); } |
| 39 |
| 40 assertIsComposited('transform'); |
| 41 assertIsComposited('opacity'); |
| 42 |
| 43 assertIsComposited('translate'); |
| 44 assertIsComposited('rotate'); |
| 45 assertIsComposited('scale'); |
| 46 |
| 47 assertIsComposited(['transform', 'opacity']); |
| 48 assertIsComposited(['translate', 'opacity']); |
| 49 assertIsComposited(['rotate', 'opacity']); |
| 50 assertIsComposited(['scale', 'opacity']); |
| 51 |
| 52 assertIsNotComposited(['transform', 'translate']); |
| 53 assertIsNotComposited(['transform', 'scale']); |
| 54 assertIsNotComposited(['transform', 'rotate']); |
| 55 |
| 56 assertIsNotComposited(['translate', 'scale']); |
| 57 assertIsNotComposited(['translate', 'rotate']); |
| 58 assertIsNotComposited(['rotate', 'scale']); |
| 59 |
| 60 assertIsNotComposited(['translate', 'rotate', 'scale']); |
| 61 assertIsNotComposited(['transform', 'translate', 'rotate', 'scale']); |
| 62 </script> |
| OLD | NEW |