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

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

Issue 134443003: Implement CSSOM Smooth Scroll API (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/fast/scroll-behavior/listbox-interrupted-scroll-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698