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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/events/elementsFromPoint-expected.txt » ('j') | Source/core/dom/TreeScope.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/elementsFromPoint.html
diff --git a/LayoutTests/fast/events/elementsFromPoint.html b/LayoutTests/fast/events/elementsFromPoint.html
new file mode 100644
index 0000000000000000000000000000000000000000..ceda6b4afc9c8a155e8e1f5547ff98be9859a30e
--- /dev/null
+++ b/LayoutTests/fast/events/elementsFromPoint.html
@@ -0,0 +1,107 @@
+<!DOCTYPE HTML>
+<style>
+html, body {
+ margin: 0;
+ padding: 0;
+}
+body {
+ height: 500px;
+}
+#one {
+ width: 200px;
+ height: 200px;
+ background-color: rgba(0,0,255,0.5);
+}
+#two {
+ position: absolute;
+ left: 50px;
+ top: 50px;
+ width: 100px;
+ height: 100px;
+ background-color: rgba(255,0,0,0.5);
+}
+#two::before {
+ position: absolute;
+ left: 20px;
+ top: 20px;
+ width: 100px;
+ height: 100px;
+ content: "::before";
+ background-color: rgba(255,0,0,0.5);
+ z-index: 9999;
+}
+#three {
+ position: absolute;
+ left: 100px;
+ top: 100px;
+ width: 100px;
+ height: 100px;
+ background-color: rgba(0,255,0,0.5);
+}
+#four {
+ margin-top: -15px;
+ width: 200px;
+ height: 200px;
+ background-color: rgba(0,0,0,0.5);
+}
+#five {
+ float: right;
+ background-color: yellow;
+ width: 100px;
+ height: 1em;
+}
+#six {
+ position: absolute;
+ left: 50px;
+ top: 50px;
+ width: 100px;
+ height: 300px;
+ background-color: rgba(0,0,0,0.1);
+ pointer-events: none;
+}
+#results {
+ position: absolute;
+ top: 0px;
+ left: 250px;
+ background-color: #eee;
+ border: 1px solid black;
+}
+</style>
+<div id="one"></div>
+<div id="two"></div>
+<div id="three"></div>
+<div id="four"><div id="five"></div></div>
+<div id="six"></div>
+<div id="results"></div>
+
+<script>
+if (window.testRunner)
+ testRunner.dumpAsText();
+
+function elementTestFromPoint(x, y) {
+ var elements = document.elementsFromPoint(x, y);
+ var resultText = "elementsFromPoint(" + x + "," + y + "): ";
+ if (elements) {
+ for (var elementIndex = 0; elementIndex < elements.length; elementIndex++) {
+ var element = elements[elementIndex];
+ if (elementIndex > 0)
+ resultText += ", ";
+ resultText += element.tagName;
+ if (element.id)
+ 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
+ }
+ }
+ var result = document.createElement('div');
+ result.innerText = resultText;
+ document.getElementById('results').appendChild(result);
+}
+
+elementTestFromPoint(-1, -1);
+elementTestFromPoint(10000, 1);
+elementTestFromPoint(25, 25);
+elementTestFromPoint(75, 75);
+elementTestFromPoint(125, 125);
+elementTestFromPoint(175, 175);
+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
+elementTestFromPoint(50, 390);
+</script>
« 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