diff options
| author | jamesr@google.com <jamesr@google.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2011-01-20 02:59:06 +0000 |
|---|---|---|
| committer | jamesr@google.com <jamesr@google.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2011-01-20 02:59:06 +0000 |
| commit | 9835a1f22221e2384ed31aade6f71a0b5e487191 (patch) | |
| tree | 571280cf01c0da1f0545e82d003dde6701f7c1f8 /third_party/WebKit/LayoutTests/fast/animation/request-animation-frame-within-callback.html | |
| parent | 0005a77a1609b5fc1ab1c6bc93b6a1e28b16f0a0 (diff) | |
| download | chromium_src-9835a1f22221e2384ed31aade6f71a0b5e487191.zip chromium_src-9835a1f22221e2384ed31aade6f71a0b5e487191.tar.gz chromium_src-9835a1f22221e2384ed31aade6f71a0b5e487191.tar.bz2 | |
2011-01-19 James Robinson <jamesr@chromium.org>
Reviewed by Darin Fisher.
Implement mozilla's requestAnimationFrame API
https://bugs.webkit.org/show_bug.cgi?id=51218
Tests for window.webkitRequestAnimationFrame(). The new tests
are in the Skipped lists for platforms that do not set
ENABLE(REQUEST_ANIMATION_FRAME) - which is currently all but chromium.
* fast/animation/request-animation-frame-cancel-expected.txt: Added.
* fast/animation/request-animation-frame-cancel.html: Added.
Tests cancelling a callback within a webkitRequestAnimationFrame() callback.
* fast/animation/request-animation-frame-cancel2-expected.txt: Added.
* fast/animation/request-animation-frame-cancel2.html: Added.
Tests interactions between multiple webkitRequestAnimationFrame() callbacks.
* fast/animation/request-animation-frame-display-expected.txt: Added.
* fast/animation/request-animation-frame-display.html: Added.
Tests changing the display: property of an element within a callback.
* fast/animation/request-animation-frame-expected.txt: Added.
* fast/animation/request-animation-frame.html: Added.
Tests the basic use of window.webkitRequestAnimationFrame().
* fast/animation/request-animation-frame-within-callback-expected.txt: Added.
* fast/animation/request-animation-frame-within-callback.html: Added.
Tests setting one webkit.webkitRequestAnimationFrame() callback within another.
* platform/gtk/Skipped:
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
2011-01-19 James Robinson <jamesr@chromium.org>
Reviewed by Darin Fisher.
Implement mozilla's requestAnimationFrame API
https://bugs.webkit.org/show_bug.cgi?id=51218
This implements mozilla's proposed requestAnimationFrame API. The idea with this API is that
an author driving an animation from script could use window.requestAnimationFrame(callback)
instead of window.setTimeout(callback, 0) to schedule their update logic and let the browser
decide when to update the animations. This avoids doing unnecessary work when the page content
is offscreen or is being displayed at a different framerate than what the page author expects.
Mozilla's proposal is here: https://developer.mozilla.org/en/DOM/window.mozRequestAnimationFrame
This implements window.mozRequestAnimationFrame as window.webkitRequestAnimationFrame with the
following changes:
*) Only the callback syntax is supported, there is no before paint event
*) webkitRequestAnimationFrame supports a second parameter Element to let the author indicate
what content they intend to animate. That way if the page is being displayed but the element
in question is offscreen, we can avoid invoking the callback.
*) No timestamp is provided to the caller and there is no window.animationStartTime property
(see https://bugs.webkit.org/show_bug.cgi?id=51952 for discussion of this property)
*) window.webkitRequestAnimationFrame returns a numerical id that can be used to cancel the callback
using window.cancelWebkitRequestAnimationFrame, to parallel window.setTimeout()/window.clearTime().
The implementation depends on the embedder scheduling the callbacks since the callback invocation
depends on the page's visibility and the embedder's paint scheduling, neither of which are exposed
to WebCore. The expectation for the embedder is that at some point Chrome::scheduleAnimation() is
called FrameView::serviceScriptedAnimations() should be called for the associated Page's main frame.
Ideally serviceScriptedAnimations() would be called prior to rendering - although in practice the
embedder has to rate limit callbacks and may not be able to tie the callback directly to the
rendering loop.
Tests: fast/animation/request-animation-frame-cancel.html
fast/animation/request-animation-frame-cancel2.html
fast/animation/request-animation-frame-display.html
fast/animation/request-animation-frame-within-callback.html
fast/animation/request-animation-frame.html
* WebCore.gypi:
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::webkitRequestAnimationFrame):
(WebCore::Document::webkitCancelRequestAnimationFrame):
(WebCore::Document::serviceScriptedAnimations):
* dom/Document.h:
* dom/RequestAnimationFrameCallback.h: Added.
(WebCore::RequestAnimationFrameCallback::~RequestAnimationFrameCallback):
* dom/RequestAnimationFrameCallback.idl: Added.
* loader/EmptyClients.h:
(WebCore::EmptyChromeClient::scheduleAnimation):
* page/Chrome.cpp:
(WebCore::Chrome::scheduleAnimation):
* page/Chrome.h:
* page/ChromeClient.h:
* page/DOMWindow.cpp:
(WebCore::DOMWindow::webkitRequestAnimationFrame):
(WebCore::DOMWindow::webkitCancelRequestAnimationFrame):
* page/DOMWindow.h:
* page/DOMWindow.idl:
* page/FrameView.cpp:
(WebCore::FrameView::scheduleAnimation):
(WebCore::FrameView::serviceScriptedAnimations):
* page/FrameView.h:
* platform/HostWindow.h:
2011-01-19 James Robinson <jamesr@chromium.org>
Reviewed by Darin Fisher.
Implement mozilla's requestAnimationFrame API
https://bugs.webkit.org/show_bug.cgi?id=51218
Chromium WebKit API support for window.webkitRequestAnimationFrame()
* features.gypi:
* public/WebWidget.h:
* public/WebWidgetClient.h:
(WebKit::WebWidgetClient::scheduleAnimation):
* src/ChromeClientImpl.cpp:
(WebKit::ChromeClientImpl::scheduleAnimation):
* src/ChromeClientImpl.h:
* src/WebPopupMenuImpl.cpp:
(WebKit::WebPopupMenuImpl::animate):
(WebKit::WebPopupMenuImpl::scheduleAnimation):
* src/WebPopupMenuImpl.h:
* src/WebViewImpl.cpp:
(WebKit::WebViewImpl::animate):
* src/WebViewImpl.h:
2011-01-19 James Robinson <jamesr@chromium.org>
Reviewed by Darin Fisher.
Implement mozilla's requestAnimationFrame API
https://bugs.webkit.org/show_bug.cgi?id=51218
Chromium DumpRenderTree support for window.webkitRequestAnimationFrame.
* DumpRenderTree/chromium/WebViewHost.cpp:
(invokeScheduleComposite):
(WebViewHost::scheduleAnimation):
(WebViewHost::paintInvalidatedRegion):
* DumpRenderTree/chromium/WebViewHost.h:
git-svn-id: svn://svn.chromium.org/blink/trunk@76194 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/animation/request-animation-frame-within-callback.html')
| -rw-r--r-- | third_party/WebKit/LayoutTests/fast/animation/request-animation-frame-within-callback.html | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/animation/request-animation-frame-within-callback.html b/third_party/WebKit/LayoutTests/fast/animation/request-animation-frame-within-callback.html new file mode 100644 index 0000000..d5a366f --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/animation/request-animation-frame-within-callback.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> +<html> +<span id="e">FAIL</span> +<script> +if (window.layoutTestController) + layoutTestController.dumpAsText(); + +var e = document.getElementById("e"); +var sameFrame; +window.webkitRequestAnimationFrame(function() { + sameFrame = true; +}, e); +window.webkitRequestAnimationFrame(function() { + window.webkitRequestAnimationFrame(function() { + e.innerHTML = sameFrame ? "FAIL" : "PASS"; + }, e); +}, e); +window.webkitRequestAnimationFrame(function() { + sameFrame = false; +}, e); + +// This should fire the three already registered callbacks, but not the one dynamically registered. +if (window.layoutTestController) + layoutTestController.display(); +// This should fire the dynamically registered callback. +if (window.layoutTestController) + layoutTestController.display(); +</script> |
