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

Side by Side Diff: LayoutTests/fast/events/elementsFromPoint.html

Issue 869813003: Implement elementsFromPoint (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix typeo Created 5 years, 11 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
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <style>
3 html, body {
4 margin: 0;
5 padding: 0;
6 }
7 body {
8 height: 500px;
9 }
10 #one {
11 width: 200px;
12 height: 200px;
13 background-color: rgba(0,0,255,0.5);
14 }
15 #two {
16 position: absolute;
17 left: 50px;
18 top: 50px;
19 width: 100px;
20 height: 100px;
21 background-color: rgba(255,0,0,0.5);
22 }
23 #two::before {
24 position: absolute;
25 left: 20px;
26 top: 20px;
27 width: 100px;
28 height: 100px;
29 content: "::before";
30 background-color: rgba(255,0,0,0.5);
31 z-index: 9999;
32 }
33 #three {
34 position: absolute;
35 left: 100px;
36 top: 100px;
37 width: 100px;
38 height: 100px;
39 background-color: rgba(0,255,0,0.5);
40 }
41 #four {
42 margin-top: -15px;
43 width: 200px;
44 height: 200px;
45 background-color: rgba(0,0,0,0.5);
46 }
47 #five {
48 float: right;
49 background-color: yellow;
50 width: 100px;
51 height: 1em;
52 }
53 #six {
54 position: absolute;
55 left: 50px;
56 top: 50px;
57 width: 100px;
58 height: 300px;
59 background-color: rgba(0,0,0,0.1);
60 pointer-events: none;
61 }
62 #results {
63 position: absolute;
64 top: 0px;
65 left: 250px;
66 background-color: #eee;
67 border: 1px solid black;
68 }
69 </style>
70 <div id="one"></div>
71 <div id="two"></div>
72 <div id="three"></div>
73 <div id="four"><div id="five"></div></div>
74 <div id="six"></div>
75 <div id="results"></div>
76
77 <script>
78 if (window.testRunner)
79 testRunner.dumpAsText();
80
81 function elementTestFromPoint(x, y) {
82 var elements = document.elementsFromPoint(x, y);
83 var resultText = "elementsFromPoint(" + x + "," + y + "): ";
84 if (elements) {
85 for (var elementIndex = 0; elementIndex < elements.length; elementIndex++) {
86 var element = elements[elementIndex];
87 if (elementIndex > 0)
88 resultText += ", ";
89 resultText += element.tagName;
90 if (element.id)
91 resultText += '#' + element.id;
Rick Byers 2015/02/04 10:34:03 I find it hard to tell at a glance whether the tes
pdr. 2015/02/17 04:10:13 Done.
Rick Byers 2015/02/20 20:02:23 Looks like you now verify that you get the expecte
92 }
93 }
94 var result = document.createElement('div');
95 result.innerText = resultText;
96 document.getElementById('results').appendChild(result);
97 }
98
99 elementTestFromPoint(-1, -1);
100 elementTestFromPoint(10000, 1);
101 elementTestFromPoint(25, 25);
102 elementTestFromPoint(75, 75);
103 elementTestFromPoint(125, 125);
104 elementTestFromPoint(175, 175);
105 elementTestFromPoint(175, 190);
Rick Byers 2015/02/04 10:34:03 Can you add a case that hits on top of the documen
pdr. 2015/02/17 04:10:13 Done in new elementsFromPoint-invalid-cases.html.
Rick Byers 2015/02/20 20:02:23 Heh heh, that's exactly why I AM worried :-). I k
106 elementTestFromPoint(50, 390);
107 </script>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/elementsFromPoint-expected.txt » ('j') | Source/core/dom/TreeScope.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698