Index: LayoutTests/fast/overflow/hit-test-overflow-hidden-with-box-shadow.html |
diff --git a/LayoutTests/fast/overflow/hit-test-overflow-hidden-with-box-shadow.html b/LayoutTests/fast/overflow/hit-test-overflow-hidden-with-box-shadow.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6c49f81c88e4ee389f20ba776ac139259931a79b |
--- /dev/null |
+++ b/LayoutTests/fast/overflow/hit-test-overflow-hidden-with-box-shadow.html |
@@ -0,0 +1,102 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
ojan
2014/04/10 01:50:56
We don't typically include the html, head and body
pals
2014/04/10 12:35:33
Done.
|
+<style> |
+#shadow |
+{ |
+ overflow: hidden; |
+ position: absolute; |
+ box-shadow: 0 0 50px #000; |
+ height: 100px; |
+ width: 100px; |
+} |
+#content |
+{ |
+ padding-top: 20px; |
+ padding-left: 20px; |
ojan
2014/04/10 01:50:56
Are these paddings necessary for the test?
pals
2014/04/10 12:35:33
Not necessary. Removed.
Done.
|
+ display: block; |
+ height: 200px; |
+ width: 200px; |
+ background: rgba(0,255,0,0.3); |
+} |
+</style> |
+<script src="../../resources/js-test.js"></script> |
+<script> |
+if (window.testRunner) |
+ testRunner.dumpAsText(); |
+ |
+function click(x, y) |
+{ |
+ if (window.eventSender) { |
+ eventSender.mouseMoveTo(x, y); |
+ eventSender.mouseDown(); |
+ eventSender.mouseUp(); |
+ } |
+} |
+ |
+var absoluteLeft = 0; |
+var absoluteTop = 0; |
+ |
+function calculateAbsoluteLocation(element) |
ojan
2014/04/10 01:50:56
You can just use element.getBoundingClientRect() f
pals
2014/04/10 12:35:33
Done.
|
+{ |
+ absoluteLeft = 0; |
+ absoluteTop = 0; |
+ for (var parentNode = element; parentNode; parentNode = parentNode.offsetParent) { |
+ absoluteLeft += parentNode.offsetLeft; |
ojan
2014/04/10 01:50:56
Please use 4 space indent consistently.
pals
2014/04/10 12:35:33
Done.
|
+ absoluteTop += parentNode.offsetTop; |
+ } |
+} |
+ |
+function test(name, fn) |
+{ |
+ debug("<br>" + name); |
+ fn(); |
+} |
+ |
+description("This test checks that div block should not get events on clicking the shadow outside div block."); |
+ |
+function runTests() |
+{ |
+ |
+ test("Focus should remain in the textarea", function() { |
+ var textarea = document.getElementById("content"); |
+ calculateAbsoluteLocation(textarea); |
+ click(absoluteLeft + 5, absoluteTop + 5); |
+ shouldBeEqualToString("document.activeElement.tagName", "TEXTAREA"); |
+ }); |
+ |
+ test("Focus should move to the body", function() { |
+ var shadow = document.getElementById("shadow"); |
+ calculateAbsoluteLocation(shadow); |
+ var x = absoluteLeft + shadow.offsetWidth + 5; |
+ var y = absoluteTop + 5; |
+ click(x, y); |
+ shouldBeEqualToString("document.activeElement.tagName", "BODY"); |
+ }); |
+ |
+ test("Focus should remain in the textarea", function() { |
+ var textarea = document.getElementById("content"); |
+ calculateAbsoluteLocation(textarea); |
+ click(absoluteLeft + 5, absoluteTop + 5); |
+ shouldBeEqualToString("document.activeElement.tagName", "TEXTAREA"); |
+ }); |
+ |
+ test("Focus should move to the body", function() { |
+ var shadow = document.getElementById("shadow"); |
+ calculateAbsoluteLocation(shadow); |
+ var x = absoluteLeft + 5; |
+ var y = absoluteTop + shadow.offsetHeight + 5; |
+ click(x, y); |
+ shouldBeEqualToString("document.activeElement.tagName", "BODY"); |
+ }); |
+ |
+} |
+</script> |
+ |
+</head> |
+<body onload="runTests();"> |
+<div id="shadow"> |
+ <textarea id="content"></textarea> |
+</div> |
+</body> |
+</html> |