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

Side by Side Diff: tools/dom/templates/html/impl/impl_Window.darttemplate

Issue 66843009: Even more docs changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tools/dom/src/CrossFrameTypes.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Wind ow,DOMWindow" { 9 $(ANNOTATIONS)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS native "Wind ow,DOMWindow" {
10 $else 10 $else
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 if (options == null) { 55 if (options == null) {
56 return _DOMWindowCrossFrame._createSafe(_open2(url, name)); 56 return _DOMWindowCrossFrame._createSafe(_open2(url, name));
57 } else { 57 } else {
58 return _DOMWindowCrossFrame._createSafe(_open3(url, name, options)); 58 return _DOMWindowCrossFrame._createSafe(_open3(url, name, options));
59 } 59 }
60 } 60 }
61 61
62 // API level getter and setter for Location. 62 // API level getter and setter for Location.
63 // TODO: The cross domain safe wrapper can be inserted here or folded into 63 // TODO: The cross domain safe wrapper can be inserted here or folded into
64 // _LocationWrapper. 64 // _LocationWrapper.
65 /**
66 * The current location of this window.
67 *
68 * Location currentLocation = window.location;
69 * print(currentLocation.href); // 'http://www.example.com:80/'
70 */
65 Location get location { 71 Location get location {
66 // Firefox work-around for Location. The Firefox location object cannot be 72 // Firefox work-around for Location. The Firefox location object cannot be
67 // made to behave like a Dart object so must be wrapped. 73 // made to behave like a Dart object so must be wrapped.
68 var result = _location; 74 var result = _location;
69 if (_isDartLocation(result)) return result; // e.g. on Chrome. 75 if (_isDartLocation(result)) return result; // e.g. on Chrome.
70 if (null == _location_wrapper) { 76 if (null == _location_wrapper) {
71 _location_wrapper = new _LocationWrapper(result); 77 _location_wrapper = new _LocationWrapper(result);
72 } 78 }
73 return _location_wrapper; 79 return _location_wrapper;
74 } 80 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 * 129 *
124 * Note: The supplied [callback] needs to call [requestAnimationFrame] again 130 * Note: The supplied [callback] needs to call [requestAnimationFrame] again
125 * for the animation to continue. 131 * for the animation to continue.
126 */ 132 */
127 @DomName('Window.requestAnimationFrame') 133 @DomName('Window.requestAnimationFrame')
128 int requestAnimationFrame(RequestAnimationFrameCallback callback) { 134 int requestAnimationFrame(RequestAnimationFrameCallback callback) {
129 _ensureRequestAnimationFrame(); 135 _ensureRequestAnimationFrame();
130 return _requestAnimationFrame(_wrapZone(callback)); 136 return _requestAnimationFrame(_wrapZone(callback));
131 } 137 }
132 138
139 /**
140 * Cancels an animation frame request.
141 *
142 * ## Other resources
143 *
144 * * [Window.cancelAnimationFrame]
145 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.cancelAnimationFra me) from MDN.
146 */
133 void cancelAnimationFrame(int id) { 147 void cancelAnimationFrame(int id) {
134 _ensureRequestAnimationFrame(); 148 _ensureRequestAnimationFrame();
135 _cancelAnimationFrame(id); 149 _cancelAnimationFrame(id);
136 } 150 }
137 151
138 @JSName('requestAnimationFrame') 152 @JSName('requestAnimationFrame')
139 int _requestAnimationFrame(RequestAnimationFrameCallback callback) native; 153 int _requestAnimationFrame(RequestAnimationFrameCallback callback) native;
140 154
141 @JSName('cancelAnimationFrame') 155 @JSName('cancelAnimationFrame')
142 void _cancelAnimationFrame(int id) native; 156 void _cancelAnimationFrame(int id) native;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 * true, the application will request permission from the user to create 228 * true, the application will request permission from the user to create
215 * lasting storage. This storage cannot be freed without the user's 229 * lasting storage. This storage cannot be freed without the user's
216 * permission. Returns a [Future] whose value stores a reference to the 230 * permission. Returns a [Future] whose value stores a reference to the
217 * sandboxed file system for use. Because the file system is sandboxed, 231 * sandboxed file system for use. Because the file system is sandboxed,
218 * applications cannot access file systems created in other web pages. 232 * applications cannot access file systems created in other web pages.
219 */ 233 */
220 Future<FileSystem> requestFileSystem(int size, {bool persistent: false}) { 234 Future<FileSystem> requestFileSystem(int size, {bool persistent: false}) {
221 return _requestFileSystem(persistent? 1 : 0, size); 235 return _requestFileSystem(persistent? 1 : 0, size);
222 } 236 }
223 237
238 /**
239 * Converts a point from node coordinates to this window's coordinates.
240 *
241 * ## Other resources
242 *
243 * * [webkitConvertPointFromPageToNode]
244 * (https://developer.apple.com/library/safari/documentation/DataManagement/Re ference/DOMWindowAdditionsReference/DOMWindowAdditions/DOMWindowAdditions.html#/ /apple_ref/javascript/instm/DOMWindow/webkitConvertPointFromNodeToPage)
245 * from Safari Development Library.
246 */
224 @DomName('Window.convertPointFromNodeToPage') 247 @DomName('Window.convertPointFromNodeToPage')
225 @SupportedBrowser(SupportedBrowser.CHROME) 248 @SupportedBrowser(SupportedBrowser.CHROME)
226 @SupportedBrowser(SupportedBrowser.SAFARI) 249 @SupportedBrowser(SupportedBrowser.SAFARI)
227 @Experimental() 250 @Experimental()
228 Point convertPointFromNodeToPage(Node node, Point point) { 251 Point convertPointFromNodeToPage(Node node, Point point) {
229 var result = _convertPointFromNodeToPage(node, 252 var result = _convertPointFromNodeToPage(node,
230 new _DomPoint(point.x, point.y)); 253 new _DomPoint(point.x, point.y));
231 return new Point(result.x, result.y); 254 return new Point(result.x, result.y);
232 } 255 }
233 256
257 /**
258 * Converts a point from this window's coordinates to node coordinates.
259 *
260 * ## Other resources
261 *
262 * * [webkitConvertPointFromPageToNode]
263 * (https://developer.apple.com/library/safari/documentation/DataManagement/Re ference/DOMWindowAdditionsReference/DOMWindowAdditions/DOMWindowAdditions.html#/ /apple_ref/javascript/instm/DOMWindow/webkitConvertPointFromPageToNode)
264 * from Safari Development Library.
265 */
234 @DomName('Window.convertPointFromPageToNode') 266 @DomName('Window.convertPointFromPageToNode')
235 @SupportedBrowser(SupportedBrowser.CHROME) 267 @SupportedBrowser(SupportedBrowser.CHROME)
236 @SupportedBrowser(SupportedBrowser.SAFARI) 268 @SupportedBrowser(SupportedBrowser.SAFARI)
237 @Experimental() 269 @Experimental()
238 Point convertPointFromPageToNode(Node node, Point point) { 270 Point convertPointFromPageToNode(Node node, Point point) {
239 var result = _convertPointFromPageToNode(node, 271 var result = _convertPointFromPageToNode(node,
240 new _DomPoint(point.x, point.y)); 272 new _DomPoint(point.x, point.y));
241 return new Point(result.x, result.y); 273 return new Point(result.x, result.y);
242 } 274 }
243 275
(...skipping 11 matching lines...) Expand all
255 * See [EventStreamProvider] for usage information. 287 * See [EventStreamProvider] for usage information.
256 */ 288 */
257 @DomName('Window.beforeunloadEvent') 289 @DomName('Window.beforeunloadEvent')
258 static const EventStreamProvider<BeforeUnloadEvent> beforeUnloadEvent = 290 static const EventStreamProvider<BeforeUnloadEvent> beforeUnloadEvent =
259 const _BeforeUnloadEventStreamProvider('beforeunload'); 291 const _BeforeUnloadEventStreamProvider('beforeunload');
260 292
261 /// Stream of `beforeunload` events handled by this [Window]. 293 /// Stream of `beforeunload` events handled by this [Window].
262 @DomName('Window.onbeforeunload') 294 @DomName('Window.onbeforeunload')
263 Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this); 295 Stream<Event> get onBeforeUnload => beforeUnloadEvent.forTarget(this);
264 296
297 /**
298 * Moves this window to a specific position.
299 *
300 * x and y can be negative.
301 *
302 * ## Other resources
303 *
304 * * [Window.moveTo]
305 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.moveTo) from MDN.
306 * * [Window.moveTo]
307 * (http://dev.w3.org/csswg/cssom-view/#dom-window-moveto) from W3C.
308 */
265 void moveTo(Point p) { 309 void moveTo(Point p) {
266 _moveTo(p.x, p.y); 310 _moveTo(p.x, p.y);
267 } 311 }
268 312
269 $if DART2JS 313 $if DART2JS
314 /**
315 * The distance this window has been scrolled horizontally.
316 *
317 * ## Other resources
318 *
319 * * [The Screen interface specification]
320 * (http://www.w3.org/TR/cssom-view/#screen) from W3C.
321 * * [scrollX]
322 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollX) from MDN.
323 */
270 int get scrollX => JS('bool', '("scrollX" in #)', this) ? JS('int', 324 int get scrollX => JS('bool', '("scrollX" in #)', this) ? JS('int',
271 '#.scrollX', this) : document.documentElement.scrollLeft; 325 '#.scrollX', this) : document.documentElement.scrollLeft;
326
327 /**
328 * The distance this window has been scrolled vertically.
329 *
330 * ## Other resources
331 *
332 * * [The Screen interface specification]
333 * (http://www.w3.org/TR/cssom-view/#screen) from W3C.
334 * * [scrollY]
335 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY) from MDN.
336 */
272 int get scrollY => JS('bool', '("scrollY" in #)', this) ? JS('int', 337 int get scrollY => JS('bool', '("scrollY" in #)', this) ? JS('int',
273 '#.scrollY', this) : document.documentElement.scrollTop; 338 '#.scrollY', this) : document.documentElement.scrollTop;
274 $endif 339 $endif
275 } 340 }
276 341
277 $if DART2JS 342 $if DART2JS
278 class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent { 343 class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent {
279 String _returnValue; 344 String _returnValue;
280 345
281 _BeforeUnloadEvent(Event base): super(base); 346 _BeforeUnloadEvent(Event base): super(base);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 return controller.stream; 378 return controller.stream;
314 $else 379 $else
315 return stream; 380 return stream;
316 $endif 381 $endif
317 } 382 }
318 383
319 String getEventType(EventTarget target) { 384 String getEventType(EventTarget target) {
320 return _eventType; 385 return _eventType;
321 } 386 }
322 } 387 }
OLDNEW
« no previous file with comments | « tools/dom/src/CrossFrameTypes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698