OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <head> | |
4 <style> | |
5 #iframe1 { | |
6 position: absolute; | |
7 top: 100px; | |
8 left: 50px; | |
9 width: 200px; | |
10 height: 200px; | |
11 } | |
12 #iframe2 { | |
13 position: absolute; | |
14 top: 100px; | |
15 left: 400px; | |
16 width: 200px; | |
17 height: 200px; | |
18 } | |
19 </style> | |
20 <body onload="runTest();"> | |
21 <div>This test validates that touch hit tests rects are created in the coordinat
es of the outermost view, not their containing view. | |
22 This test only works in DumpRenderTree.</div> | |
23 <div id="console"></div> | |
24 <iframe id="iframe1" src="resources/frame-with-touch-handler.html"></iframe> | |
25 <iframe id="iframe2"></iframe> | |
26 <iframe id="iframe3" src="resources/frame-with-document-touch-handler.html"></if
rame> | |
27 <script> | |
28 | |
29 var iframeDocument = document.getElementById("iframe2").contentWindow.document; | |
30 iframeDocument.open('text/html', 'replace'); | |
31 iframeDocument.write("<!DOCTYPE html>\n<html><body><iframe src=\"resources/frame
-with-touch-handler.html\" style=\"position: relative; top: 50px;\"></iframe></b
ody>"); | |
32 iframeDocument.close(); | |
33 | |
34 function log(msg) { | |
35 var span = document.createElement("span"); | |
36 document.getElementById("console").appendChild(span); | |
37 span.innerHTML = msg + '<br />'; | |
38 } | |
39 | |
40 function sortRects(a, b) { | |
41 return a.top - b.top; | |
42 } | |
43 | |
44 function runTest() { | |
45 if (!window.testRunner) | |
46 return; | |
47 window.testRunner.dumpAsText(); | |
48 | |
49 rects = window.internals.touchEventTargetClientRects(document); | |
50 var sortedRects = new Array(); | |
51 for (var i = 0; i < rects.length; ++i) | |
52 sortedRects[i] = rects[i]; | |
53 sortedRects.sort(sortRects); | |
54 for (var i = 0; i < rects.length; ++i) | |
55 log("[" + i + "]: (" + sortedRects[i].left + ", " + sortedRects[
i].top + ", " + sortedRects[i].width + ", " + sortedRects[i].height + ")"); | |
56 } | |
57 </script> | |
58 </body> | |
OLD | NEW |