| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 2 <style> | 3 <style> |
| 4 html { |
| 5 font-family: Ahem; |
| 6 font-size: 10px; |
| 7 } |
| 3 #testArea { | 8 #testArea { |
| 4 position: absolute; | 9 position: absolute; |
| 5 right: 50px; | 10 right: 50px; |
| 6 top: 50px; | 11 top: 50px; |
| 7 } | 12 } |
| 8 #target { | 13 #target { |
| 9 width: 10px; | 14 width: 10px; |
| 10 height: 10px; | 15 height: 10px; |
| 11 } | 16 } |
| 12 #frame { | 17 #frame { |
| 13 width: 100px; | 18 width: 100px; |
| 14 height: 100px; | 19 height: 100px; |
| 15 margin-top: 30px; | 20 margin-top: 30px; |
| 16 } | 21 } |
| 17 </style> | 22 </style> |
| 18 <div id=testArea> | 23 <div id=testArea> |
| 19 <div id=target></div> | 24 <div id=target></div> |
| 20 <iframe id=frame srcdoc='<iframe width=75 height=75></iframe>'></iframe> | 25 <iframe id=frame srcdoc='<iframe width=75 height=75></iframe>'></iframe> |
| 21 </div> | 26 </div> |
| 22 <script src="../../resources/js-test.js"></script> | 27 <script src="../../resources/js-test.js"></script> |
| 23 <script> | 28 <script> |
| 29 if (window.internals) { |
| 30 window.internals.settings.setViewportEnabled(true); |
| 31 window.internals.settings.setMockScrollbarsEnabled(true); |
| 32 } |
| 33 |
| 24 description("Count how many hit tests are required for various event scenarios.
Hit tests can be expensive and it's often tempting to add more. These values s
hould only ever be changed to go down, not up."); | 34 description("Count how many hit tests are required for various event scenarios.
Hit tests can be expensive and it's often tempting to add more. These values s
hould only ever be changed to go down, not up."); |
| 25 | 35 |
| 26 function hitTestCountDelta(doc) | 36 function hitTestCountDelta(doc) |
| 27 { | 37 { |
| 28 var lastCount = 0; | 38 var lastCount = 0; |
| 29 if ('lastHitTestCount' in doc) | 39 if ('lastHitTestCount' in doc) |
| 30 lastCount = doc.lastHitTestCount; | 40 lastCount = doc.lastHitTestCount; |
| 31 var newCount = internals.hitTestCount(doc); | 41 var newCount = internals.hitTestCount(doc); |
| 32 doc.lastHitTestCount = newCount; | 42 doc.lastHitTestCount = newCount; |
| 33 return newCount - lastCount; | 43 return newCount - lastCount; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 var doc3 = doc2.querySelector('iframe').contentDocument; | 131 var doc3 = doc2.querySelector('iframe').contentDocument; |
| 122 var point = centerOf(frame); | 132 var point = centerOf(frame); |
| 123 sendEvents(point.x, point.y, [document, doc2, doc3]); | 133 sendEvents(point.x, point.y, [document, doc2, doc3]); |
| 124 debug(''); | 134 debug(''); |
| 125 | 135 |
| 126 debug('Event near boundary of two iframes'); | 136 debug('Event near boundary of two iframes'); |
| 127 debug('---------------------'); | 137 debug('---------------------'); |
| 128 var rect = frame.getBoundingClientRect(); | 138 var rect = frame.getBoundingClientRect(); |
| 129 sendEvents(rect.left + 3, rect.top + 3, [document, doc2, doc3]); | 139 sendEvents(rect.left + 3, rect.top + 3, [document, doc2, doc3]); |
| 130 debug(''); | 140 debug(''); |
| 141 |
| 142 window.internals.settings.setViewportEnabled(false); |
| 143 debug('Event on a simple div (desktop viewport)'); |
| 144 debug('---------------------'); |
| 145 var point = centerOf(document.getElementById('target')); |
| 146 sendEvents(point.x, point.y, [document]); |
| 147 debug(''); |
| 131 } | 148 } |
| 132 </script> | 149 </script> |
| OLD | NEW |