Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 initializeContents(listbox) | |
| 11 { | |
| 12 for (var i = 0; i < numItems; i++) { | |
| 13 var option = document.createElement("option"); | |
| 14 option.appendChild(document.createTextNode(i)); | |
| 15 listbox.appendChild(option); | |
| 16 } | |
| 17 } | |
| 18 | |
| 19 function initializeTestCase(testCase, innerPoint, listbox) | |
| 20 { | |
| 21 var itemHeight = (listbox.scrollHeight - listbox.clientHeight) / (numItems - listbox.size); | |
| 22 var boundingRect = listbox.getBoundingClientRect(); | |
| 23 innerPoint.x = (boundingRect.left + boundingRect.right)/2; | |
| 24 innerPoint.y = (boundingRect.top + boundingRect.bottom)/2; | |
| 25 testCase.y1 = testCase.index1 * itemHeight; | |
| 26 testCase.y2 = testCase.index2 * itemHeight; | |
| 27 testCase.y3 = testCase.index3 * itemHeight; | |
| 28 } | |
| 29 | |
| 30 function doTest() | |
| 31 { | |
| 32 var testCase = {index1: 3, index2: 200, index3: 1}; | |
| 33 var innerPoint = {x:0, y:0 }; | |
|
Ian Vollick
2014/02/06 16:02:31
Nit: extra space.
| |
| 34 var element = document.getElementById("listbox"); | |
| 35 initializeContents(element); | |
| 36 initializeTestCase(testCase, innerPoint, element); | |
| 37 runScrollInterruptionTests(element, testCase, innerPoint); | |
| 38 } | |
| 39 | |
| 40 window.addEventListener('load', doTest, false); | |
| 41 </script> | |
| 42 </head> | |
| 43 | |
| 44 <body> | |
| 45 <p>Test that interrupting a smooth scroll on a listbox works with both scroll behaviors and with input</p> | |
| 46 <select size="4" id="listbox"></select> | |
| 47 </body> | |
| 48 </html> | |
| OLD | NEW |