2 <script src=
"../../../resources/testharness.js"></script>
3 <script src=
"../../../resources/testharnessreport.js"></script>
5 <div id=
"parent"></div>
7 var keyframeValueMap
= {
8 translate
: '10px 10px 10px',
11 transform
: 'translate(10px, 20px)',
15 /* Test that animation on compositableProperty on compositor is cancelled when
16 cancelProperty is applied (not animated) to the element */
17 function assertAnimationComposited(compositableProperty
, cancelProperty
, isStillComposited
) {
18 var element
= document
.createElement('div');
19 document
.getElementById('parent').appendChild(element
);
22 keyframe
[compositableProperty
] = keyframeValueMap
[compositableProperty
];
24 var animation
= element
.animate([keyframe
, keyframe
], {
29 var description
= "Compositor Animation on " + compositableProperty
+ (isStillComposited
? " is not " : " is ") + "cancelled by " + cancelProperty
;
30 var asyncHandle
= async_test(description
);
31 requestAnimationFrame(function() {
32 requestAnimationFrame(function() {
34 asyncHandle
.step(function() {
35 assert_true(internals
.isCompositedAnimation(animation
), compositableProperty
+ " animation should be composited");
37 element
.style
[cancelProperty
] = keyframeValueMap
[cancelProperty
];
39 requestAnimationFrame(function() {
40 requestAnimationFrame(function() {
42 asyncHandle
.step(function() {
43 assert_equals(internals
.isCompositedAnimation(animation
), isStillComposited
, description
)
54 assertAnimationComposited('transform', 'transform', true);
55 assertAnimationComposited('translate', 'translate', true);
56 assertAnimationComposited('rotate', 'rotate', true);
57 assertAnimationComposited('scale', 'scale', true);
59 assertAnimationComposited('transform', 'translate', false);
60 assertAnimationComposited('transform', 'rotate', false);
61 assertAnimationComposited('transform', 'scale', false);
63 assertAnimationComposited('translate', 'transform', false);
64 assertAnimationComposited('translate', 'rotate', false);
65 assertAnimationComposited('translate', 'scale', false);
67 assertAnimationComposited('rotate', 'transform', false);
68 assertAnimationComposited('rotate', 'scale', false);
69 assertAnimationComposited('rotate', 'translate', false);
71 assertAnimationComposited('scale', 'transform', false);
72 assertAnimationComposited('scale', 'rotate', false);
73 assertAnimationComposited('scale', 'translate', false);
75 assertAnimationComposited('opacity', 'transform', true);
76 assertAnimationComposited('opacity', 'translate', true);
77 assertAnimationComposited('opacity', 'rotate', true);
78 assertAnimationComposited('opacity', 'scale', true);