Use auto/nullptr in scrolling code
[WebKit-https.git] / LayoutTests / editing / pasteboard / drag-drop-href-as-text-data.html
1 <!DOCTYPE html>
2 <html>
3 <style>
4 body {
5     margin: 0;
6 }
7 #source {
8     width: 300px;
9     height: 300px;
10 }
11 #target {
12     border: 1px blue dashed;
13     font-family: monospace;
14     overflow: scroll;
15     white-space: nowrap;
16     width: 100%;
17     height: 300px;
18 }
19 </style>
20
21 <a id="link" href="https://www.webkit.org/"><img id="source" src="../resources/abe.png"></img></a>
22 <div id="target"></div>
23
24 <script>
25 function append(text) {
26     let div = document.createElement("div");
27     div.textContent = text;
28     target.appendChild(div);
29 }
30
31 if (window.testRunner)
32     testRunner.dumpAsText();
33
34 target.addEventListener("dragenter", event => event.preventDefault());
35 target.addEventListener("dragover", event => event.preventDefault());
36 target.addEventListener("drop", event => {
37     for (let type of ["text", "url", "text/plain", "text/uri-list"])
38         append(`${type}: "${event.dataTransfer.getData(type)}"`);
39     event.preventDefault();
40 });
41
42 if (window.eventSender) {
43     let x = source.offsetLeft + source.offsetWidth / 2;
44     let y = source.offsetTop + source.offsetHeight / 2;
45     eventSender.mouseMoveTo(x, y);
46     eventSender.mouseDown();
47     eventSender.leapForward(500);
48     eventSender.mouseMoveTo(x, y + 300);
49     eventSender.mouseUp();
50 }
51 </script>
52 </html>