Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / touchadjustment / plugin.html
blob9a2d30341535b094c1d9ddf2fab1918f609ce7e5
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>Touch Adjustment : Plugin boundary - bug ????</title>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/touchadjustment.js"></script>
7 <style>
8 #plugin {
9 height: 160px;
10 margin-left: 10px;
11 margin-top: 10px;
12 width: 320px;
14 #toolbar {
15 -webkit-box-align: stretch;
16 -webkit-box-orient: horizontal;
17 display: -webkit-box;
18 margin-left: 10px;
20 </style>
21 </head>
22 <body>
24 <div id=sandbox>
25 <embed id="plugin" type="Application/x-webkit-test-webplugin">
26 <div id="toolbar" onckick="function(){}">
27 <button id="button1">A</button>
28 <button id="button2">B</button>
29 <button id="button3">C</button>
30 </div>
31 </div>
33 <p id='description'></p>
34 <div id='console'></div>
36 <script>
37 // Set up shortcut access to elements
38 var ids = ['sandbox', 'plugin', 'toolbar', 'button1', 'button2', 'button3'];
39 var e = {};
40 ids.forEach(function(a) {
41 e[a] = document.getElementById(a);
42 });
43 var bounds = {};
44 ids.forEach(function(a) {
45 bounds[a] = findAbsoluteBounds(e[a]);
46 });
48 function testMidpoint(id)
50 var x = bounds[id].left + bounds[id].width / 2;
51 var y = bounds[id].top + bounds[id].height / 2;
52 testTouchPoint(touchPoint(x, y, 10), e[id]);
55 function testBoundary(buttonId)
57 var x = bounds[buttonId].left + bounds[buttonId].width / 2;
58 var y = (bounds['plugin'].top + bounds['plugin'].height + bounds[buttonId].top) / 2;
59 testTouchPoint(touchPoint(x, y - 5, 10), e['plugin']);
60 testTouchPoint(touchPoint(x, y + 5, 10), e[buttonId]);
63 function testDirectTouches()
65 debug('Test direct hits.');
66 testMidpoint('plugin');
67 testMidpoint('button1');
68 testMidpoint('button2');
69 testMidpoint('button3');
72 function testIndirectTouches()
74 debug('Test hits spanning the plugin boundary.');
75 testBoundary('button1');
76 testBoundary('button2');
77 testBoundary('button3');
80 function runTests()
82 if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
83 description('Tests touch-adjustment at a plugin boundary.');
84 testDirectTouches();
85 testIndirectTouches();
86 e['sandbox'].style.display = 'none';
89 runTests();
90 </script>
91 </body>
92 </html>