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

Unified Diff: LayoutTests/fast/scrolling/scrolling-apis-nan-scroll-position.html

Issue 670833002: Early out if the scroll position passed in by js is NaN (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: address comments Created 6 years, 2 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
Index: LayoutTests/fast/scrolling/scrolling-apis-nan-scroll-position.html
diff --git a/LayoutTests/fast/scrolling/scrolling-apis-nan-scroll-position.html b/LayoutTests/fast/scrolling/scrolling-apis-nan-scroll-position.html
new file mode 100644
index 0000000000000000000000000000000000000000..901283f02d6c11b584b72dfc3e63215e7ebbfa37
--- /dev/null
+++ b/LayoutTests/fast/scrolling/scrolling-apis-nan-scroll-position.html
@@ -0,0 +1,57 @@
+<!DOCTYPE HTML>
+<style>
+.spacer {
+ height: 1000px;
+ width: 1000px;
+}
+
+#scroller {
+ height: 100px;
+ width: 100px;
+ overflow: scroll;
+}
+</style>
+
+<body style="width:30000px;height:30000px" onload="runTest()">
Rick Byers 2014/10/22 13:55:33 nit: omit body tag (put style in CSS and see below
Yufeng Shen (Slow to review) 2014/10/22 17:38:46 Done.
+<div id=scroller>
+ <div class=spacer></div>
+</div>
+</body>
+
+<script src="../../resources/js-test.js"></script>
+<script>
+description("Verifies that nan scroll position works correctly.");
+
+function scroll()
+{
+ window.scrollTo(1, 1);
+ shouldBe('window.scrollY', "1");
+ shouldBe('window.scrollX', "1");
+
+ window.scrollTo(window.NaN, window.NaN);
+ shouldBe('window.scrollY', "1");
+ shouldBe('window.scrollX', "1");
+
+ window.scrollBy(window.NaN, window.NaN);
+ shouldBe('window.scrollY', "1");
+ shouldBe('window.scrollX', "1");
+
+ scroller.scrollTop = 1;
+ shouldBe("scroller.scrollTop", "1");
+ scroller.scrollTop = window.NaN;
+ shouldBe("scroller.scrollTop", "1");
+
+ scroller.scrollLeft = 1;
+ shouldBe("scroller.scrollLeft", "1");
+ scroller.scrollLeft = window.NaN;
+ shouldBe("scroller.scrollLeft", "1");
+}
+
+function runTest()
Rick Byers 2014/10/22 13:55:33 to avoid needing <body onload=runTest> use just: o
Yufeng Shen (Slow to review) 2014/10/22 17:38:46 Done.
+{
+ if (window.eventSender)
+ scroll();
+}
+
+</script>
+</html>
Rick Byers 2014/10/22 13:55:33 nit: omit </html> (you have no <html> tag)
Yufeng Shen (Slow to review) 2014/10/22 17:38:46 Done.
« no previous file with comments | « no previous file | LayoutTests/fast/scrolling/scrolling-apis-nan-scroll-position-expected.txt » ('j') | Source/core/dom/Element.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698