mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update web-platform-tests to revision 74bae78af4b95a2f0ca3a81df9c7fe3143f24bbc
This commit is contained in:
parent
fb95f9df9c
commit
02c1eed999
150 changed files with 2395 additions and 829 deletions
|
@ -8,26 +8,25 @@ function registerPassthroughAnimator() {
|
|||
`);
|
||||
}
|
||||
|
||||
function registerConstantLocalTimeAnimator(localTime) {
|
||||
return runInAnimationWorklet(`
|
||||
registerAnimator('constant_time', class {
|
||||
animate(currentTime, effect) { effect.localTime = ${localTime}; }
|
||||
});
|
||||
`);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
};
|
||||
function waitForAsyncAnimationFrames(count) {
|
||||
// In Chrome, waiting for N+1 main thread frames guarantees that compositor has produced
|
||||
// at least N frames.
|
||||
// TODO(majidvp): re-evaluate this choice once other browsers have implemented
|
||||
// AnimationWorklet.
|
||||
return waitForAnimationFrames(count + 1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue