Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1344)

Unified Diff: lib/dom/templates/html/frog/impl_Window.darttemplate

Issue 10166024: Browser compat for window.requestAnimationFrame (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: lib/dom/templates/html/frog/impl_Window.darttemplate
diff --git a/lib/dom/templates/html/frog/impl_Window.darttemplate b/lib/dom/templates/html/frog/impl_Window.darttemplate
index 95d5abd910f315f546498bfa97f6afd98f4c5622..746e5921b9942d51f2d7496ff72eae38229d65ad 100644
--- a/lib/dom/templates/html/frog/impl_Window.darttemplate
+++ b/lib/dom/templates/html/frog/impl_Window.darttemplate
@@ -10,5 +10,23 @@ class $CLASSNAME$EXTENDS$IMPLEMENTS native "@*DOMWindow" {
_addMeasurementFrameCallback(callback);
}
+ /** @domName DOMWindow.requestAnimationFrame */
+ int requestAnimationFrame(RequestAnimationFrameCallback callback) native '''
+ if (!window.requestAnimationFrame) {
+ window.requestAnimationFrame =
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame ||
+ window.msRequestAnimationFrame ||
+ window.oRequestAnimationFrame ||
+ function (callback) {
+ window.setTimeout(callback, 16 /* 16ms ~= 60fps */);
+ };
+ }
+ return window.requestAnimationFrame(callback);
+''';
+
+ // Protect member 'requestAnimationFrame'.
+ _requestAnimationFrame() native 'requestAnimationFrame';
+
$!MEMBERS
}

Powered by Google App Engine
This is Rietveld 408576698