| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE HTML> | |
| 2 <script src='../../../../../resources/js-test.js'></script> | |
| 3 <style> | |
| 4 iframe { | |
| 5 width: 300px; | |
| 6 height: 300px; | |
| 7 top: 100px; | |
| 8 left: 50px; | |
| 9 border: 0; | |
| 10 position: absolute; | |
| 11 background: green; | |
| 12 } | |
| 13 </style> | |
| 14 <iframe id='target' srcdoc=" | |
| 15 <body style='height:500px; width: 500px; padding: 0; margin: 0;'> | |
| 16 <script> | |
| 17 window.name = 'innerFrame'; | |
| 18 var testEventList = ['pointerup', 'pointerdown', 'pointermove', | |
| 19 'touchstart', 'touchmove', 'touchend', | |
| 20 'mouseup', 'mousedown', 'mousemove']; | |
| 21 testEventList.forEach(function(eventName) { | |
| 22 document.documentElement.addEventListener(eventName, function(event) { | |
| 23 top.document.events.push(event); | |
| 24 }); | |
| 25 }); | |
| 26 </script> | |
| 27 </body>"> | |
| 28 </iframe> | |
| 29 | |
| 30 <div id='console'></div> | |
| 31 | |
| 32 <script> | |
| 33 window.name = 'outerFrame'; | |
| 34 | |
| 35 var attributes = [ | |
| 36 'clientX', | |
| 37 'clientY' | |
| 38 ]; | |
| 39 | |
| 40 document.events = []; | |
| 41 | |
| 42 function testScenario(scrollX, scrollY, zoomFactor) { | |
| 43 debug('===== scrollX=' + scrollX + ', scrollY=' + scrollY + ', zoomFactor=' +
zoomFactor); | |
| 44 | |
| 45 document.getElementById('target').contentWindow.scrollTo(scrollX, scrollY); | |
| 46 window.internals.setZoomFactor(zoomFactor); | |
| 47 | |
| 48 debug(' *** Mouse events inside iframe ***'); | |
| 49 // mouse events inside iframe | |
| 50 eventSender.mouseMoveTo(200, 200); | |
| 51 eventSender.mouseDown(0); | |
| 52 eventSender.mouseUp(0); | |
| 53 dumpEvents(); | |
| 54 | |
| 55 debug(' *** Touch events inside iframe ***'); | |
| 56 // touch events inside iframe | |
| 57 eventSender.addTouchPoint(200, 200) | |
| 58 eventSender.touchStart(); | |
| 59 eventSender.updateTouchPoint(0, 200, 200); | |
| 60 eventSender.touchMove(); | |
| 61 eventSender.releaseTouchPoint(0); | |
| 62 eventSender.touchEnd(); | |
| 63 | |
| 64 dumpEvents(); | |
| 65 debug(''); | |
| 66 } | |
| 67 | |
| 68 function runTests() { | |
| 69 testScenario(25, 100, 1); | |
| 70 testScenario(40, 140, 1); | |
| 71 testScenario(40, 140, 2); | |
| 72 | |
| 73 testRunner.notifyDone(); | |
| 74 } | |
| 75 | |
| 76 function dumpEvents() | |
| 77 { | |
| 78 document.events.forEach(function(event) { | |
| 79 if (event.type.startsWith('pointer')) { | |
| 80 debug(event.type + " of " + event.pointerType + " is recieved:"); | |
| 81 attributes.forEach(function(att) { | |
| 82 debug(att + " = " + event[att]); | |
| 83 }); | |
| 84 debug("view.name = " + event.view.name); | |
| 85 } else if (event.type.startsWith('touch')) { | |
| 86 debug(event.type + " is recieved:"); | |
| 87 attributes.forEach(function(att) { | |
| 88 debug(att + " = " + event.changedTouches[0][att]); | |
| 89 }); | |
| 90 } else { | |
| 91 debug(event.type + " is recieved:"); | |
| 92 attributes.forEach(function(att) { | |
| 93 debug(att + " = " + event[att]); | |
| 94 }); | |
| 95 } | |
| 96 }); | |
| 97 document.events = []; | |
| 98 } | |
| 99 | |
| 100 if (window.eventSender) { | |
| 101 testRunner.waitUntilDone(); | |
| 102 window.onload = runTests; | |
| 103 } else | |
| 104 debug('This test requires eventSender'); | |
| 105 | |
| 106 description("This test verifies clientX/Y of pointer events inside iframe."); | |
| 107 | |
| 108 </script> | |
| OLD | NEW |