| 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 $LIBRARYNAME; | 5 part of $LIBRARYNAME; |
| 6 | 6 |
| 7 @DocsEditable() | 7 @DocsEditable() |
| 8 $if DART2JS | 8 $if DART2JS |
| 9 $(ANNOTATIONS)@Native("Window,DOMWindow") | 9 $(ANNOTATIONS)@Native("Window,DOMWindow") |
| 10 $(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { | 10 $(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 }); | 34 }); |
| 35 return completer.future; | 35 return completer.future; |
| 36 } | 36 } |
| 37 | 37 |
| 38 $if DART2JS | 38 $if DART2JS |
| 39 /** | 39 /** |
| 40 * The newest document in this window. | 40 * The newest document in this window. |
| 41 * | 41 * |
| 42 * ## Other resources | 42 * ## Other resources |
| 43 * | 43 * |
| 44 * * [Loading web pages] | 44 * * [Loading web |
| 45 * (http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html) | 45 * pages](https://html.spec.whatwg.org/multipage/browsers.html) |
| 46 * from WHATWG. | 46 * from WHATWG. |
| 47 */ | 47 */ |
| 48 Document get document => JS('Document', '#.document', this); | 48 Document get document => JS('Document', '#.document', this); |
| 49 | 49 |
| 50 WindowBase _open2(url, name) => JS('Window', '#.open(#,#)', this, url, name); | 50 WindowBase _open2(url, name) => JS('Window', '#.open(#,#)', this, url, name); |
| 51 | 51 |
| 52 WindowBase _open3(url, name, options) => | 52 WindowBase _open3(url, name, options) => |
| 53 JS('Window', '#.open(#,#,#)', this, url, name, options); | 53 JS('Window', '#.open(#,#,#)', this, url, name, options); |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * Opens a new window. | 56 * Opens a new window. |
| 57 * | 57 * |
| 58 * ## Other resources | 58 * ## Other resources |
| 59 * | 59 * |
| 60 * * [Window.open] | 60 * * [Window.open](https://developer.mozilla.org/en-US/docs/Web/API/Window.ope
n) |
| 61 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.open) from MDN. | 61 * from MDN. |
| 62 * * [Window open] | 62 * * [Window open](http://docs.webplatform.org/wiki/dom/methods/open) |
| 63 * (http://docs.webplatform.org/wiki/dom/methods/open) from WebPlatform.org. | 63 * from WebPlatform.org. |
| 64 */ | 64 */ |
| 65 WindowBase open(String url, String name, [String options]) { | 65 WindowBase open(String url, String name, [String options]) { |
| 66 if (options == null) { | 66 if (options == null) { |
| 67 return _DOMWindowCrossFrame._createSafe(_open2(url, name)); | 67 return _DOMWindowCrossFrame._createSafe(_open2(url, name)); |
| 68 } else { | 68 } else { |
| 69 return _DOMWindowCrossFrame._createSafe(_open3(url, name, options)); | 69 return _DOMWindowCrossFrame._createSafe(_open3(url, name, options)); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 // API level getter and setter for Location. | 73 // API level getter and setter for Location. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 int requestAnimationFrame(RequestAnimationFrameCallback callback) { | 115 int requestAnimationFrame(RequestAnimationFrameCallback callback) { |
| 116 _ensureRequestAnimationFrame(); | 116 _ensureRequestAnimationFrame(); |
| 117 return _requestAnimationFrame(_wrapZone(callback)); | 117 return _requestAnimationFrame(_wrapZone(callback)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 /** | 120 /** |
| 121 * Cancels an animation frame request. | 121 * Cancels an animation frame request. |
| 122 * | 122 * |
| 123 * ## Other resources | 123 * ## Other resources |
| 124 * | 124 * |
| 125 * * [Window.cancelAnimationFrame] | 125 * * [Window.cancelAnimationFrame](https://developer.mozilla.org/en-US/docs/We
b/API/Window.cancelAnimationFrame) |
| 126 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.cancelAnimationFra
me) from MDN. | 126 * from MDN. |
| 127 */ | 127 */ |
| 128 void cancelAnimationFrame(int id) { | 128 void cancelAnimationFrame(int id) { |
| 129 _ensureRequestAnimationFrame(); | 129 _ensureRequestAnimationFrame(); |
| 130 _cancelAnimationFrame(id); | 130 _cancelAnimationFrame(id); |
| 131 } | 131 } |
| 132 | 132 |
| 133 @JSName('requestAnimationFrame') | 133 @JSName('requestAnimationFrame') |
| 134 int _requestAnimationFrame(RequestAnimationFrameCallback callback) native; | 134 int _requestAnimationFrame(RequestAnimationFrameCallback callback) native; |
| 135 | 135 |
| 136 @JSName('cancelAnimationFrame') | 136 @JSName('cancelAnimationFrame') |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 @DomName('Window.onbeforeunload') | 237 @DomName('Window.onbeforeunload') |
| 238 Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this); | 238 Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this); |
| 239 | 239 |
| 240 /** | 240 /** |
| 241 * Moves this window to a specific position. | 241 * Moves this window to a specific position. |
| 242 * | 242 * |
| 243 * x and y can be negative. | 243 * x and y can be negative. |
| 244 * | 244 * |
| 245 * ## Other resources | 245 * ## Other resources |
| 246 * | 246 * |
| 247 * * [Window.moveTo] | 247 * * [Window.moveTo](https://developer.mozilla.org/en-US/docs/Web/API/Window.m
oveTo) |
| 248 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.moveTo) from MDN. | 248 * from MDN. |
| 249 * * [Window.moveTo] | 249 * * [Window.moveTo](http://dev.w3.org/csswg/cssom-view/#dom-window-moveto) |
| 250 * (http://dev.w3.org/csswg/cssom-view/#dom-window-moveto) from W3C. | 250 * from W3C. |
| 251 */ | 251 */ |
| 252 void moveTo(Point p) { | 252 void moveTo(Point p) { |
| 253 _moveTo(p.x, p.y); | 253 _moveTo(p.x, p.y); |
| 254 } | 254 } |
| 255 | 255 |
| 256 $if DART2JS | 256 $if DART2JS |
| 257 @DomName('Window.pageXOffset') | 257 @DomName('Window.pageXOffset') |
| 258 @DocsEditable() | 258 @DocsEditable() |
| 259 int get pageXOffset => JS('num', '#.pageXOffset', this).round(); | 259 int get pageXOffset => JS('num', '#.pageXOffset', this).round(); |
| 260 | 260 |
| 261 @DomName('Window.pageYOffset') | 261 @DomName('Window.pageYOffset') |
| 262 @DocsEditable() | 262 @DocsEditable() |
| 263 int get pageYOffset => JS('num', '#.pageYOffset', this).round(); | 263 int get pageYOffset => JS('num', '#.pageYOffset', this).round(); |
| 264 | 264 |
| 265 /** | 265 /** |
| 266 * The distance this window has been scrolled horizontally. | 266 * The distance this window has been scrolled horizontally. |
| 267 * | 267 * |
| 268 * ## Other resources | 268 * ## Other resources |
| 269 * | 269 * |
| 270 * * [The Screen interface specification] | 270 * * [The Screen interface |
| 271 * (http://www.w3.org/TR/cssom-view/#screen) from W3C. | 271 * specification](http://www.w3.org/TR/cssom-view/#screen) from W3C. |
| 272 * * [scrollX] | 272 * * [scrollX](https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollX
) |
| 273 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollX) from MDN. | 273 * from MDN. |
| 274 */ | 274 */ |
| 275 @DomName('Window.scrollX') | 275 @DomName('Window.scrollX') |
| 276 @DocsEditable() | 276 @DocsEditable() |
| 277 int get scrollX => JS('bool', '("scrollX" in #)', this) ? | 277 int get scrollX => JS('bool', '("scrollX" in #)', this) ? |
| 278 JS('num', '#.scrollX', this).round() : | 278 JS('num', '#.scrollX', this).round() : |
| 279 document.documentElement.scrollLeft; | 279 document.documentElement.scrollLeft; |
| 280 | 280 |
| 281 /** | 281 /** |
| 282 * The distance this window has been scrolled vertically. | 282 * The distance this window has been scrolled vertically. |
| 283 * | 283 * |
| 284 * ## Other resources | 284 * ## Other resources |
| 285 * | 285 * |
| 286 * * [The Screen interface specification] | 286 * * [The Screen interface |
| 287 * (http://www.w3.org/TR/cssom-view/#screen) from W3C. | 287 * specification](http://www.w3.org/TR/cssom-view/#screen) from W3C. |
| 288 * * [scrollY] | 288 * * [scrollY](https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY
) |
| 289 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY) from MDN. | 289 * from MDN. |
| 290 */ | 290 */ |
| 291 @DomName('Window.scrollY') | 291 @DomName('Window.scrollY') |
| 292 @DocsEditable() | 292 @DocsEditable() |
| 293 int get scrollY => JS('bool', '("scrollY" in #)', this) ? | 293 int get scrollY => JS('bool', '("scrollY" in #)', this) ? |
| 294 JS('num', '#.scrollY', this).round() : | 294 JS('num', '#.scrollY', this).round() : |
| 295 document.documentElement.scrollTop; | 295 document.documentElement.scrollTop; |
| 296 $else | 296 $else |
| 297 @DomName('Window.pageXOffset') | 297 @DomName('Window.pageXOffset') |
| 298 @DocsEditable() | 298 @DocsEditable() |
| 299 int get pageXOffset => _blink.BlinkWindow.instance.pageXOffset_Getter_(unwrap_
jso(this)).round(); | 299 int get pageXOffset => _blink.BlinkWindow.instance.pageXOffset_Getter_(unwrap_
jso(this)).round(); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 360 |
| 361 ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false
}) { | 361 ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false
}) { |
| 362 return new _ElementEventStreamImpl(e, _eventType, useCapture); | 362 return new _ElementEventStreamImpl(e, _eventType, useCapture); |
| 363 } | 363 } |
| 364 | 364 |
| 365 ElementStream<BeforeUnloadEvent> _forElementList(ElementList e, | 365 ElementStream<BeforeUnloadEvent> _forElementList(ElementList e, |
| 366 {bool useCapture: false}) { | 366 {bool useCapture: false}) { |
| 367 return new _ElementListEventStreamImpl(e, _eventType, useCapture); | 367 return new _ElementListEventStreamImpl(e, _eventType, useCapture); |
| 368 } | 368 } |
| 369 } | 369 } |
| OLD | NEW |