Initial call to webkitRequestAnimationFrame returns 0, Spec indicates the handle...
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Aug 2012 01:51:14 +0000 (01:51 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 15 Aug 2012 01:51:14 +0000 (01:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=85819

Reviewed by James Robinson.

Source/WebCore:

The callback id returned by requestAnimationFrame was beginning at zero, when the spec
says it should be above one. Use a pre-increment rather than a post-increment.

Test: fast/animation/request-animation-frame-callback-id.html

* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::registerCallback): Pre-increment rather than post-increment.

LayoutTests:

* fast/animation/request-animation-frame-callback-id-expected.txt: Added.
* fast/animation/request-animation-frame-callback-id.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@125633 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/animation/request-animation-frame-callback-id-expected.txt [new file with mode: 0644]
LayoutTests/fast/animation/request-animation-frame-callback-id.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/ScriptedAnimationController.cpp

index 4820387..afd4eec 100644 (file)
@@ -1,3 +1,13 @@
+2012-08-14  Dean Jackson  <dino@apple.com>
+
+        Initial call to webkitRequestAnimationFrame returns 0, Spec indicates the handle should always be > 0
+        https://bugs.webkit.org/show_bug.cgi?id=85819
+
+        Reviewed by James Robinson.
+
+        * fast/animation/request-animation-frame-callback-id-expected.txt: Added.
+        * fast/animation/request-animation-frame-callback-id.html: Added.
+
 2012-08-14  Chris Evans  <cevans@google.com>
 
         Handle the XPath / (root) operator correctly for nodes that aren't attached to the document.
diff --git a/LayoutTests/fast/animation/request-animation-frame-callback-id-expected.txt b/LayoutTests/fast/animation/request-animation-frame-callback-id-expected.txt
new file mode 100644 (file)
index 0000000..6f9df1c
--- /dev/null
@@ -0,0 +1 @@
+PASSED: Callback id was > 0
diff --git a/LayoutTests/fast/animation/request-animation-frame-callback-id.html b/LayoutTests/fast/animation/request-animation-frame-callback-id.html
new file mode 100644 (file)
index 0000000..8deed4c
--- /dev/null
@@ -0,0 +1,22 @@
+<script>
+if (window.testRunner) {
+    window.testRunner.dumpAsText();
+    window.testRunner.waitUntilDone();
+}
+
+function runTest() {
+    var id = window.webkitRequestAnimationFrame(function () {});
+    var results = document.getElementById("results");
+
+    if (id > 0)
+        results.innerText = "PASSED: Callback id was > 0";
+    else
+        results.innerText = "FAILED: Callback id was <= 0";
+
+    if (window.testRunner)
+        window.testRunner.notifyDone();
+}
+
+window.addEventListener("load", runTest, false);
+</script>
+<div id="results"></div>
\ No newline at end of file
index 97a7b57..b991e18 100644 (file)
@@ -1,3 +1,18 @@
+2012-08-14  Dean Jackson  <dino@apple.com>
+
+        Initial call to webkitRequestAnimationFrame returns 0, Spec indicates the handle should always be > 0
+        https://bugs.webkit.org/show_bug.cgi?id=85819
+
+        Reviewed by James Robinson.
+
+        The callback id returned by requestAnimationFrame was beginning at zero, when the spec
+        says it should be above one. Use a pre-increment rather than a post-increment.
+
+        Test: fast/animation/request-animation-frame-callback-id.html
+
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::registerCallback): Pre-increment rather than post-increment.
+
 2012-08-14  Levi Weintraub  <leviw@chromium.org>
 
         r125591 broke tests with SUBPIXEL_LAYOUT disabled
index 974483d..628f109 100644 (file)
@@ -83,7 +83,7 @@ void ScriptedAnimationController::resume()
 
 ScriptedAnimationController::CallbackId ScriptedAnimationController::registerCallback(PassRefPtr<RequestAnimationFrameCallback> callback)
 {
-    ScriptedAnimationController::CallbackId id = m_nextCallbackId++;
+    ScriptedAnimationController::CallbackId id = ++m_nextCallbackId;
     callback->m_firedOrCancelled = false;
     callback->m_id = id;
     m_callbacks.append(callback);