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