summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/WebCore/dom/RequestAnimationFrameCallback.h1
-rw-r--r--Source/WebCore/dom/ScriptedAnimationController.cpp6
-rw-r--r--Source/WebCore/page/DOMWindow.cpp9
-rw-r--r--Source/WebCore/page/DOMWindow.h1
-rw-r--r--Source/WebCore/page/DOMWindow.idl2
5 files changed, 17 insertions, 2 deletions
diff --git a/Source/WebCore/dom/RequestAnimationFrameCallback.h b/Source/WebCore/dom/RequestAnimationFrameCallback.h
index f1347268a..52580dc53 100644
--- a/Source/WebCore/dom/RequestAnimationFrameCallback.h
+++ b/Source/WebCore/dom/RequestAnimationFrameCallback.h
@@ -42,6 +42,7 @@ public:
int m_id;
bool m_firedOrCancelled;
+ bool m_useLegacyTimeBase;
};
}
diff --git a/Source/WebCore/dom/ScriptedAnimationController.cpp b/Source/WebCore/dom/ScriptedAnimationController.cpp
index 2f7862bdd..afa131b1a 100644
--- a/Source/WebCore/dom/ScriptedAnimationController.cpp
+++ b/Source/WebCore/dom/ScriptedAnimationController.cpp
@@ -114,6 +114,7 @@ void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTime
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 @@ void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTime
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);
}
}
diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp
index 3d82599fb..0a6bc1949 100644
--- a/Source/WebCore/page/DOMWindow.cpp
+++ b/Source/WebCore/page/DOMWindow.cpp
@@ -1551,6 +1551,15 @@ void DOMWindow::clearInterval(int timeoutId)
#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;
diff --git a/Source/WebCore/page/DOMWindow.h b/Source/WebCore/page/DOMWindow.h
index 424f58a2e..79029d08b 100644
--- a/Source/WebCore/page/DOMWindow.h
+++ b/Source/WebCore/page/DOMWindow.h
@@ -264,6 +264,7 @@ namespace WebCore {
// WebKit animation extensions
#if ENABLE(REQUEST_ANIMATION_FRAME)
int requestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
+ int webkitRequestAnimationFrame(PassRefPtr<RequestAnimationFrameCallback>);
void cancelAnimationFrame(int id);
#endif
diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl
index 4a3a5f4de..5fe8c177a 100644
--- a/Source/WebCore/page/DOMWindow.idl
+++ b/Source/WebCore/page/DOMWindow.idl
@@ -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