mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision 4e6563687b9c03d2f54ce0f06ef0ccc8e0964328
This commit is contained in:
parent
e68585a26f
commit
c80d322d92
56 changed files with 1205 additions and 66 deletions
|
@ -0,0 +1,16 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>AnimationTiming Test: FrameRequestCallback - valid callback handle</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#animation-frames">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
test(() => {
|
||||
let requestId = window.requestAnimationFrame(() => {});
|
||||
assert_greater_than(requestId, 0, "callback handle is a integer greater than zero");
|
||||
}, "Check window.requestAnimationFrame can return a valid callback handle");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,17 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>AnimationTiming Test: FrameRequestCallback - timestamp argument</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#animation-frames">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
async_test(t => {
|
||||
requestAnimationFrame(t.step_func_done(time => {
|
||||
assert_equals(typeof time, "number", "callback contains a number argument");
|
||||
}))
|
||||
}, "Check FrameRequestCallback has a DOMHighResTimeStamp argument");
|
||||
|
||||
</script>
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>AnimationTiming Test: cancelAnimationFrame used to cancel request callback</title>
|
||||
<link rel="author" title="Intel" href="http://www.intel.com">
|
||||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#animation-frames">
|
||||
|
||||
<style>
|
||||
#animated {
|
||||
background: blue;
|
||||
color: white;
|
||||
height: 100px;
|
||||
width: 100px;
|
||||
position: absolute;
|
||||
}
|
||||
</style>
|
||||
|
||||
<p>
|
||||
Test passes if there is a filled blue square with 'Filler Text',
|
||||
which moves from left to right repeatly, when click the 'stop' button,
|
||||
the square stops.
|
||||
</p>
|
||||
<button onclick="stop()">stop</button>
|
||||
<div id="animated">Filler Text</div>
|
||||
|
||||
<script>
|
||||
|
||||
let requestId = 0;
|
||||
let requestAnimation = window.requestAnimationFrame;
|
||||
let cancelAnimation = window.cancelAnimationFrame;
|
||||
|
||||
function animate(time) {
|
||||
let div = document.getElementById("animated");
|
||||
div.style.left = (time - animationStartTime) % 2000 / 4 + "px";
|
||||
requestId = requestAnimation(animate);
|
||||
}
|
||||
|
||||
function start() {
|
||||
animationStartTime = window.performance.now();
|
||||
requestId = requestAnimation(animate);
|
||||
}
|
||||
|
||||
function stop() {
|
||||
if (requestId) {
|
||||
cancelAnimation(requestId);
|
||||
requestId = 0;
|
||||
}
|
||||
}
|
||||
|
||||
start();
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue