Index: LayoutTests/fast/multicol/event-offset.html |
diff --git a/LayoutTests/fast/multicol/event-offset.html b/LayoutTests/fast/multicol/event-offset.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..85b7d0b82b5b89791010ec6eb32e579c45915d05 |
--- /dev/null |
+++ b/LayoutTests/fast/multicol/event-offset.html |
@@ -0,0 +1,71 @@ |
+<!DOCTYPE html> |
+<style> |
+body { |
+ margin: 0; |
+} |
+ |
+#columns { |
+ position: absolute; |
+ width: 332px; |
+ height: 200px; |
+ top: 220px; |
+ left: 300px; |
+ border: 1px solid black; |
+ -webkit-column-count: 3; |
+ -webkit-column-gap: 16px; |
+ column-fill: auto; |
+ line-height: 50px; |
+} |
+</style> |
+ |
+<div id="columns"> |
+ <br> |
+ <br> |
+ <br> |
+ <div id="in-column1">first</div> |
+ <br> |
+ <div id="in-column2">second</div> |
+ <br> |
+ <br> |
+ <div id="in-column3">third</div> |
+ <br> |
+</div> |
+ |
+<script src="../../resources/js-test.js"></script> |
+<script> |
+description("Dispatch mouse click events in each column and check the result."); |
+function dispatchEvent(clientX, clientY, expectedElementID, expectedOffsetX, expectedOffsetY) { |
+ var e = document.createEvent("MouseEvent"); |
+ e.initMouseEvent("click", true, true, window, 1, 1, 1, clientX, clientY, false, false, false, false, 0, document); |
+ e.expectedElementID = expectedElementID; |
+ e.expectedOffsetX = expectedOffsetX; |
+ e.expectedOffsetY = expectedOffsetY; |
+ var target = document.elementFromPoint(e.clientX, e.clientY); |
+ target.dispatchEvent(e); |
+} |
+ |
+function clicked(event) { |
+ if (!event.expectedElementID) |
+ return; |
+ shouldBe("event.target.id", "event.expectedElementID"); |
+ shouldBe("event.offsetX", "event.expectedOffsetX"); |
+ shouldBe("event.offsetY", "event.expectedOffsetY"); |
+} |
+ |
+if (window.testRunner) |
+ window.testRunner.waitUntilDone(); |
+ |
+document.body.addEventListener('click', clicked, false); |
+window.addEventListener('load', function() { |
+ setTimeout(function() { |
+ setTimeout(function() { |
+ dispatchEvent(380, 400, 'in-column1', 79, 29); |
+ dispatchEvent(480, 300, 'in-column2', 63, 29); |
+ dispatchEvent(632, 221, 'in-column3', 99, 0); |
+ |
+ if (window.testRunner) |
+ window.testRunner.notifyDone(); |
+ }, 0); |
+ }, 0); |
Julien - ping for review
2015/03/25 21:41:32
2 setTimeouts, that seems like a lot. Do we really
mstensho (USE GERRIT)
2015/03/25 22:35:05
Wow! I just snatched all this from events/document
|
+}, false); |
+</script> |