Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / overflow / hit-test-overflow-hidden-with-box-shadow.html
blobaf5a7c1b57012fce8ca1a6e1ee8cc33cbf986952
1 <!DOCTYPE html>
2 <style>
3 #shadow
5 overflow: hidden;
6 position: absolute;
7 box-shadow: 0 0 50px #000;
8 height: 100px;
9 width: 100px;
11 #content
13 display: block;
14 height: 200px;
15 width: 200px;
16 background: rgba(0,255,0,0.3);
18 </style>
19 <script src="../../resources/js-test.js"></script>
20 <script>
21 if (window.testRunner)
22 testRunner.dumpAsText();
24 function click(x, y)
26 if (window.eventSender) {
27 eventSender.mouseMoveTo(x, y);
28 eventSender.mouseDown();
29 eventSender.mouseUp();
33 function test(name, fn)
35 debug("<br>" + name);
36 fn();
39 description("This test checks that div block should not get events on clicking the shadow outside div block.");
41 function runTests()
44 test("Focus should remain in the textarea", function() {
45 var textarea = document.getElementById("content");
46 var rect = textarea.getBoundingClientRect();
47 click(rect.left + 5, rect.top + 5);
48 shouldBeEqualToString("document.activeElement.tagName", "TEXTAREA");
49 });
51 // Click on the shadow at right of the div block.
52 test("Focus should move to the body", function() {
53 var shadow = document.getElementById("shadow");
54 var rect = shadow.getBoundingClientRect();
55 var x = rect.left + shadow.offsetWidth + 5;
56 var y = rect.top + 5;
57 click(x, y);
58 shouldBeEqualToString("document.activeElement.tagName", "BODY");
59 });
61 // Focus on the textarea to prepare for the next test.
62 test("Focus should remain in the textarea", function() {
63 var textarea = document.getElementById("content");
64 var rect = textarea.getBoundingClientRect();
65 click(rect.left + 5, rect.top + 5);
66 shouldBeEqualToString("document.activeElement.tagName", "TEXTAREA");
67 });
69 // Click on the shadow at bottom of the div block.
70 test("Focus should move to the body", function() {
71 var shadow = document.getElementById("shadow");
72 var rect = shadow.getBoundingClientRect();
73 var x = rect.left + 5;
74 var y = rect.top + shadow.offsetHeight + 5;
75 click(x, y);
76 shouldBeEqualToString("document.activeElement.tagName", "BODY");
77 });
80 </script>
82 <body onload="runTests();">
83 <div id="shadow">
84 <textarea id="content"></textarea>
85 </div>
86 </body>