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

Unified Diff: LayoutTests/fast/scroll-behavior/subframe-scrollTop.html

Issue 134443003: Implement CSSOM Smooth Scroll API (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 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
Index: LayoutTests/fast/scroll-behavior/subframe-scrollTop.html
diff --git a/LayoutTests/fast/scroll-behavior/subframe-scrollTop.html b/LayoutTests/fast/scroll-behavior/subframe-scrollTop.html
new file mode 100644
index 0000000000000000000000000000000000000000..f591d81a5267ab978d5ecee9a3ab58933fbbc89a
--- /dev/null
+++ b/LayoutTests/fast/scroll-behavior/subframe-scrollTop.html
@@ -0,0 +1,71 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ #subframe {
+ width: 200px;
+ height: 200px;
+ }
+ </style>
+ <script src="../../resources/testharness.js"></script>
+ <script src="../../resources/testharnessreport.js"></script>
+ <script src="resources/scroll-behavior-test.js"></script>
+ <script type="text/javascript">
+ const instantScrolls = [
+ {js: "instant", css: "instant", y: 2},
+ {js: "instant", css: "smooth", y: 3},
+ {js: "auto", css: "instant", y: 4},
+ {js: "", css: "instant", y: 5}
+ ];
+
+ const smoothScrolls = [
+ {js: "smooth", css: "instant", waitForEnd: true, y: 15},
+ {js: "smooth", css: "smooth", waitForEnd: true, y: 25},
+ {js: "auto", css: "smooth", waitForEnd: true, y: 35},
+ {js: "", css: "smooth", waitForEnd: true, y: 45},
+ {js: "smooth", css: "instant", waitForEnd: false, y: 4100},
+ {js: "smooth", css: "smooth", waitForEnd: false, y: 20},
+ {js: "auto", css: "smooth", waitForEnd: false, y: 4000},
+ {js: "", css: "smooth", waitForEnd: false, y: 5},
+ ];
+
+ function runTestCase(testCase)
+ {
+ var subframeDocumentElement = document.getElementById("subframe").contentDocument.documentElement;
+ if (testCase.js)
+ subframeDocumentElement.scrollTop = {y: testCase.y, behavior: testCase.js};
+ else
+ subframeDocumentElement.scrollTop = testCase.y;
+ }
+
+ function endX(testCase, startX)
+ {
+ return startX;
+ }
+
+ function endY(testCase)
+ {
+ return testCase.y;
+ }
+
+ function doTest()
+ {
+ var subframe = document.getElementById("subframe");
+ runScrollBehaviorTests(subframe.contentDocument.documentElement,
+ subframe.contentDocument,
+ instantScrolls,
+ smoothScrolls,
+ runTestCase,
+ endX,
+ endY);
+ }
+
+ window.addEventListener('load', doTest, false);
+ </script>
+</head>
+
+<body>
+ <p>Test that setting scrollTop on a subframe works with both scroll behaviors</p>
+ <iframe id="subframe" src="resources/large-subframe.html"></div>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698