| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <script src='../../../../../resources/js-test.js'></script> | 2 <script src='../../../../../resources/js-test.js'></script> |
| 3 <style> | 3 <style> |
| 4 iframe { | 4 iframe { |
| 5 width: 300px; | 5 width: 300px; |
| 6 height: 300px; | 6 height: 300px; |
| 7 top: 100px; | 7 top: 100px; |
| 8 left: 50px; | 8 left: 50px; |
| 9 border: 0; | 9 border: 0; |
| 10 position: absolute; | 10 position: absolute; |
| 11 background: green; | 11 background: green; |
| 12 } | 12 } |
| 13 </style> | 13 </style> |
| 14 <iframe id='target' srcdoc=" | 14 <iframe id='target' srcdoc=" |
| 15 <body style='height:500px; width: 500px; padding: 0; margin: 0;'> | 15 <body style='height:500px; width: 500px; padding: 0; margin: 0;'> |
| 16 <script> | 16 <script> |
| 17 window.name = 'innerFrame'; |
| 17 var testEventList = ['pointerup', 'pointerdown', 'pointermove', | 18 var testEventList = ['pointerup', 'pointerdown', 'pointermove', |
| 18 'touchstart', 'touchmove', 'touchend', | 19 'touchstart', 'touchmove', 'touchend', |
| 19 'mouseup', 'mousedown', 'mousemove']; | 20 'mouseup', 'mousedown', 'mousemove']; |
| 20 testEventList.forEach(function(eventName) { | 21 testEventList.forEach(function(eventName) { |
| 21 document.documentElement.addEventListener(eventName, function(event) { | 22 document.documentElement.addEventListener(eventName, function(event) { |
| 22 top.document.events.push(event); | 23 top.document.events.push(event); |
| 23 }); | 24 }); |
| 24 }); | 25 }); |
| 25 </script> | 26 </script> |
| 26 </body>"> | 27 </body>"> |
| 27 </iframe> | 28 </iframe> |
| 28 | 29 |
| 29 <div id='console'></div> | 30 <div id='console'></div> |
| 30 | 31 |
| 31 <script> | 32 <script> |
| 33 window.name = 'outerFrame'; |
| 32 | 34 |
| 33 var attributes = [ | 35 var attributes = [ |
| 34 'clientX', | 36 'clientX', |
| 35 'clientY' | 37 'clientY' |
| 36 ]; | 38 ]; |
| 37 | 39 |
| 38 document.events = []; | 40 document.events = []; |
| 39 | 41 |
| 40 function testScenario(scrollX, scrollY, zoomFactor) { | 42 function testScenario(scrollX, scrollY, zoomFactor) { |
| 41 debug('===== scrollX=' + scrollX + ', scrollY=' + scrollY + ', zoomFactor=' +
zoomFactor); | 43 debug('===== scrollX=' + scrollX + ', scrollY=' + scrollY + ', zoomFactor=' +
zoomFactor); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 72 } | 74 } |
| 73 | 75 |
| 74 function dumpEvents() | 76 function dumpEvents() |
| 75 { | 77 { |
| 76 document.events.forEach(function(event) { | 78 document.events.forEach(function(event) { |
| 77 if (event.type.startsWith('pointer')) { | 79 if (event.type.startsWith('pointer')) { |
| 78 debug(event.type + " of " + event.pointerType + " is recieved:"); | 80 debug(event.type + " of " + event.pointerType + " is recieved:"); |
| 79 attributes.forEach(function(att) { | 81 attributes.forEach(function(att) { |
| 80 debug(att + " = " + event[att]); | 82 debug(att + " = " + event[att]); |
| 81 }); | 83 }); |
| 84 debug("view.name = " + event.view.name); |
| 82 } else if (event.type.startsWith('touch')) { | 85 } else if (event.type.startsWith('touch')) { |
| 83 debug(event.type + " is recieved:"); | 86 debug(event.type + " is recieved:"); |
| 84 attributes.forEach(function(att) { | 87 attributes.forEach(function(att) { |
| 85 debug(att + " = " + event.changedTouches[0][att]); | 88 debug(att + " = " + event.changedTouches[0][att]); |
| 86 }); | 89 }); |
| 87 } else { | 90 } else { |
| 88 debug(event.type + " is recieved:"); | 91 debug(event.type + " is recieved:"); |
| 89 attributes.forEach(function(att) { | 92 attributes.forEach(function(att) { |
| 90 debug(att + " = " + event[att]); | 93 debug(att + " = " + event[att]); |
| 91 }); | 94 }); |
| 92 } | 95 } |
| 93 }); | 96 }); |
| 94 document.events = []; | 97 document.events = []; |
| 95 } | 98 } |
| 96 | 99 |
| 97 if (window.eventSender) { | 100 if (window.eventSender) { |
| 98 testRunner.waitUntilDone(); | 101 testRunner.waitUntilDone(); |
| 99 window.onload = runTests; | 102 window.onload = runTests; |
| 100 } else | 103 } else |
| 101 debug('This test requires eventSender'); | 104 debug('This test requires eventSender'); |
| 102 | 105 |
| 103 description("This test verifies clientX/Y of pointer events inside iframe."); | 106 description("This test verifies clientX/Y of pointer events inside iframe."); |
| 104 | 107 |
| 105 </script> | 108 </script> |
| OLD | NEW |