| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head> | 2 <head> |
| 3 <script> | 3 <script> |
| 4 function log(msg) { | 4 function log(msg) { |
| 5 document.getElementById('log').appendChild(document.createTextNode(m
sg + '\n')); | 5 document.getElementById('log').appendChild(document.createTextNode(m
sg + '\n')); |
| 6 } | 6 } |
| 7 | 7 |
| 8 function test() { | 8 function test() { |
| 9 if (window.testRunner) { | 9 if (window.testRunner) { |
| 10 testRunner.dumpAsText(); | 10 testRunner.dumpAsText(); |
| 11 } | 11 } |
| 12 | 12 |
| 13 window.onfocus = function() { log('main frame focused'); } | 13 window.onfocus = function() { log('main frame focused'); } |
| 14 window.onblur = function() { log('main frame blurred'); } | 14 window.onblur = function() { log('main frame blurred'); } |
| 15 | 15 |
| 16 var w = document.getElementById('frame').contentWindow; | 16 var w = document.getElementById('frame').contentWindow; |
| 17 w.onfocus = function() { log('iframe focused'); } | 17 w.onfocus = function() { log('iframe focused'); } |
| 18 w.onblur = function() { log('iframe blurred'); } | 18 w.onblur = function() { log('iframe blurred'); } |
| 19 | 19 |
| 20 if (window.eventSender) { | 20 if (window.eventSender) { |
| 21 // Mouse events only work after an initial layout |
| 22 document.body.offsetLeft; |
| 21 eventSender.mouseMoveTo(1, 300); | 23 eventSender.mouseMoveTo(1, 300); |
| 22 eventSender.mouseDown(); | 24 eventSender.mouseDown(); |
| 23 eventSender.mouseUp(); | 25 eventSender.mouseUp(); |
| 24 | 26 |
| 25 // We need to "wait" a bit before the next click -- otherwise it
is ignored | 27 // We need to "wait" a bit before the next click -- otherwise it
is ignored |
| 26 eventSender.leapForward(2000); | 28 eventSender.leapForward(2000); |
| 27 | 29 |
| 28 eventSender.mouseMoveTo(50, 50); | 30 eventSender.mouseMoveTo(50, 50); |
| 29 eventSender.mouseDown(); | 31 eventSender.mouseDown(); |
| 30 eventSender.mouseUp(); | 32 eventSender.mouseUp(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 41 <body onload="test()"> | 43 <body onload="test()"> |
| 42 <iframe id="frame" style="width: 100px; height: 100px; margin: 0px; border:
2px solid black;"></iframe> | 44 <iframe id="frame" style="width: 100px; height: 100px; margin: 0px; border:
2px solid black;"></iframe> |
| 43 <p>This page tests that frames receive focus events when a click occurs | 45 <p>This page tests that frames receive focus events when a click occurs |
| 44 within their content area, and blur events when a click occurs outside | 46 within their content area, and blur events when a click occurs outside |
| 45 their content area.</p> | 47 their content area.</p> |
| 46 <p>To test, click in the frame and then click on this text.</p> | 48 <p>To test, click in the frame and then click on this text.</p> |
| 47 | 49 |
| 48 <pre id="log"></pre> | 50 <pre id="log"></pre> |
| 49 </body> | 51 </body> |
| 50 </html> | 52 </html> |
| OLD | NEW |