Hitpoint for link which spans two lines in web content is incorrect
[WebKit-https.git] / LayoutTests / accessibility / ios-simulator / links-activation.html
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html>
3 <head>
4 <script src="../../resources/js-test-pre.js"></script>
5 <script>
6 if (window.testRunner)
7     testRunner.dumpAsText();
8 </script>
9 </head>
10 <body>
11
12 <p>This is a very long, long, long, long, line that contains a link that expands multiple lines: <a id="multiline-link" href="#">Apple<br><br>Inc.</a> is based in Cupertino California.
13 </p>
14
15 <br><br>
16
17 <p>A singleline link: <a id="singleline-link" href="#">Apple Inc.</a> is based in Cupertino California.
18 </p>
19
20 <p id="description"></p>
21 <div id="console"></div>
22
23 <script>
24     description("This test ensures that the activation point (or click point) for a link is inside the bounding rect for the link. .");
25
26     function clickPointInsideFrame(el) {
27         var clickX = el.clickPointX;
28         var clickY = el.clickPointY;
29
30         var frameX = el.x;
31         var frameY = el.y;
32         var frameW = el.width;
33         var frameH = el.height;
34
35         return (clickX >= frameX && clickX <= frameX + frameW
36                 && clickY >= frameY && clickY <= frameY + frameH);
37     };
38
39     if (window.accessibilityController) {
40         window.jsTestIsAsync = true;
41
42         var link = accessibilityController.accessibleElementById("multiline-link");
43         shouldBeTrue("clickPointInsideFrame(link)");
44         link.press();
45
46         link = accessibilityController.accessibleElementById("singleline-link");
47         shouldBeTrue("clickPointInsideFrame(link)");
48         link.press();
49
50         setTimeout(
51             function() {
52                 finishJSTest();
53             }, 10);
54     }
55 </script>
56
57 <script src="../../resources/js-test-post.js"></script>
58 </body>
59 </html>