OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 5 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
6 $!MEMBERS | |
7 | 6 |
8 Window get _top() native "return this.top;"; | 7 Window get _top() native "return this.top;"; |
9 | 8 |
10 // Override top to return secure wrapper. | 9 // Override top to return secure wrapper. |
11 Window get top() => _DOMWindowCrossFrameImpl._createSafe(_top); | 10 Window get top() => _DOMWindowCrossFrameImpl._createSafe(_top); |
| 11 |
| 12 int requestAnimationFrame(RequestAnimationFrameCallback callback) native ''' |
| 13 if (!window.requestAnimationFrame) { |
| 14 window.requestAnimationFrame = |
| 15 window.webkitRequestAnimationFrame || |
| 16 window.mozRequestAnimationFrame || |
| 17 window.msRequestAnimationFrame || |
| 18 window.oRequestAnimationFrame || |
| 19 function (callback) { |
| 20 window.setTimeout(callback, 16 /* 16ms ~= 60fps */); |
| 21 }; |
| 22 } |
| 23 return window.requestAnimationFrame(callback); |
| 24 '''; |
| 25 |
| 26 // Protect member 'requestAnimationFrame'. |
| 27 _requestAnimationFrame() native 'requestAnimationFrame'; |
| 28 |
| 29 $!MEMBERS |
12 } | 30 } |
OLD | NEW |