Chromium Code Reviews| 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> |