Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / touchadjustment / zoom-basic.html
blobaa9a20c012cd83cac3378a58a15eec0d724c8a00
1 <html>
2 <head>
3 <script src="../resources/js-test.js"></script>
4 <style>
5 #div0 { position: absolute; left: 50px; top: 50px; width: 300px; height: 300px; box-sizing: border-box; }
6 #div1 { position: absolute; left: 50px; top: 50px; width: 200px; height: 100px; box-sizing: border-box; }
7 #div2 { position: absolute; left: 50px; top: 150px; width: 200px; height: 100px; padding: 10px; box-sizing: border-box; }
8 </style>
9 </head>
10 <body onload="runTests()">
12 <div id=div0>
13 <div id=div1></div>
14 <div id=div2></div>
15 </div>
17 <p id='description'></p>
18 <div id='console'></div>
20 <script>
21 function testRoundTouch(x, y, radius)
23 var x = x - radius;
24 var y = y - radius;
25 var width = radius * 2;
26 var height = radius * 2;
27 var zoomableRect = internals.bestZoomableAreaForTouchPoint(x, y, width, height, document);
28 return zoomableRect;
31 function testDirectTouches()
33 zoomableArea = testRoundTouch(130, 130, 10);
34 shouldEvaluateTo('zoomableArea.top', 100);
35 shouldEvaluateTo('zoomableArea.left', 100);
36 shouldEvaluateTo('zoomableArea.width', 200);
37 shouldEvaluateTo('zoomableArea.height', 100);
39 zoomableArea = testRoundTouch(130, 230, 10);
40 shouldEvaluateTo('zoomableArea.top', 210);
41 shouldEvaluateTo('zoomableArea.left', 110);
42 shouldEvaluateTo('zoomableArea.width', 180);
43 shouldEvaluateTo('zoomableArea.height', 80);
45 zoomableArea = testRoundTouch(120, 220, 20);
46 shouldEvaluateTo('zoomableArea.top', 200);
47 shouldEvaluateTo('zoomableArea.left', 100);
48 shouldEvaluateTo('zoomableArea.width', 200);
49 shouldEvaluateTo('zoomableArea.height', 100);
51 zoomableArea = testRoundTouch(80, 100, 20);
52 shouldEvaluateTo('zoomableArea.top', 50);
53 shouldEvaluateTo('zoomableArea.left', 50);
54 shouldEvaluateTo('zoomableArea.width', 300);
55 shouldEvaluateTo('zoomableArea.height',300);
58 function runTests()
60 if (window.testRunner && window.internals && internals.bestZoomableAreaForTouchPoint) {
61 description('Test basic cases of tap-to-zoom mechanics.');
62 testRunner.dumpAsText();
63 testRunner.waitUntilDone();
64 testDirectTouches();
65 isSuccessfullyParsed();
66 testRunner.notifyDone();
69 </script>
70 </body>
71 </html>