From 77ab7f788fa2de43390a0ddb447c94a191284e88 Mon Sep 17 00:00:00 2001 From: Yida Wang Date: Thu, 23 Aug 2012 12:51:00 -0400 Subject: Implement requestAnimationFrame Cherry-pick from webkit-org branch on Code Aurora Forum: requestAnimationFrame doesn't throttle on Mac https://www.codeaurora.org/gitweb/quic/la/?p=platform/external/webkit.git;a=commit;h=d9dca741b4762c433ae18f7a1bc59a3a81861fc8 Timestamp parameter to requestAnimationFrame is busted in USE(REQUEST_ANIMATION_FRAME_TIMER) path https://www.codeaurora.org/gitweb/quic/la/?p=platform/external/webkit.git;a=commit;h=f0909a46fa167c84062c63caffef340a6054bc1e Rename webkitCancelRequestAnimationFrame to webkitCancelAnimationFrame to match spec change https://www.codeaurora.org/gitweb/quic/la/?p=platform/external/webkit.git;a=commit;h=cd5d11d662d638b3e4dfda33f23cda907f007f12 Remove partially implemented per-Element visibility checks from requestAnimationFrame logic https://www.codeaurora.org/gitweb/quic/la/?p=platform/external/webkit.git;a=commit;h=9fb90af3cebd0e595990cded0941d230cf77dcc1 (cherry picked from commit 47ff59a279eab9ae5dd1fd17ce7057431750a0b5) Change-Id: I7e77200006bb0c4cd4b4209082296c425bd207c1 --- ...animation-frame-timestamps-advance-expected.txt | 11 +++++++ ...request-animation-frame-timestamps-advance.html | 15 +++++++++ .../request-animation-frame-timestamps-advance.js | 37 ++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 LayoutTests/fast/animation/request-animation-frame-timestamps-advance-expected.txt create mode 100644 LayoutTests/fast/animation/request-animation-frame-timestamps-advance.html create mode 100644 LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps-advance.js (limited to 'LayoutTests') diff --git a/LayoutTests/fast/animation/request-animation-frame-timestamps-advance-expected.txt b/LayoutTests/fast/animation/request-animation-frame-timestamps-advance-expected.txt new file mode 100644 index 0000000..ff09010 --- /dev/null +++ b/LayoutTests/fast/animation/request-animation-frame-timestamps-advance-expected.txt @@ -0,0 +1,11 @@ +Tests the timestamps provided to requestAnimationFrame callbacks advance + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS firstTimestamp is defined. +PASS secondTimestamp is defined. +PASS secondTimestamp > firstTimestamp is true +PASS successfullyParsed is true + +TEST COMPLETE diff --git a/LayoutTests/fast/animation/request-animation-frame-timestamps-advance.html b/LayoutTests/fast/animation/request-animation-frame-timestamps-advance.html new file mode 100644 index 0000000..b66b511 --- /dev/null +++ b/LayoutTests/fast/animation/request-animation-frame-timestamps-advance.html @@ -0,0 +1,15 @@ + + + + + + + +

+
+ + + + + + diff --git a/LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps-advance.js b/LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps-advance.js new file mode 100644 index 0000000..52d9b90 --- /dev/null +++ b/LayoutTests/fast/animation/script-tests/request-animation-frame-timestamps-advance.js @@ -0,0 +1,37 @@ +description("Tests the timestamps provided to requestAnimationFrame callbacks advance"); + +function busyWait(millis) { + var start = Date.now(); + while (Date.now()-start < millis) {} +} + +var firstTimestamp = undefined; +var secondTimestamp = undefined; + +window.webkitRequestAnimationFrame(function(timestamp) { + firstTimestamp = timestamp; + shouldBeDefined("firstTimestamp"); + window.webkitRequestAnimationFrame(function(timestamp) { + secondTimestamp = timestamp; + shouldBeDefined("secondTimestamp"); + shouldBeTrue("secondTimestamp > firstTimestamp"); + isSuccessfullyParsed(); + if (window.layoutTestController) + layoutTestController.notifyDone(); + }); + busyWait(10); + if (window.layoutTestController) + layoutTestController.display(); +}); + + +if (window.layoutTestController) + window.setTimeout(function() { + layoutTestController.display(); + }); + + +if (window.layoutTestController) + layoutTestController.waitUntilDone(); + +var successfullyParsed = true; -- cgit v1.1