Diff
Modified: trunk/LayoutTests/ChangeLog (139508 => 139509)
--- trunk/LayoutTests/ChangeLog 2013-01-11 23:09:37 UTC (rev 139508)
+++ trunk/LayoutTests/ChangeLog 2013-01-11 23:18:06 UTC (rev 139509)
@@ -1,3 +1,16 @@
+2013-01-11 James Simonsen <simon...@chromium.org>
+
+ Restore old semantics to webkitRequestAnimationFrame callbacks
+ https://bugs.webkit.org/show_bug.cgi?id=106697
+
+ Reviewed by James Robinson.
+
+ * fast/animation/request-animation-frame-prefix-expected.txt: Added.
+ * fast/animation/request-animation-frame-prefix.html: Added.
+ * fast/animation/script-tests/request-animation-frame-prefix.js: Added.
+ (busyWait):
+ (window.webkitRequestAnimationFrame):
+
2013-01-11 Kenneth Russell <k...@google.com>
[Chromium] Layout Test fast/canvas/webgl/context-release-upon-reload.html is a flaky timeout
Added: trunk/LayoutTests/fast/animation/request-animation-frame-prefix-expected.txt (0 => 139509)
--- trunk/LayoutTests/fast/animation/request-animation-frame-prefix-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/animation/request-animation-frame-prefix-expected.txt 2013-01-11 23:18:06 UTC (rev 139509)
@@ -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
+
Added: trunk/LayoutTests/fast/animation/request-animation-frame-prefix.html (0 => 139509)
--- trunk/LayoutTests/fast/animation/request-animation-frame-prefix.html (rev 0)
+++ trunk/LayoutTests/fast/animation/request-animation-frame-prefix.html 2013-01-11 23:18:06 UTC (rev 139509)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<span id="e"></span>
+<span id="f"></span>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/animation/script-tests/request-animation-frame-prefix.js (0 => 139509)
--- trunk/LayoutTests/fast/animation/script-tests/request-animation-frame-prefix.js (rev 0)
+++ trunk/LayoutTests/fast/animation/script-tests/request-animation-frame-prefix.js 2013-01-11 23:18:06 UTC (rev 139509)
@@ -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: trunk/Source/WebCore/ChangeLog (139508 => 139509)
--- trunk/Source/WebCore/ChangeLog 2013-01-11 23:09:37 UTC (rev 139508)
+++ trunk/Source/WebCore/ChangeLog 2013-01-11 23:18:06 UTC (rev 139509)
@@ -1,3 +1,28 @@
+2013-01-11 James Simonsen <simon...@chromium.org>
+
+ Restore old semantics to webkitRequestAnimationFrame callbacks
+ https://bugs.webkit.org/show_bug.cgi?id=106697
+
+ Reviewed by James Robinson.
+
+ Sites that use GWT <= 2.4 are buggy and rely on Date.now()-like callback values.
+ We'll restore that behavior to the prefixed version of webkitRequestAnimationFrame.
+ requestAnimationFrame will continue to follow the spec.
+
+ Test: fast/animation/request-animation-frame-prefix.html
+
+ * dom/RequestAnimationFrameCallback.h:
+ (RequestAnimationFrameCallback):
+ * dom/ScriptedAnimationController.cpp:
+ (WebCore::ScriptedAnimationController::serviceScriptedAnimations):
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::requestAnimationFrame):
+ (WebCore):
+ (WebCore::DOMWindow::webkitRequestAnimationFrame):
+ * page/DOMWindow.h:
+ (DOMWindow):
+ * page/DOMWindow.idl:
+
2013-01-11 Sheriff Bot <webkit.review....@gmail.com>
Unreviewed, rolling out r139044.
Modified: trunk/Source/WebCore/dom/RequestAnimationFrameCallback.h (139508 => 139509)
--- trunk/Source/WebCore/dom/RequestAnimationFrameCallback.h 2013-01-11 23:09:37 UTC (rev 139508)
+++ trunk/Source/WebCore/dom/RequestAnimationFrameCallback.h 2013-01-11 23:18:06 UTC (rev 139509)
@@ -42,6 +42,7 @@
int m_id;
bool m_firedOrCancelled;
+ bool m_useLegacyTimeBase;
};
}
Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (139508 => 139509)
--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp 2013-01-11 23:09:37 UTC (rev 139508)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp 2013-01-11 23:18:06 UTC (rev 139509)
@@ -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: trunk/Source/WebCore/page/DOMWindow.cpp (139508 => 139509)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2013-01-11 23:09:37 UTC (rev 139508)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2013-01-11 23:18:06 UTC (rev 139509)
@@ -1550,11 +1550,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: trunk/Source/WebCore/page/DOMWindow.h (139508 => 139509)
--- trunk/Source/WebCore/page/DOMWindow.h 2013-01-11 23:09:37 UTC (rev 139508)
+++ trunk/Source/WebCore/page/DOMWindow.h 2013-01-11 23:18:06 UTC (rev 139509)
@@ -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: trunk/Source/WebCore/page/DOMWindow.idl (139508 => 139509)
--- trunk/Source/WebCore/page/DOMWindow.idl 2013-01-11 23:09:37 UTC (rev 139508)
+++ trunk/Source/WebCore/page/DOMWindow.idl 2013-01-11 23:18:06 UTC (rev 139509)
@@ -208,7 +208,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