Diff
Copied: branches/chromium/1364/LayoutTests/fast/animation/request-animation-frame-prefix-expected.txt (from rev 139509, trunk/LayoutTests/fast/animation/request-animation-frame-prefix-expected.txt) (0 => 139635)
--- branches/chromium/1364/LayoutTests/fast/animation/request-animation-frame-prefix-expected.txt (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/animation/request-animation-frame-prefix-expected.txt 2013-01-14 19:45:56 UTC (rev 139635)
@@ -0,0 +1,9 @@
+Tests the timestamps provided to prefixed webkitRequestAnimationFrame callbacks
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS legacyFirstTimestamp is >= firstTimestamp
+PASS legacySecondTimestamp is >= secondTimestamp
+PASS deltaError < 0.001 is true
+
Copied: branches/chromium/1364/LayoutTests/fast/animation/request-animation-frame-prefix.html (from rev 139509, trunk/LayoutTests/fast/animation/request-animation-frame-prefix.html) (0 => 139635)
--- branches/chromium/1364/LayoutTests/fast/animation/request-animation-frame-prefix.html (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/animation/request-animation-frame-prefix.html 2013-01-14 19:45:56 UTC (rev 139635)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<span id="e"></span>
+<span id="f"></span>
+<script src=""
+</body>
+</html>
Copied: branches/chromium/1364/LayoutTests/fast/animation/script-tests/request-animation-frame-prefix.js (from rev 139509, trunk/LayoutTests/fast/animation/script-tests/request-animation-frame-prefix.js) (0 => 139635)
--- branches/chromium/1364/LayoutTests/fast/animation/script-tests/request-animation-frame-prefix.js (rev 0)
+++ branches/chromium/1364/LayoutTests/fast/animation/script-tests/request-animation-frame-prefix.js 2013-01-14 19:45:56 UTC (rev 139635)
@@ -0,0 +1,46 @@
+description("Tests the timestamps provided to prefixed webkitRequestAnimationFrame callbacks");
+
+var firstTimestamp = undefined;
+var secondTimestamp = undefined;
+var legacyFirstTimestamp = undefined;
+var legacySecondTimestamp = undefined;
+var deltaError = undefined;
+
+function busyWait(millis) {
+ var start = Date.now();
+ while (Date.now()-start < millis) {}
+}
+
+window.requestAnimationFrame(function(timestamp) {
+ firstTimestamp = timestamp;
+});
+
+window.webkitRequestAnimationFrame(function(timestamp) {
+ legacyFirstTimestamp = timestamp;
+
+ window.requestAnimationFrame(function(timestamp) {
+ secondTimestamp = timestamp;
+ });
+
+ window.webkitRequestAnimationFrame(function(timestamp) {
+ legacySecondTimestamp = timestamp;
+
+ shouldBeGreaterThanOrEqual("legacyFirstTimestamp", "firstTimestamp");
+ shouldBeGreaterThanOrEqual("legacySecondTimestamp", "secondTimestamp");
+ deltaError = Math.abs((legacySecondTimestamp - legacyFirstTimestamp) - (secondTimestamp - firstTimestamp));
+ shouldBeTrue("deltaError < 0.001");
+ testRunner.notifyDone();
+ });
+
+ busyWait(10);
+ if (window.testRunner)
+ testRunner.display();
+});
+
+if (window.testRunner)
+ window.setTimeout(function() {
+ testRunner.display();
+ });
+
+if (window.testRunner)
+ testRunner.waitUntilDone();
Modified: branches/chromium/1364/Source/WebCore/dom/RequestAnimationFrameCallback.h (139634 => 139635)
--- branches/chromium/1364/Source/WebCore/dom/RequestAnimationFrameCallback.h 2013-01-14 19:43:42 UTC (rev 139634)
+++ branches/chromium/1364/Source/WebCore/dom/RequestAnimationFrameCallback.h 2013-01-14 19:45:56 UTC (rev 139635)
@@ -42,6 +42,7 @@
int m_id;
bool m_firedOrCancelled;
+ bool m_useLegacyTimeBase;
};
}
Modified: branches/chromium/1364/Source/WebCore/dom/ScriptedAnimationController.cpp (139634 => 139635)
--- branches/chromium/1364/Source/WebCore/dom/ScriptedAnimationController.cpp 2013-01-14 19:43:42 UTC (rev 139634)
+++ branches/chromium/1364/Source/WebCore/dom/ScriptedAnimationController.cpp 2013-01-14 19:45:56 UTC (rev 139635)
@@ -114,6 +114,7 @@
return;
double highResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTimeToZeroBasedDocumentTime(monotonicTimeNow);
+ double legacyHighResNowMs = 1000.0 * m_document->loader()->timing()->monotonicTimeToPseudoWallTime(monotonicTimeNow);
// First, generate a list of callbacks to consider. Callbacks registered from this point
// on are considered only for the "next" frame, not this one.
@@ -128,7 +129,10 @@
if (!callback->m_firedOrCancelled) {
callback->m_firedOrCancelled = true;
InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireAnimationFrame(m_document, callback->m_id);
- callback->handleEvent(highResNowMs);
+ if (callback->m_useLegacyTimeBase)
+ callback->handleEvent(legacyHighResNowMs);
+ else
+ callback->handleEvent(highResNowMs);
InspectorInstrumentation::didFireAnimationFrame(cookie);
}
}
Modified: branches/chromium/1364/Source/WebCore/page/DOMWindow.cpp (139634 => 139635)
--- branches/chromium/1364/Source/WebCore/page/DOMWindow.cpp 2013-01-14 19:43:42 UTC (rev 139634)
+++ branches/chromium/1364/Source/WebCore/page/DOMWindow.cpp 2013-01-14 19:45:56 UTC (rev 139635)
@@ -1549,11 +1549,20 @@
#if ENABLE(REQUEST_ANIMATION_FRAME)
int DOMWindow::requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
{
+ callback->m_useLegacyTimeBase = false;
if (Document* d = document())
return d->requestAnimationFrame(callback);
return 0;
}
+int DOMWindow::webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback> callback)
+{
+ callback->m_useLegacyTimeBase = true;
+ if (Document* d = document())
+ return d->requestAnimationFrame(callback);
+ return 0;
+}
+
void DOMWindow::cancelAnimationFrame(int id)
{
if (Document* d = document())
Modified: branches/chromium/1364/Source/WebCore/page/DOMWindow.h (139634 => 139635)
--- branches/chromium/1364/Source/WebCore/page/DOMWindow.h 2013-01-14 19:43:42 UTC (rev 139634)
+++ branches/chromium/1364/Source/WebCore/page/DOMWindow.h 2013-01-14 19:45:56 UTC (rev 139635)
@@ -264,6 +264,7 @@
// WebKit animation extensions
#if ENABLE(REQUEST_ANIMATION_FRAME)
int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
+ int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
void cancelAnimationFrame(int id);
#endif
Modified: branches/chromium/1364/Source/WebCore/page/DOMWindow.idl (139634 => 139635)
--- branches/chromium/1364/Source/WebCore/page/DOMWindow.idl 2013-01-14 19:43:42 UTC (rev 139634)
+++ branches/chromium/1364/Source/WebCore/page/DOMWindow.idl 2013-01-14 19:45:56 UTC (rev 139635)
@@ -216,7 +216,7 @@
#if defined(ENABLE_REQUEST_ANIMATION_FRAME) && ENABLE_REQUEST_ANIMATION_FRAME
[V8MeasureAs=UnprefixedRequestAnimationFrame] long requestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback);
void cancelAnimationFrame(in long id);
- [ImplementedAs=requestAnimationFrame, V8MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback);
+ [V8MeasureAs=PrefixedRequestAnimationFrame] long webkitRequestAnimationFrame(in [Callback] RequestAnimationFrameCallback callback);
[ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(in long id);
[ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(in long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove this when removing vendor prefix.
#endif