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

Unified Diff: lib/dom/templates/dom/frog/impl_DOMWindow.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
« no previous file with comments | « lib/dom/frog/dom_frog.dart ('k') | lib/dom/templates/html/dartium/impl_Window.darttemplate » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/templates/dom/frog/impl_DOMWindow.darttemplate
diff --git a/lib/dom/templates/dom/frog/impl_DOMWindow.darttemplate b/lib/dom/templates/dom/frog/impl_DOMWindow.darttemplate
index 14f8d9a7aea19978140a12f97bd33419aba53186..2d20f6f6359a70f4f5f9604a24be4b254e20f8b3 100644
--- a/lib/dom/templates/dom/frog/impl_DOMWindow.darttemplate
+++ b/lib/dom/templates/dom/frog/impl_DOMWindow.darttemplate
@@ -3,10 +3,28 @@
// BSD-style license that can be found in the LICENSE file.
class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC {
-$!MEMBERS
Window get _top() native "return this.top;";
// Override top to return secure wrapper.
Window get top() => _DOMWindowCrossFrameImpl._createSafe(_top);
+
+ 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
}
« no previous file with comments | « lib/dom/frog/dom_frog.dart ('k') | lib/dom/templates/html/dartium/impl_Window.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698