| Index: LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll.html
|
| diff --git a/LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll.html b/LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..360a86cce6293b432e9470112429e7953abeecd1
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll.html
|
| @@ -0,0 +1,57 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| + <script src="../../resources/testharness.js"></script>
|
| + <script src="../../resources/testharnessreport.js"></script>
|
| + <script src="resources/scroll-interruption-test.js"></script>
|
| + <script type="text/javascript">
|
| + const numItems = 500;
|
| +
|
| + function jsScroll(y) {
|
| + document.getElementById('listbox').scrollTop = {y: y, behavior: 'smooth'};
|
| + }
|
| +
|
| + function initializeContents(listbox) {
|
| + for (var i = 0; i < numItems; i++) {
|
| + var option = document.createElement('option');
|
| + option.appendChild(document.createTextNode(i));
|
| + listbox.appendChild(option);
|
| + }
|
| + }
|
| +
|
| + function initializeTest(indexTargets, targets, innerPoint, listbox) {
|
| + var itemHeight = (listbox.scrollHeight - listbox.clientHeight) / (numItems - listbox.size);
|
| +
|
| + // Convert from listbox item index to scroll offset.
|
| + targets.y_min = indexTargets.index_min * itemHeight;
|
| + targets.y_mid = indexTargets.index_mid * itemHeight;
|
| + targets.y_max = indexTargets.index_max * itemHeight;
|
| +
|
| + var boundingRect = listbox.getBoundingClientRect();
|
| + innerPoint.x = (boundingRect.left + boundingRect.right)/2;
|
| + innerPoint.y = (boundingRect.top + boundingRect.bottom)/2;
|
| + }
|
| +
|
| + function doTest() {
|
| + var indexTargets = {index_min: 3, index_mid: 200, index_max: 400};
|
| + var targets = {};
|
| + var innerPoint = {};
|
| + var element = document.getElementById('listbox');
|
| + initializeContents(element);
|
| + initializeTest(indexTargets, targets, innerPoint, element);
|
| + var scrollInterruptionTest = new SmoothScrollInterruptionTest(element,
|
| + innerPoint,
|
| + targets,
|
| + jsScroll);
|
| + scrollInterruptionTest.run();
|
| + }
|
| +
|
| + window.addEventListener('load', doTest, false);
|
| + </script>
|
| +</head>
|
| +
|
| +<body>
|
| + <p>Test that interrupting a smooth scroll on a listbox works with both scroll behaviors and with input</p>
|
| + <select size="4" id="listbox"></select>
|
| +</body>
|
| +</html>
|
|
|