mirror of
https://github.com/servo/servo.git
synced 2025-08-16 19:05:33 +01:00
Update web-platform-tests to revision 2d42384cf21efd71843295d319c1bab85b3acf4a
This commit is contained in:
parent
f2b224d610
commit
e851ef0cd2
1014 changed files with 5653 additions and 1590 deletions
33
tests/wpt/web-platform-tests/animation-worklet/common.js
Normal file
33
tests/wpt/web-platform-tests/animation-worklet/common.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
'use strict';
|
||||
|
||||
function registerPassthroughAnimator() {
|
||||
return runInAnimationWorklet(`
|
||||
registerAnimator('passthrough', class {
|
||||
animate(currentTime, effect) { effect.localTime = currentTime; }
|
||||
});
|
||||
`);
|
||||
}
|
||||
|
||||
function runInAnimationWorklet(code) {
|
||||
return CSS.animationWorklet.addModule(
|
||||
URL.createObjectURL(new Blob([code], {type: 'text/javascript'}))
|
||||
);
|
||||
}
|
||||
|
||||
function waitForAnimationFrames(count, callback) {
|
||||
function rafCallback() {
|
||||
if (count <= 0) {
|
||||
callback();
|
||||
} else {
|
||||
count -= 1;
|
||||
window.requestAnimationFrame(rafCallback);
|
||||
}
|
||||
}
|
||||
rafCallback();
|
||||
};
|
||||
|
||||
// Wait for two main thread frames to guarantee that compositor has produced
|
||||
// at least one frame. Note that this is a Chrome-only concept.
|
||||
function waitTwoAnimationFrames(callback) {
|
||||
waitForAnimationFrames(2, callback);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue