Skip to content

Commit

Permalink
Initial call to webkitRequestAnimationFrame returns 0, Spec indicates…
Browse files Browse the repository at this point in the history
… the handle should always be > 0

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: http://svn.webkit.org/repository/webkit/trunk@125633 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
grorg committed Aug 15, 2012
1 parent b533e4f commit c12a839
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
10 changes: 10 additions & 0 deletions LayoutTests/ChangeLog
@@ -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.
Expand Down
@@ -0,0 +1 @@
PASSED: Callback id was > 0
@@ -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>
15 changes: 15 additions & 0 deletions Source/WebCore/ChangeLog
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/dom/ScriptedAnimationController.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit c12a839

Please sign in to comment.