Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / scroll-behavior / overflow-scroll-scrollTop.html
blobf31f423201f9919276e6043dd29710331cd3f05f
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <style>
5 #container {
6 width: 200px;
7 height: 200px;
8 overflow: scroll;
11 #content {
12 width: 7500px;
13 height: 7500px;
14 background-color: blue;
16 </style>
17 <script src="../../resources/testharness.js"></script>
18 <script src="../../resources/testharnessreport.js"></script>
19 <script src="resources/scroll-behavior-test.js"></script>
20 <script type="text/javascript">
21 function getEndPosition(testCase, startPosition) {
22 var endPosition = {};
23 endPosition.x = startPosition.x;
24 endPosition.y = testCase.y;
25 return endPosition;
28 function jsScroll(testCase) {
29 var element = document.getElementById("container");
30 element.scrollTop = testCase.y;
33 const testScrolls = [
34 {css: "auto", x: 0, y: 2},
35 {css: "auto", x: 0, y: 4},
36 {css: "smooth", waitForEnd: true, x: 0, y: 25},
37 {css: "smooth", waitForEnd: true, x: 0, y: 45},
38 {css: "smooth", waitForEnd: false, x: 0, y: 4100},
39 {css: "smooth", waitForEnd: false, x: 0, y: 20},
42 function doTest()
44 var testCases = [];
45 for (var i = 0; i < testScrolls.length; i++) {
46 testCases.push(new ScrollBehaviorTestCase(testScrolls[i]));
49 var element = document.getElementById("container");
50 var scrollBehaviorTest = new ScrollBehaviorTest(element,
51 element,
52 testCases,
53 getEndPosition,
54 jsScroll);
55 scrollBehaviorTest.run();
58 window.addEventListener('load', doTest, false);
59 </script>
60 </head>
62 <body>
63 <p>Test that setting scrollTop on an overflow:scroll element works with both scroll behaviors</p>
64 <div id="container">
65 <div id="content"></div>
66 </div>
67 </body>
68 </html>