OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
| 4 <script src="../../../fast/forms/resources/picker-common.js"></script> |
4 <style> | 5 <style> |
5 select { | 6 select { |
6 display: block; | 7 display: block; |
7 margin: 5px; | 8 margin: 5px; |
8 } | 9 } |
9 </style> | 10 </style> |
10 <script> | 11 <script> |
11 // We need to 'click' the select element by sending an actual event | 12 // We need to 'click' the select element by sending an actual event |
12 // through internals, since the regular javascript click() method | 13 // through internals, since the regular javascript click() method |
13 // won't trigger the right events for this test. | 14 // won't trigger the right events for this test. |
14 function clickSelect() { | 15 function clickSelect(callback) { |
15 if (!window.eventSender) | 16 if (!window.eventSender) |
16 return; | 17 return; |
17 | 18 |
18 var select = document.getElementById('select'); | 19 var select = document.getElementById('select'); |
19 // FIXME: it would be really nice to use getBoundingClientRect() and not | 20 // 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 // hard-code pixel coordinates here, but since it's in an iframe, the |
21 // coordinates are translated anyway. | 22 // coordinates are translated anyway. |
22 eventSender.mouseMoveTo(50, 120); | 23 clickToOpenPicker(50, 120, callback, function () { |
23 eventSender.mouseDown(); | 24 setTimeout(callback, 0); |
24 eventSender.mouseUp(); | 25 }); |
25 } | 26 } |
26 | 27 |
27 // We'll get a message from the outer frame when it's done scrolling, | 28 // 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 // so we know it's time to click on a select element. |
29 window.onmessage = function() { | 30 window.onmessage = function() { |
30 clickSelect(); | 31 clickSelect(function () { |
31 | 32 if (window.testRunner) |
32 if (window.testRunner) | 33 window.testRunner.notifyDone(); |
33 window.setTimeout(function() { window.testRunner.notifyDone(); }, 0); | 34 }); |
34 }; | 35 }; |
35 | 36 |
36 // This function just saves us from hard-coding 30 select elements | 37 // 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 // (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 // select elements near the bottom is given an id so we can click |
39 // on it later. | 40 // on it later. |
40 function populateDom() { | 41 function populateDom() { |
41 for (var x = 0; x < 30; x++) { | 42 for (var x = 0; x < 30; x++) { |
42 var select = document.createElement('select'); | 43 var select = document.createElement('select'); |
43 for (var y = 0; y < 4; ++y) { | 44 for (var y = 0; y < 4; ++y) { |
(...skipping 15 matching lines...) Expand all Loading... |
59 // outer iframe to tell it to scroll. | 60 // outer iframe to tell it to scroll. |
60 window.onload = function() { | 61 window.onload = function() { |
61 populateDom(); | 62 populateDom(); |
62 parent.postMessage('', '*'); | 63 parent.postMessage('', '*'); |
63 }; | 64 }; |
64 </script> | 65 </script> |
65 </head> | 66 </head> |
66 | 67 |
67 <body> | 68 <body> |
68 </body> | 69 </body> |
OLD | NEW |