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

Unified Diff: LayoutTests/fast/scroll-behavior/subframe-scrollBy.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-scrollBy.html
diff --git a/LayoutTests/fast/scroll-behavior/subframe-scrollBy.html b/LayoutTests/fast/scroll-behavior/subframe-scrollBy.html
new file mode 100644
index 0000000000000000000000000000000000000000..a2e1f0abbc90469f8e022ed8d9ff16127a62dc57
--- /dev/null
+++ b/LayoutTests/fast/scroll-behavior/subframe-scrollBy.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: -3900, y: -3850},
+ {js: "auto", css: "smooth", waitForEnd: false, x: 4050, y: 4000},
+ {js: "", css: "smooth", waitForEnd: false, x: -4000, y: -4100},
+ ];
+
+ function runTestCase(testCase)
+ {
+ var subframe = document.getElementById("subframe");
+ if (testCase.js)
+ subframe.contentWindow.scrollBy(testCase.x, testCase.y, {behavior: testCase.js});
+ else
+ subframe.contentWindow.scrollBy(testCase.x, testCase.y);
+ }
+
+ function endX(testCase, startX)
+ {
+ return testCase.x + startX;
+ }
+
+ function endY(testCase, startY)
+ {
+ return testCase.y + startY;
+ }
+
+ 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 scrollBy on a subframe works with both scroll behaviors</p>
+ <iframe id="subframe" src="resources/large-subframe.html"></iframe>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698