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

Unified 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 side-by-side diff with in-line comments
Download patch
« sdk/lib/html/dartium/html_dartium.dart ('K') | « tools/dom/scripts/htmlrenamer.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/templates/html/impl/impl_Window.darttemplate
diff --git a/tools/dom/templates/html/impl/impl_Window.darttemplate b/tools/dom/templates/html/impl/impl_Window.darttemplate
index 6b846f020420176217d48266485e2b3b59bfb01a..1c887777f862a644b825817c1cc583490ab3dcc3 100644
--- a/tools/dom/templates/html/impl/impl_Window.darttemplate
+++ b/tools/dom/templates/html/impl/impl_Window.darttemplate
@@ -254,6 +254,14 @@ $!MEMBERS
}
$if DART2JS
+ @DomName('Window.pageXOffset')
+ @DocsEditable()
+ int get pageXOffset => JS('num', '#.pageXOffset', this).round();
+
+ @DomName('Window.pageYOffset')
+ @DocsEditable()
+ int get pageYOffset => JS('num', '#.pageYOffset', this).round();
+
/**
* The distance this window has been scrolled horizontally.
*
@@ -264,8 +272,11 @@ $if DART2JS
* * [scrollX]
* (https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollX) from MDN.
*/
- int get scrollX => JS('bool', '("scrollX" in #)', this) ? JS('int',
- '#.scrollX', this) : document.documentElement.scrollLeft;
+ @DomName('Window.scrollX')
+ @DocsEditable()
+ int get scrollX => JS('bool', '("scrollX" in #)', this) ?
+ JS('num', '#.scrollX', this).round() :
+ document.documentElement.scrollLeft;
/**
* The distance this window has been scrolled vertically.
@@ -277,8 +288,27 @@ $if DART2JS
* * [scrollY]
* (https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY) from MDN.
*/
- int get scrollY => JS('bool', '("scrollY" in #)', this) ? JS('int',
- '#.scrollY', this) : document.documentElement.scrollTop;
+ @DomName('Window.scrollY')
+ @DocsEditable()
+ int get scrollY => JS('bool', '("scrollY" in #)', this) ?
+ JS('num', '#.scrollY', this).round() :
+ document.documentElement.scrollTop;
+$else
+ @DomName('Window.pageXOffset')
+ @DocsEditable()
+ int get pageXOffset => _blink.BlinkWindow.instance.pageXOffset_Getter_(this).round();
+
+ @DomName('Window.pageYOffset')
+ @DocsEditable()
+ int get pageYOffset => _blink.BlinkWindow.instance.pageYOffset_Getter_(this).round();
+
+ @DomName('Window.scrollX')
+ @DocsEditable()
+ int get scrollX => _blink.BlinkWindow.instance.scrollX_Getter_(this).round();
+
+ @DomName('Window.scrollY')
+ @DocsEditable()
+ int get scrollY => _blink.BlinkWindow.instance.scrollY_Getter_(this).round();
$endif
}
« 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