| 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 part of html; | 5 part of html; |
| 6 | 6 |
| 7 /// @domName $DOMNAME | 7 /// @domName $DOMNAME |
| 8 class $CLASSNAME$EXTENDS$IMPLEMENTS native "@*DOMWindow" { | 8 class $CLASSNAME$EXTENDS$IMPLEMENTS native "@*DOMWindow" { |
| 9 | 9 |
| 10 Document get document => JS('Document', '#.document', this); | 10 Document get document => JS('Document', '#.document', this); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 _LocationWrapper _location_wrapper; // Cached wrapped Location object. | 52 _LocationWrapper _location_wrapper; // Cached wrapped Location object. |
| 53 | 53 |
| 54 // Native getter and setter to access raw Location object. | 54 // Native getter and setter to access raw Location object. |
| 55 Location get _location => JS('Location', '#.location', this); | 55 Location get _location => JS('Location', '#.location', this); |
| 56 void set _location(Location value) { | 56 void set _location(Location value) { |
| 57 JS('void', '#.location = #', this, value); | 57 JS('void', '#.location = #', this, value); |
| 58 } | 58 } |
| 59 // Prevent compiled from thinking 'location' property is available for a Dart | 59 // Prevent compiled from thinking 'location' property is available for a Dart |
| 60 // member. | 60 // member. |
| 61 @JSName('location') | 61 _protect_location() native 'location'; |
| 62 _protect_location() native; | |
| 63 | 62 |
| 64 static _isDartLocation(thing) { | 63 static _isDartLocation(thing) { |
| 65 // On Firefox the code that implements 'is Location' fails to find the patch | 64 // On Firefox the code that implements 'is Location' fails to find the patch |
| 66 // stub on Object.prototype and throws an exception. | 65 // stub on Object.prototype and throws an exception. |
| 67 try { | 66 try { |
| 68 return thing is Location; | 67 return thing is Location; |
| 69 } catch (e) { | 68 } catch (e) { |
| 70 return false; | 69 return false; |
| 71 } | 70 } |
| 72 } | 71 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 84 int requestAnimationFrame(RequestAnimationFrameCallback callback) { | 83 int requestAnimationFrame(RequestAnimationFrameCallback callback) { |
| 85 _ensureRequestAnimationFrame(); | 84 _ensureRequestAnimationFrame(); |
| 86 return _requestAnimationFrame(callback); | 85 return _requestAnimationFrame(callback); |
| 87 } | 86 } |
| 88 | 87 |
| 89 void cancelAnimationFrame(id) { | 88 void cancelAnimationFrame(id) { |
| 90 _ensureRequestAnimationFrame(); | 89 _ensureRequestAnimationFrame(); |
| 91 _cancelAnimationFrame(id); | 90 _cancelAnimationFrame(id); |
| 92 } | 91 } |
| 93 | 92 |
| 94 @JSName('requestAnimationFrame') | 93 int _requestAnimationFrame(RequestAnimationFrameCallback callback) |
| 95 int _requestAnimationFrame(RequestAnimationFrameCallback callback) native; | 94 native 'requestAnimationFrame'; |
| 96 | 95 |
| 97 @JSName('cancelAnimationFrame') | 96 void _cancelAnimationFrame(int id) |
| 98 void _cancelAnimationFrame(int id) native; | 97 native 'cancelAnimationFrame'; |
| 99 | 98 |
| 100 _ensureRequestAnimationFrame() { | 99 _ensureRequestAnimationFrame() { |
| 101 if (JS('bool', | 100 if (JS('bool', |
| 102 '!!(#.requestAnimationFrame && #.cancelAnimationFrame)', this, this)) | 101 '!!(#.requestAnimationFrame && #.cancelAnimationFrame)', this, this)) |
| 103 return; | 102 return; |
| 104 | 103 |
| 105 JS('void', | 104 JS('void', |
| 106 r""" | 105 r""" |
| 107 (function($this) { | 106 (function($this) { |
| 108 var vendors = ['ms', 'moz', 'webkit', 'o']; | 107 var vendors = ['ms', 'moz', 'webkit', 'o']; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 * port may be retrieved by any isolate (or JavaScript script) | 141 * port may be retrieved by any isolate (or JavaScript script) |
| 143 * running in this window. | 142 * running in this window. |
| 144 */ | 143 */ |
| 145 void registerPort(String name, var port) { | 144 void registerPort(String name, var port) { |
| 146 var serialized = _serialize(port); | 145 var serialized = _serialize(port); |
| 147 document.documentElement.attributes['dart-port:$name'] = JSON.stringify(seri
alized); | 146 document.documentElement.attributes['dart-port:$name'] = JSON.stringify(seri
alized); |
| 148 } | 147 } |
| 149 | 148 |
| 150 $!MEMBERS | 149 $!MEMBERS |
| 151 } | 150 } |
| OLD | NEW |