4 <title>Touch Adjustment : Plugin boundary - bug ????
</title>
5 <script src=
"../resources/js-test.js"></script>
6 <script src=
"resources/touchadjustment.js"></script>
15 -webkit-box-align: stretch;
16 -webkit-box-orient: horizontal;
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>
33 <p id='description'
></p>
34 <div id='console'
></div>
37 // Set up shortcut access to elements
38 var ids
= ['sandbox', 'plugin', 'toolbar', 'button1', 'button2', 'button3'];
40 ids
.forEach(function(a
) {
41 e
[a
] = document
.getElementById(a
);
44 ids
.forEach(function(a
) {
45 bounds
[a
] = findAbsoluteBounds(e
[a
]);
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');
82 if (window
.testRunner
&& window
.internals
&& internals
.touchNodeAdjustedToBestClickableNode
) {
83 description('Tests touch-adjustment at a plugin boundary.');
85 testIndirectTouches();
86 e
['sandbox'].style
.display
= 'none';