OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <style> |
| 5 select { |
| 6 display: block; |
| 7 margin: 5px; |
| 8 } |
| 9 </style> |
| 10 <script> |
| 11 // We need to 'click' the select element by sending an actual event |
| 12 // through internals, since the regular javascript click() method |
| 13 // won't trigger the right events for this test. |
| 14 function clickSelect() { |
| 15 if (!window.eventSender) |
| 16 return; |
| 17 |
| 18 var select = document.getElementById('select'); |
| 19 // FIXME: it would be really nice to use getBoundingClientRect() and not |
| 20 // hard-code pixel coordinates here, but since it's in an iframe, the |
| 21 // coordinates are translated anyway. |
| 22 eventSender.mouseMoveTo(50, 120); |
| 23 eventSender.mouseDown(); |
| 24 eventSender.mouseUp(); |
| 25 } |
| 26 |
| 27 // We'll get a message from the outer frame when it's done scrolling, |
| 28 // so we know it's time to click on a select element. |
| 29 window.onmessage = function() { |
| 30 clickSelect(); |
| 31 |
| 32 if (window.testRunner) |
| 33 window.setTimeout(function() { window.testRunner.notifyDone(); }, 0); |
| 34 }; |
| 35 |
| 36 // This function just saves us from hard-coding 30 select elements |
| 37 // (each with a few option elements) in the body. One of the |
| 38 // select elements near the bottom is given an id so we can click |
| 39 // on it later. |
| 40 function populateDom() { |
| 41 for (var x = 0; x < 30; x++) { |
| 42 var select = document.createElement('select'); |
| 43 for (var y = 0; y < 4; ++y) { |
| 44 var option = document.createElement('option'); |
| 45 option.innerText = y; |
| 46 select.appendChild(option); |
| 47 } |
| 48 |
| 49 if (x == 24) { |
| 50 select.id = 'select'; |
| 51 } |
| 52 |
| 53 document.body.appendChild(select); |
| 54 } |
| 55 } |
| 56 |
| 57 // Javascript execution starts here. This will populate the iframe |
| 58 // with a bunch of select elements, then post a message to the |
| 59 // outer iframe to tell it to scroll. |
| 60 window.onload = function() { |
| 61 populateDom(); |
| 62 parent.postMessage('', '*'); |
| 63 }; |
| 64 </script> |
| 65 </head> |
| 66 |
| 67 <body> |
| 68 </body> |
OLD | NEW |