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

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

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/frog/dom_frog.dart
diff --git a/lib/dom/frog/dom_frog.dart b/lib/dom/frog/dom_frog.dart
index 5be3f4c1695d81e1f871924db819733a4d7ab32f..99bae17a4388b8cc2df53c5b9acbe206d91e59f1 100644
--- a/lib/dom/frog/dom_frog.dart
+++ b/lib/dom/frog/dom_frog.dart
@@ -1237,6 +1237,29 @@ 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, 16 /* 16ms ~= 60fps */);
+ };
+ }
+ return window.requestAnimationFrame(callback);
+''';
+
+ // Protect member 'requestAnimationFrame'.
+ _requestAnimationFrame() native 'requestAnimationFrame';
+
+
static final int PERSISTENT = 1;
static final int TEMPORARY = 0;
@@ -1423,11 +1446,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" {
« no previous file with comments | « client/tests/client/html/RequestAnimationFrameTest.dart ('k') | lib/dom/templates/dom/frog/impl_DOMWindow.darttemplate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698