Index: LayoutTests/fast/scroll-behavior/subframe-scroll.html |
diff --git a/LayoutTests/fast/scroll-behavior/subframe-scroll.html b/LayoutTests/fast/scroll-behavior/subframe-scroll.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b9a580b81bec18c0c094aabdbb097a13d00afaa0 |
--- /dev/null |
+++ b/LayoutTests/fast/scroll-behavior/subframe-scroll.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", x: 1, y: 2}, |
+ {js: "instant", css: "smooth", x: 2, y: 3}, |
+ {js: "auto", css: "instant", x: 3, y: 4}, |
+ {js: "", css: "instant", x: 4, y: 5} |
+ ]; |
+ |
+ const smoothScrolls = [ |
+ {js: "smooth", css: "instant", waitForEnd: true, x: 10, y: 15}, |
+ {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 25}, |
+ {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 35}, |
+ {js: "", css: "smooth", waitForEnd: true, x: 40, y: 45}, |
+ {js: "smooth", css: "instant", waitForEnd: false, x: 4000, y: 4100}, |
+ {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 20}, |
+ {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 4000}, |
+ {js: "", css: "smooth", waitForEnd: false, x: 10, y: 5}, |
+ ]; |
+ |
+ function runTestCase(testCase) |
+ { |
+ var subframe = document.getElementById("subframe"); |
+ if (testCase.js) |
+ subframe.contentWindow.scroll(testCase.x, testCase.y, {behavior: testCase.js}); |
+ else |
+ subframe.contentWindow.scroll(testCase.x, testCase.y); |
+ } |
+ |
+ function endX(testCase) |
+ { |
+ return testCase.x; |
+ } |
+ |
+ 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 calling scroll on a subframe works with both scroll behaviors</p> |
+ <iframe id="subframe" src="resources/large-subframe.html"></iframe> |
+</body> |
+</html> |