| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <style> |
| 5 div { |
| 6 position: absolute; |
| 7 height: 25px; |
| 8 width: 25px; |
| 9 } |
| 10 |
| 11 #human-text{ |
| 12 width: 100%; |
| 13 } |
| 14 |
| 15 #divBlue { |
| 16 left: 100px; |
| 17 top: 200px; |
| 18 background-color: blue; |
| 19 } |
| 20 |
| 21 #divRed { |
| 22 left: 200px; |
| 23 top: 200px; |
| 24 background-color: red; |
| 25 } |
| 26 |
| 27 #divPurple { |
| 28 left: 300px; |
| 29 top: 200px; |
| 30 background-color: purple; |
| 31 } |
| 32 </style> |
| 33 <span id="human-text"> |
| 34 <p>Tests that composited animation happens when only transform or only scale
is present.</p> |
| 35 <p>Blue = Only Transform, Red = Only Scale, Purple = Transform + Scale</p> |
| 36 <p id="text"></p> |
| 37 </span> |
| 38 <div id="divBlue"></div> |
| 39 <div id="divRed"></div> |
| 40 <div id="divPurple"></div> |
| 41 <script> |
| 42 var blue = divBlue.animate([ |
| 43 {transform: 'scale(1, 1)'}, |
| 44 {transform: 'scale(4, 4)'} |
| 45 ], { |
| 46 duration: 4000, |
| 47 iterations: Infinity |
| 48 }); |
| 49 |
| 50 var red = divRed.animate([ |
| 51 {scale: '1 1'}, |
| 52 {scale: '4 4'} |
| 53 ], { |
| 54 duration: 4000, |
| 55 iterations: Infinity |
| 56 }); |
| 57 |
| 58 var purple = divPurple.animate([ |
| 59 {transform: 'scale(1, 1)', scale: '1 1'}, |
| 60 {transform: 'scale(2, 2)', scale: '2 2'} |
| 61 ], { |
| 62 duration: 4000, |
| 63 iterations: Infinity |
| 64 }); |
| 65 |
| 66 if (window.testRunner) { |
| 67 window.testRunner.waitUntilDone(); |
| 68 document.getElementById('human-text').style.display = 'none'; |
| 69 } |
| 70 |
| 71 test(function() { |
| 72 requestAnimationFrame(function() { |
| 73 requestAnimationFrame(function() { |
| 74 var compositedBlue = internals.isCompositedAnimation(blue); |
| 75 var compositedRed = internals.isCompositedAnimation(red); |
| 76 var compositedPurple = internals.isCompositedAnimation(purple); |
| 77 |
| 78 text.textContent = `Blue ${compositedBlue ? 'is' : 'is not'} running on th
e compositor.\n`; |
| 79 text.textContent += `Red ${compositedRed ? 'is' : 'is not'} running on the
compositor.\n`; |
| 80 text.textContent += `Purple ${compositedPurple ? 'is' : 'is not'} running
on the compositor.`; |
| 81 |
| 82 assert_true(compositedBlue, 'Only Transform should be composited'); |
| 83 assert_true(compositedRed, 'Only Translate should be composited'); |
| 84 assert_false(compositedPurple, 'Mixed should not be composited'); |
| 85 |
| 86 if (window.testRunner) { |
| 87 window.testRunner.dumpAsText(); |
| 88 window.testRunner.notifyDone(); |
| 89 } |
| 90 }); |
| 91 }); |
| 92 }, "Compositor Test with Scale"); |
| 93 </script> |
| OLD | NEW |