| <!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 iframes, because they are an interesting case when computing |
| the clientX, clientY values from screen coordinates. --> |
| <link rel="stylesheet" href="resources/event-mouse-coordinates.css" /> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="resources/event-mouse-coordinates.js"></script> |
| |
| <style> |
| #iframe1 { |
| margin: 0; |
| padding: 0; |
| border: none; |
| |
| position: absolute; |
| left: 200px; |
| top: 100px; |
| width: 600px; |
| height: 500px; |
| } |
| </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> |
| <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: 200, y: 100 }, |
| 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> |