| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <style> |
| 5 .box { |
| 6 height: 100px; |
| 7 width: 100px; |
| 8 } |
| 9 |
| 10 #transformOnly { |
| 11 background-color: blue; |
| 12 } |
| 13 |
| 14 #translateOnly { |
| 15 background-color: red; |
| 16 } |
| 17 |
| 18 #mixed { |
| 19 background-color: purple; |
| 20 } |
| 21 </style> |
| 22 <div id="human"> |
| 23 <p>Tests that composited animation happens when only transform or only transla
te is present.</p> |
| 24 </div> |
| 25 <div id="transformOnly" class="box">Transform Only</div> |
| 26 <div id="translateOnly" class="box">Translate Only</div> |
| 27 <div id="mixed" class="box">Transform + Translate</div> |
| 28 <script> |
| 29 var transformOnlyAnimation = transformOnly.animate([ |
| 30 {transform: 'translate(0px, 0px)'}, |
| 31 {transform: 'translate(400px, 400px)'} |
| 32 ], { |
| 33 duration: 4000, |
| 34 iterations: Infinity |
| 35 }); |
| 36 |
| 37 var translateOnlyAnimation = translateOnly.animate([ |
| 38 {translate: '0px 0px'}, |
| 39 {translate: '400px 400px'} |
| 40 ], { |
| 41 duration: 4000, |
| 42 iterations: Infinity |
| 43 }); |
| 44 |
| 45 var mixedAnimation = mixed.animate([ |
| 46 {transform: 'translate(0px)', translate: '0px 0px'}, |
| 47 {transform: 'translate(400px)', translate: '0px 400px'} |
| 48 ], { |
| 49 duration: 4000, |
| 50 iterations: Infinity |
| 51 }); |
| 52 |
| 53 if (window.testRunner) { |
| 54 [].forEach.call(document.querySelectorAll('#human,.box'), function(element) { |
| 55 element.textContent = ''; |
| 56 }) |
| 57 } |
| 58 |
| 59 var asyncHandle = async_test("Compositor Test with Translate"); |
| 60 requestAnimationFrame(function() { |
| 61 requestAnimationFrame(function() { |
| 62 assert_true(internals.isCompositedAnimation(transformOnlyAnimation), 'Only T
ransform should be composited'); |
| 63 assert_true(internals.isCompositedAnimation(translateOnlyAnimation), 'Only T
ranslate should be composited'); |
| 64 assert_false(internals.isCompositedAnimation(mixedAnimation), 'Mixed should
not be composited'); |
| 65 asyncHandle.done(); |
| 66 }); |
| 67 }); |
| 68 </script> |
| OLD | NEW |