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

Unified Diff: lib/dom/templates/dom/frog/impl_DOMWindow.darttemplate

Issue 10161014: 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/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..400ffa753aab0f799cdae7a56754ace7e99c0820 100644
--- a/lib/dom/templates/dom/frog/impl_DOMWindow.darttemplate
+++ b/lib/dom/templates/dom/frog/impl_DOMWindow.darttemplate
@@ -3,10 +3,26 @@
// 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, 1000/60); };
+ }
+ return window.requestAnimationFrame(callback);
+''';
+
+ // Protect member 'requestAnimationFrame'.
+ _requestAnimationFrame() native 'requestAnimationFrame';
+
+$!MEMBERS
}

Powered by Google App Engine
This is Rietveld 408576698