Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / event-on-culled_inline.html
blobd9b9b881f349e4f9fb954cfc7b928c76ef7b63b3
1 <!DOCTYPE html>
2 <style type="text/css">
3 input, em { cursor: pointer; margin-right: 100px; }
4 label, span { cursor: pointer; background: transparent; }
5 </style>
6 <script src="../../resources/js-test.js"></script>
7 <div><label id="clickme1" for="checkbox"><input id="checkbox" type="checkbox">Click the empty area on the left</input></label></div>
8 <div><span id="clickme2"> <em id="em">Click the empty area</em><em>in middle</em></span></div>
9 <p id="description"></p>
10 <div id="console"></div>
11 <script>
12 description('Click event should be fired when it occurs within culled inline.');
13 var parent;
14 var gotClick;
15 function hitTest(id) {
16 var element = document.getElementById(id);
17 parent = element.parentElement;
18 // the x, y coordinates on margin of element
19 x = element.offsetLeft + element.offsetWidth + 10;
20 y = element.offsetTop + element.offsetHeight / 2;
22 shouldBeEqualToString('document.elementFromPoint(x, y).id', parent.id);
24 if (window.eventSender) {
25 gotClick = false;
26 parent.addEventListener('click', function(e) {
27 debug(parent.nodeName + ' that is a parent of ' + element.nodeName + ' is clicked.');
28 gotClick = true;
29 });
30 eventSender.mouseMoveTo(x, y);
31 eventSender.mouseDown();
32 eventSender.mouseUp();
33 shouldBeTrue('gotClick');
35 debug('');
38 hitTest('checkbox');
39 hitTest('em');
41 if (window.eventSender)
42 shouldBeTrue('document.getElementById("checkbox").checked');
43 </script>