Index: third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates-nested-iframes.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates-nested-iframes.html b/third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates-nested-iframes.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ea8b96f9f9aa35fa18e08a4fdf3f3ed2cb40a509 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/dnd/event-mouse-coordinates-nested-iframes.html |
@@ -0,0 +1,64 @@ |
+<!DOCTYPE html> |
+<meta charset="utf-8" /> |
+<!-- This test checks whether we compute pointer coordinates correctly for the |
+ dragstart, dragend, and drop events issued during drag-and-drop operations. |
+ This test uses nested iframes, because they are a tricky case when |
+ computing the clientX, clientY values from screen coordinates. Furthermore, |
+ running this test through LSAN ensures that we reset the drag state |
+ correctly in all the frames. --> |
+<link rel="stylesheet" href="resources/event-mouse-coordinates-nested-iframe.css" /> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script src="resources/event-mouse-coordinates.js"></script> |
+<style> |
+</style> |
+ |
+<p> |
+ Please drag the "Drag Me" box into the "Drop Here" box. |
+</p> |
+ |
+<iframe id="iframe1" data-source="iframe1-srcdoc"></iframe> |
+ |
+<script id="iframe1-srcdoc" language="text/html"> |
+<!DOCTYPE html> |
+<meta charset="utf-8" /> |
+<link rel="stylesheet" href="resources/event-mouse-coordinates-nested-iframe.css" /> |
+<iframe id="iframe2" data-source="iframe2-srcdoc"> |
+</script> |
+ |
+<script id="iframe2-srcdoc" language="text/html"> |
+<!DOCTYPE html> |
+<meta charset="utf-8" /> |
+<link rel="stylesheet" href="resources/event-mouse-coordinates-nested-iframe.css" /> |
+<iframe id="iframe3" data-source="iframe3-srcdoc"> |
+</script> |
+ |
+<script id="iframe3-srcdoc" language="text/html"> |
+<!DOCTYPE html> |
+<meta charset="utf-8" /> |
+<link rel="stylesheet" href="resources/event-mouse-coordinates.css" /> |
+<aside class="dragged box" draggable="true"> |
+ Drag Me |
+</aside> |
+ |
+<aside class="dropzone box"> |
+ Drop Here |
+</aside> |
+</script> |
+ |
+<script> |
+ |
+promise_test((t) => { |
+ return loadNestedFrames(document).then((frameDocument) => { |
+ const dragCenter = elementCenter(frameDocument.querySelector('.dragged')); |
+ const dropCenter = elementCenter(frameDocument.querySelector('.dropzone')); |
+ return runDragTest(t, { |
+ domRoot: frameDocument, |
+ frameOffset: { x: 90, y: 150 }, |
+ start: { client: dragCenter, page: { x: 250, y: 150 }}, |
+ end: { client: dropCenter, page: { x: 450, y: 350 }}, |
+ }); |
+ }); |
+}, 'Dragging and dropping DOM nodes in an iframe'); |
+ |
+</script> |