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

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

Issue 898993002: Clamp scrollX, scrollY, pageXOffset, and pageYOffset from double to int (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
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)@Native("Window,DOMWindow") 9 $(ANNOTATIONS)@Native("Window,DOMWindow")
10 $(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS { 10 $(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 * * [Window.moveTo] 247 * * [Window.moveTo]
248 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.moveTo) from MDN. 248 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.moveTo) from MDN.
249 * * [Window.moveTo] 249 * * [Window.moveTo]
250 * (http://dev.w3.org/csswg/cssom-view/#dom-window-moveto) from W3C. 250 * (http://dev.w3.org/csswg/cssom-view/#dom-window-moveto) 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')
258 @DocsEditable()
259 int get pageXOffset => JS('num', '#.pageXOffset', this).round();
260
261 @DomName('Window.pageYOffset')
262 @DocsEditable()
263 int get pageYOffset => JS('num', '#.pageYOffset', this).round();
264
257 /** 265 /**
258 * The distance this window has been scrolled horizontally. 266 * The distance this window has been scrolled horizontally.
259 * 267 *
260 * ## Other resources 268 * ## Other resources
261 * 269 *
262 * * [The Screen interface specification] 270 * * [The Screen interface specification]
263 * (http://www.w3.org/TR/cssom-view/#screen) from W3C. 271 * (http://www.w3.org/TR/cssom-view/#screen) from W3C.
264 * * [scrollX] 272 * * [scrollX]
265 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollX) from MDN. 273 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollX) from MDN.
266 */ 274 */
267 int get scrollX => JS('bool', '("scrollX" in #)', this) ? JS('int', 275 @DomName('Window.scrollX')
268 '#.scrollX', this) : document.documentElement.scrollLeft; 276 @DocsEditable()
277 int get scrollX => JS('bool', '("scrollX" in #)', this) ?
278 JS('num', '#.scrollX', this).round() :
279 document.documentElement.scrollLeft;
269 280
270 /** 281 /**
271 * The distance this window has been scrolled vertically. 282 * The distance this window has been scrolled vertically.
272 * 283 *
273 * ## Other resources 284 * ## Other resources
274 * 285 *
275 * * [The Screen interface specification] 286 * * [The Screen interface specification]
276 * (http://www.w3.org/TR/cssom-view/#screen) from W3C. 287 * (http://www.w3.org/TR/cssom-view/#screen) from W3C.
277 * * [scrollY] 288 * * [scrollY]
278 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY) from MDN. 289 * (https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY) from MDN.
279 */ 290 */
280 int get scrollY => JS('bool', '("scrollY" in #)', this) ? JS('int', 291 @DomName('Window.scrollY')
281 '#.scrollY', this) : document.documentElement.scrollTop; 292 @DocsEditable()
293 int get scrollY => JS('bool', '("scrollY" in #)', this) ?
294 JS('num', '#.scrollY', this).round() :
295 document.documentElement.scrollTop;
296 $else
297 @DomName('Window.pageXOffset')
298 @DocsEditable()
299 int get pageXOffset => _blink.BlinkWindow.instance.pageXOffset_Getter_(this).r ound();
300
301 @DomName('Window.pageYOffset')
302 @DocsEditable()
303 int get pageYOffset => _blink.BlinkWindow.instance.pageYOffset_Getter_(this).r ound();
304
305 @DomName('Window.scrollX')
306 @DocsEditable()
307 int get scrollX => _blink.BlinkWindow.instance.scrollX_Getter_(this).round();
308
309 @DomName('Window.scrollY')
310 @DocsEditable()
311 int get scrollY => _blink.BlinkWindow.instance.scrollY_Getter_(this).round();
282 $endif 312 $endif
283 } 313 }
284 314
285 $if DART2JS 315 $if DART2JS
286 class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent { 316 class _BeforeUnloadEvent extends _WrappedEvent implements BeforeUnloadEvent {
287 String _returnValue; 317 String _returnValue;
288 318
289 _BeforeUnloadEvent(Event base): super(base); 319 _BeforeUnloadEvent(Event base): super(base);
290 320
291 String get returnValue => _returnValue; 321 String get returnValue => _returnValue;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 360
331 ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false }) { 361 ElementStream<BeforeUnloadEvent> forElement(Element e, {bool useCapture: false }) {
332 return new _ElementEventStreamImpl(e, _eventType, useCapture); 362 return new _ElementEventStreamImpl(e, _eventType, useCapture);
333 } 363 }
334 364
335 ElementStream<BeforeUnloadEvent> _forElementList(ElementList e, 365 ElementStream<BeforeUnloadEvent> _forElementList(ElementList e,
336 {bool useCapture: false}) { 366 {bool useCapture: false}) {
337 return new _ElementListEventStreamImpl(e, _eventType, useCapture); 367 return new _ElementListEventStreamImpl(e, _eventType, useCapture);
338 } 368 }
339 } 369 }
OLDNEW
« sdk/lib/html/dartium/html_dartium.dart ('K') | « tools/dom/scripts/htmlrenamer.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698