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> |