4 https://bugzilla.mozilla.org/show_bug.cgi?id=1167519
8 <title>Test for bug
1167519</title>
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <script src=
"/tests/SimpleTest/paint_listener.js"></script>
11 <script src=
"animation_utils.js"></script>
12 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css">
18 transition: transform
100s linear;
23 <div id=
"target"></div>
27 SimpleTest
.waitForExplicitFinish();
29 const OMTAPrefKey
= 'layers.offmainthreadcomposition.async-animations';
31 SpecialPowers
.DOMWindowUtils
.layerManagerRemote
&&
32 SpecialPowers
.getBoolPref(OMTAPrefKey
);
34 window
.addEventListener('load', async
function() {
36 ok(true, 'Skipping the test since OMTA is disabled');
41 const div
= document
.getElementById('target');
43 // Start first transition
44 div
.style
.transform
= 'translateX(300px)';
45 const firstTransition
= div
.getAnimations()[0];
47 // Wait for first transition to start running on the main thread and
49 await firstTransition
.ready
;
50 await
waitForPaints();
52 await
new Promise(resolve
=> requestAnimationFrame(resolve
));
54 // Start second transition
55 div
.style
.transform
= 'translateX(600px)';
56 const secondTransition
= div
.getAnimations()[0];
58 const originalProperties
= SpecialPowers
.wrap(
59 secondTransition
.effect
61 const previousPropertyValue
= originalProperties
[0].values
[0].value
;
62 const previousKeyframeValue
= secondTransition
.effect
.getKeyframes()[0]
65 // Tie up main thread for 300ms. In the meantime, the first transition
66 // will continue running on the compositor. If we don't update the start
67 // point of the second transition, it will appear to jump when it starts.
68 const startTime
= performance
.now();
69 while (performance
.now() - startTime
< 300);
71 // Ensure that our paint process has been done.
73 // Note that requestAnimationFrame is not suitable here since on Android
74 // there is a case where the paint process has not completed even when the
75 // requestAnimationFrame callback is run (and it is during the paint
76 // process that we update the transition start point).
77 await
waitForPaints();
79 const updatedProperties
= SpecialPowers
.wrap(
80 secondTransition
.effect
82 const currentPropertyValue
= updatedProperties
[0].values
[0].value
;
85 previousPropertyValue
,
86 'From value of transition is updated since the moment when ' +
90 secondTransition
.effect
.getKeyframes()[0].transform
,
91 previousKeyframeValue
,
92 'Keyframe value of transition is updated since the moment when ' +