retargetted-transition-with-box-sizing.html (1330B)
1 <!DOCTYPE html> 2 <link rel=help href="https://bugs.chromium.org/p/chromium/issues/detail?id=571437"> 3 <link rel=help href="https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <style> 7 #target { 8 width: 100px; 9 height: 200px; 10 transition-properties: transform; 11 transition-duration: 1s; 12 transition-delay: -0.5s; 13 transition-timing-function: linear; 14 } 15 </style> 16 <div id="target"></div> 17 <script> 18 test(() => { 19 // Force a style update ahead of the transform change. 20 assert_equals(getComputedStyle(target).transform, 'none'); 21 target.style.transform = 'translate(50%, 50%)'; 22 // Ultimate target is 50, 100, which is half of width and height, 23 // respectively. The translation puts us at the midpoint, which is at 24 // (x, y) = (25, 50). 25 assert_equals(getComputedStyle(target).transform, 'matrix(1, 0, 0, 1, 25, 50)'); 26 target.style.transform = 'translate3D(50%, 50%, 100px)'; 27 // After retargetting we preserve the progress between the current value and 28 // and new target value. 29 assert_equals(getComputedStyle(target).transform, 'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 37.5, 75, 50, 1)'); 30 }, 'Retargeting transitions on box size relative transitions should work.'); 31 </script>