Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: LayoutTests/fast/overflow/hit-test-overflow-hidden-with-box-shadow.html

Issue 230943003: hitTest should check the location if it is inside borderBoxRect in case of overflow: hidden (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/overflow/hit-test-overflow-hidden-with-box-shadow-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <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.
4 <style>
5 #shadow
6 {
7 overflow: hidden;
8 position: absolute;
9 box-shadow: 0 0 50px #000;
10 height: 100px;
11 width: 100px;
12 }
13 #content
14 {
15 padding-top: 20px;
16 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.
17 display: block;
18 height: 200px;
19 width: 200px;
20 background: rgba(0,255,0,0.3);
21 }
22 </style>
23 <script src="../../resources/js-test.js"></script>
24 <script>
25 if (window.testRunner)
26 testRunner.dumpAsText();
27
28 function click(x, y)
29 {
30 if (window.eventSender) {
31 eventSender.mouseMoveTo(x, y);
32 eventSender.mouseDown();
33 eventSender.mouseUp();
34 }
35 }
36
37 var absoluteLeft = 0;
38 var absoluteTop = 0;
39
40 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.
41 {
42 absoluteLeft = 0;
43 absoluteTop = 0;
44 for (var parentNode = element; parentNode; parentNode = parentNode.offsetPar ent) {
45 absoluteLeft += parentNode.offsetLeft;
ojan 2014/04/10 01:50:56 Please use 4 space indent consistently.
pals 2014/04/10 12:35:33 Done.
46 absoluteTop += parentNode.offsetTop;
47 }
48 }
49
50 function test(name, fn)
51 {
52 debug("<br>" + name);
53 fn();
54 }
55
56 description("This test checks that div block should not get events on clicking t he shadow outside div block.");
57
58 function runTests()
59 {
60
61 test("Focus should remain in the textarea", function() {
62 var textarea = document.getElementById("content");
63 calculateAbsoluteLocation(textarea);
64 click(absoluteLeft + 5, absoluteTop + 5);
65 shouldBeEqualToString("document.activeElement.tagName", "TEXTAREA");
66 });
67
68 test("Focus should move to the body", function() {
69 var shadow = document.getElementById("shadow");
70 calculateAbsoluteLocation(shadow);
71 var x = absoluteLeft + shadow.offsetWidth + 5;
72 var y = absoluteTop + 5;
73 click(x, y);
74 shouldBeEqualToString("document.activeElement.tagName", "BODY");
75 });
76
77 test("Focus should remain in the textarea", function() {
78 var textarea = document.getElementById("content");
79 calculateAbsoluteLocation(textarea);
80 click(absoluteLeft + 5, absoluteTop + 5);
81 shouldBeEqualToString("document.activeElement.tagName", "TEXTAREA");
82 });
83
84 test("Focus should move to the body", function() {
85 var shadow = document.getElementById("shadow");
86 calculateAbsoluteLocation(shadow);
87 var x = absoluteLeft + 5;
88 var y = absoluteTop + shadow.offsetHeight + 5;
89 click(x, y);
90 shouldBeEqualToString("document.activeElement.tagName", "BODY");
91 });
92
93 }
94 </script>
95
96 </head>
97 <body onload="runTests();">
98 <div id="shadow">
99 <textarea id="content"></textarea>
100 </div>
101 </body>
102 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/overflow/hit-test-overflow-hidden-with-box-shadow-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698