| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../resources/testharness.js"></script> | |
| 3 <script src="../../resources/testharnessreport.js"></script> | |
| 4 | |
| 5 <style> | |
| 6 #target { | |
| 7 width: 100px; | |
| 8 height: 100px; | |
| 9 transition: width 1s; | |
| 10 } | |
| 11 </style> | |
| 12 | |
| 13 <div id="target"></div> | |
| 14 | |
| 15 <script> | |
| 16 'use strict'; | |
| 17 | |
| 18 function waitForProgress() { | |
| 19 var initialWidth = getComputedStyle(target).width; | |
| 20 return new Promise(resolve => { | |
| 21 function poll() { | |
| 22 var width = getComputedStyle(target).width; | |
| 23 if (width === initialWidth) { | |
| 24 requestAnimationFrame(poll); | |
| 25 } else { | |
| 26 resolve(); | |
| 27 } | |
| 28 } | |
| 29 requestAnimationFrame(poll); | |
| 30 }); | |
| 31 } | |
| 32 | |
| 33 async_test(t => { | |
| 34 assert_true( | |
| 35 internals.isCSSPropertyUseCounted(document, "width"), | |
| 36 'Usage of width in style causes it to be counted in normal CSS ' + | |
| 37 'property UseCounter'); | |
| 38 assert_true( | |
| 39 internals.isCSSPropertyUseCounted(document, "height"), | |
| 40 'Usage of height in style causes it to be counted in normal CSS ' + | |
| 41 'property UseCounter'); | |
| 42 | |
| 43 assert_false( | |
| 44 internals.isAnimatedCSSPropertyUseCounted(document, "width"), | |
| 45 'Initially width animation has not been UseCounted'); | |
| 46 assert_false( | |
| 47 internals.isAnimatedCSSPropertyUseCounted(document, "height"), | |
| 48 'Initially height animation has not been UseCounted'); | |
| 49 | |
| 50 target.offsetTop; // force recalc | |
| 51 target.style.width = '200px'; | |
| 52 | |
| 53 waitForProgress().then(t.step_func_done(() => { | |
| 54 assert_true( | |
| 55 internals.isAnimatedCSSPropertyUseCounted(document, "width"), | |
| 56 'After triggering the transition, width has been counted'); | |
| 57 assert_false( | |
| 58 internals.isAnimatedCSSPropertyUseCounted(document, "height"), | |
| 59 'Height is not animated, so not counted'); | |
| 60 })); | |
| 61 }, 'Using CSS transitions causes UseCounter to be incremented.'); | |
| 62 </script> | |
| OLD | NEW |