Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / touchadjustment / iframe.html
blob62a91100ae66c313ecbe12ea68d24e3801003029
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Touch Adjustment : Correct for frame positions - bug 82043</title>
5 <script src="../resources/js-test.js"></script>
6 <style>
7 #myframe { position: absolute; left: 200px; top: 100px; width: 400px; height: 300px;}
8 </style>
9 </head>
10 <body onload="runTests()">
12 <iframe id=myframe src="resources/inner-frame.html"></iframe>
14 <p id='description'></p>
15 <div id='console'></div>
17 <script>
18 function testRoundTouch(x, y, radius)
20 var x = x - radius;
21 var y = y - radius;
22 var width = radius * 2;
23 var height = radius * 2;
24 var adjustedNode = internals.touchNodeAdjustedToBestClickableNode(x, y, width, height, document);
25 if (adjustedNode.nodeType == 3) // TEXT node
26 adjustedNode = adjustedNode.parentNode;
27 return adjustedNode;
29 function testDirectTouches()
31 debug('Test fat direct touches.');
33 adjustedNode = testRoundTouch(260, 200, 200);
34 shouldBeEqualToString('adjustedNode.id', 'a1');
36 adjustedNode = testRoundTouch(340, 200, 200);
37 shouldBeEqualToString('adjustedNode.id', 'a2');
40 function runTests()
42 if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
43 description('Test touch-adjustment on links in an iframe. Making sure we iframe position is correctly adjusted for.');
44 testDirectTouches();
45 finishJSTest();
48 jsTestIsAsync = true;
49 </script>
50 </body>
51 </html>