2 <script src=
"../../../resources/testharness.js"></script>
3 <script src=
"../../../resources/testharnessreport.js"></script>
5 <div id=
"parent"></div>
8 var keyframeValueMap
= {
9 translate
: '10px 10px 10px',
12 transform
: 'translate(10px, 20px)',
16 /* Test that animation on compositableProperty on compositor is cancelled when
17 cancelProperty is animated on the element */
18 function assertAnimationComposited(compositableProperty
, cancelProperty
, isStillComposited
) {
19 var element
= document
.createElement('div');
20 document
.getElementById('parent').appendChild(element
);
23 keyframe
[compositableProperty
] = keyframeValueMap
[compositableProperty
];
25 var animation
= element
.animate([keyframe
, keyframe
], {
30 var description
= "Compositor Animation on " + compositableProperty
+ (isStillComposited
? " is not " : " is ") + "cancelled by " + cancelProperty
;
31 var asyncHandle
= async_test(description
);
32 requestAnimationFrame(function() {
33 requestAnimationFrame(function() {
35 asyncHandle
.step(function() {
36 assert_true(internals
.isCompositedAnimation(animation
), compositableProperty
+ " animation should be composited");
40 keyframe2
[cancelProperty
] = keyframeValueMap
[cancelProperty
];
41 animation
= element
.animate([keyframe2
, keyframe2
], {
46 requestAnimationFrame(function() {
47 requestAnimationFrame(function() {
49 asyncHandle
.step(function() {
50 assert_equals(internals
.isCompositedAnimation(animation
), isStillComposited
, description
)
61 assertAnimationComposited('transform', 'transform', false);
63 assertAnimationComposited('transform', 'translate', false);
64 assertAnimationComposited('transform', 'rotate', false);
65 assertAnimationComposited('transform', 'scale', false);
67 assertAnimationComposited('translate', 'transform', false);
68 assertAnimationComposited('translate', 'rotate', false);
69 assertAnimationComposited('translate', 'scale', false);
70 assertAnimationComposited('translate', 'translate', false);
72 assertAnimationComposited('rotate', 'transform', false);
73 assertAnimationComposited('rotate', 'rotate', false);
74 assertAnimationComposited('rotate', 'scale', false);
75 assertAnimationComposited('rotate', 'translate', false);
77 assertAnimationComposited('scale', 'transform', false);
78 assertAnimationComposited('scale', 'rotate', false);
79 assertAnimationComposited('scale', 'scale', false);
80 assertAnimationComposited('scale', 'translate', false);
82 assertAnimationComposited('opacity', 'transform', true);
83 assertAnimationComposited('opacity', 'translate', true);
84 assertAnimationComposited('opacity', 'rotate', true);
85 assertAnimationComposited('opacity', 'scale', true);