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

Side by Side Diff: LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll.html

Issue 400763003: Revert of Scroll interruption tests for CSSOM View smooth scroll (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/testharness.js"></script>
5 <script src="../../resources/testharnessreport.js"></script>
6 <script src="resources/scroll-interruption-test.js"></script>
7 <script type="text/javascript">
8 const numItems = 500;
9
10 function jsScroll(y) {
11 document.getElementById('listbox').scrollTop = {y: y, behavior: 'smooth'};
12 }
13
14 function initializeContents(listbox) {
15 for (var i = 0; i < numItems; i++) {
16 var option = document.createElement('option');
17 option.appendChild(document.createTextNode(i));
18 listbox.appendChild(option);
19 }
20 }
21
22 function initializeTest(indexTargets, targets, innerPoint, listbox) {
23 var itemHeight = (listbox.scrollHeight - listbox.clientHeight) / (numItems - listbox.size);
24
25 // Convert from listbox item index to scroll offset.
26 targets.y_min = indexTargets.index_min * itemHeight;
27 targets.y_mid = indexTargets.index_mid * itemHeight;
28 targets.y_max = indexTargets.index_max * itemHeight;
29
30 var boundingRect = listbox.getBoundingClientRect();
31 innerPoint.x = (boundingRect.left + boundingRect.right)/2;
32 innerPoint.y = (boundingRect.top + boundingRect.bottom)/2;
33 }
34
35 function doTest() {
36 var indexTargets = {index_min: 3, index_mid: 200, index_max: 400};
37 var targets = {};
38 var innerPoint = {};
39 var element = document.getElementById('listbox');
40 initializeContents(element);
41 initializeTest(indexTargets, targets, innerPoint, element);
42 var scrollInterruptionTest = new SmoothScrollInterruptionTest(element,
43 innerPoint,
44 targets,
45 jsScroll);
46 scrollInterruptionTest.run();
47 }
48
49 window.addEventListener('load', doTest, false);
50 </script>
51 </head>
52
53 <body>
54 <p>Test that interrupting a smooth scroll on a listbox works with both scroll behaviors and with input</p>
55 <select size="4" id="listbox"></select>
56 </body>
57 </html>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698