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

Unified Diff: lib/dom/frog/dom_frog.dart

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/frog/dom_frog.dart
diff --git a/lib/dom/frog/dom_frog.dart b/lib/dom/frog/dom_frog.dart
index 5be3f4c1695d81e1f871924db819733a4d7ab32f..2e909161f8ed1b08fa7fb04473b1da3b491ccdf6 100644
--- a/lib/dom/frog/dom_frog.dart
+++ b/lib/dom/frog/dom_frog.dart
@@ -1237,6 +1237,27 @@ class _DOMURLJs extends _DOMTypeJs implements DOMURL native "*DOMURL" {
class _DOMWindowJs extends _EventTargetJs implements DOMWindow native "@*DOMWindow" {
+ 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); };
dgrove 2012/04/21 04:47:49 did you consider something more like http://paulir
sra1 2012/04/24 18:57:09 tl;dr: yes. This 'is' the first version at that p
+ }
+ return window.requestAnimationFrame(callback);
+''';
+
+ // Protect member 'requestAnimationFrame'.
+ _requestAnimationFrame() native 'requestAnimationFrame';
+
+
static final int PERSISTENT = 1;
static final int TEMPORARY = 0;
@@ -1423,11 +1444,6 @@ class _DOMWindowJs extends _EventTargetJs implements DOMWindow native "@*DOMWind
void webkitResolveLocalFileSystemURL(String url, [EntryCallback successCallback = null, ErrorCallback errorCallback = null]) native;
-
- Window get _top() native "return this.top;";
-
- // Override top to return secure wrapper.
- Window get top() => _DOMWindowCrossFrameImpl._createSafe(_top);
}
class _DataTransferItemJs extends _DOMTypeJs implements DataTransferItem native "*DataTransferItem" {

Powered by Google App Engine
This is Rietveld 408576698