| 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 #scaleOnly { |
| 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 scale i
s present.</p> |
| 24 </div> |
| 25 <div id="transformOnly" class="box">Transform Only</div> |
| 26 <div id="scaleOnly" class="box">Scale Only</div> |
| 27 <div id="mixed" class="box">Transform + Scale</div> |
| 28 <script> |
| 29 var transformOnlyAnimation = transformOnly.animate([ |
| 30 {transform: 'scale(1, 1)'}, |
| 31 {transform: 'scale(4, 4)'} |
| 32 ], { |
| 33 duration: 4000, |
| 34 iterations: Infinity |
| 35 }); |
| 36 |
| 37 var scaleOnlyAnimation = scaleOnly.animate([ |
| 38 {scale: '1 1'}, |
| 39 {scale: '4 4'} |
| 40 ], { |
| 41 duration: 4000, |
| 42 iterations: Infinity |
| 43 }); |
| 44 |
| 45 var mixedAnimation = mixed.animate([ |
| 46 {transform: 'scale(1, 1)', scale: '1 1'}, |
| 47 {transform: 'scale(2, 2)', scale: '2 2'} |
| 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 Scale"); |
| 60 requestAnimationFrame(function() { |
| 61 requestAnimationFrame(function() { |
| 62 assert_true(internals.isCompositedAnimation(transformOnlyAnimation), 'Only T
ransform should be composited'); |
| 63 assert_true(internals.isCompositedAnimation(scaleOnlyAnimation), 'Only Scale
should be composited'); |
| 64 assert_false(internals.isCompositedAnimation(mixedAnimation), 'Mixed should
not be composited'); |
| 65 asyncHandle.done(); |
| 66 }); |
| 67 }); |
| 68 </script> |
| OLD | NEW |