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

Side by Side Diff: LayoutTests/fast/scroll-behavior/overflow-scroll-scrollTop.html

Issue 782793002: Update Element API for CSSOM smooth scrolling to match the spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <style> 4 <style>
5 #container { 5 #container {
6 width: 200px; 6 width: 200px;
7 height: 200px; 7 height: 200px;
8 overflow: scroll; 8 overflow: scroll;
9 } 9 }
10 10
11 #content { 11 #content {
12 width: 7500px; 12 width: 7500px;
13 height: 7500px; 13 height: 7500px;
14 background-color: blue; 14 background-color: blue;
15 } 15 }
16 </style> 16 </style>
17 <script src="../../resources/testharness.js"></script> 17 <script src="../../resources/testharness.js"></script>
18 <script src="../../resources/testharnessreport.js"></script> 18 <script src="../../resources/testharnessreport.js"></script>
19 <script src="resources/scroll-behavior-test.js"></script> 19 <script src="resources/scroll-behavior-test.js"></script>
20 <script type="text/javascript"> 20 <script type="text/javascript">
21 function getEndPosition(testCase, startPosition) { 21 function getEndPosition(testCase, startPosition) {
22 var endPosition = {}; 22 var endPosition = {};
23 endPosition.x = startPosition.x; 23 endPosition.x = startPosition.x;
24 endPosition.y = testCase.y; 24 endPosition.y = testCase.y;
25 return endPosition; 25 return endPosition;
26 } 26 }
27 27
28 function jsScroll(testCase) { 28 function jsScroll(testCase) {
29 var element = document.getElementById("container"); 29 var element = document.getElementById("container");
30 if (testCase.js) { 30 element.scrollTop = testCase.y;
31 element.scrollTop = {y: testCase.y, behavior: testCase.js};
32 } else {
33 element.scrollTop = testCase.y;
34 }
35 } 31 }
36 32
37 const testScrolls = [ 33 const testScrolls = [
38 {js: "instant", css: "auto", x: 0, y: 2}, 34 {css: "auto", x: 0, y: 2},
39 {js: "instant", css: "smooth", x: 0, y: 3}, 35 {css: "auto", x: 0, y: 4},
40 {js: "auto", css: "auto", x: 0, y: 4}, 36 {css: "smooth", waitForEnd: true, x: 0, y: 25},
41 {js: "", css: "auto", x: 0, y: 5}, 37 {css: "smooth", waitForEnd: true, x: 0, y: 45},
42 {js: "smooth", css: "auto", waitForEnd: true, x: 0, y: 15}, 38 {css: "smooth", waitForEnd: false, x: 0, y: 4100},
43 {js: "smooth", css: "smooth", waitForEnd: true, x: 0, y: 25}, 39 {css: "smooth", waitForEnd: false, x: 0, y: 20},
44 {js: "auto", css: "smooth", waitForEnd: true, x: 0, y: 35},
45 {js: "", css: "smooth", waitForEnd: true, x: 0, y: 45},
46 {js: "smooth", css: "auto", waitForEnd: false, x: 0, y: 4100},
47 {js: "smooth", css: "smooth", waitForEnd: false, x: 0, y: 20},
48 {js: "auto", css: "smooth", waitForEnd: false, x: 0, y: 4000},
49 {js: "", css: "smooth", waitForEnd: false, x: 0, y: 5},
50 ]; 40 ];
51 41
52 function doTest() 42 function doTest()
53 { 43 {
54 var testCases = []; 44 var testCases = [];
55 for (var i = 0; i < testScrolls.length; i++) { 45 for (var i = 0; i < testScrolls.length; i++) {
56 testCases.push(new ScrollBehaviorTestCase(testScrolls[i])); 46 testCases.push(new ScrollBehaviorTestCase(testScrolls[i]));
57 } 47 }
58 48
59 var element = document.getElementById("container"); 49 var element = document.getElementById("container");
60 var scrollBehaviorTest = new ScrollBehaviorTest(element, 50 var scrollBehaviorTest = new ScrollBehaviorTest(element,
61 element, 51 element,
62 testCases, 52 testCases,
63 getEndPosition, 53 getEndPosition,
64 jsScroll); 54 jsScroll);
65 scrollBehaviorTest.run(); 55 scrollBehaviorTest.run();
66 } 56 }
67 57
68 window.addEventListener('load', doTest, false); 58 window.addEventListener('load', doTest, false);
69 </script> 59 </script>
70 </head> 60 </head>
71 61
72 <body> 62 <body>
73 <p>Test that setting scrollTop on an overflow:scroll element works with both s croll behaviors</p> 63 <p>Test that setting scrollTop on an overflow:scroll element works with both s croll behaviors</p>
74 <div id="container"> 64 <div id="container">
75 <div id="content"></div> 65 <div id="content"></div>
76 </div> 66 </div>
77 </body> 67 </body>
78 </html> 68 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698