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

Unified Diff: LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll.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 side-by-side diff with in-line comments
Download patch
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
deleted file mode 100644
index a05344c8803f59ff626c97004fd44c57dfe93d93..0000000000000000000000000000000000000000
--- a/LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<!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 convertIndexToScrollOffset(index, listbox, approximateItemHeight) {
- var scrollOffset = Math.floor(index * approximateItemHeight);
-
- // The scroll offset set on a list box can get rounded to the nearest whole-item
- // offset. We set and then readback the scroll offset to get the rounded value
- // (so that the scroll offsets used during the test won't be subject to further
- // rounding).
- listbox.scrollTop = scrollOffset;
- scrollOffset = listbox.scrollTop;
- return scrollOffset;
- }
-
- function initializeTest(indexTargets, targets, innerPoint, listbox) {
- var approximateItemHeight = listbox.clientHeight / listbox.size;
-
- // Convert from listbox item index to scroll offset.
- targets.y_min = convertIndexToScrollOffset(indexTargets.index_min, listbox, approximateItemHeight);
- targets.y_mid = convertIndexToScrollOffset(indexTargets.index_mid, listbox, approximateItemHeight);
- targets.y_max = convertIndexToScrollOffset(indexTargets.index_max, listbox, approximateItemHeight);
-
- 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>

Powered by Google App Engine
This is Rietveld 408576698