Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / images / drag-image-2.html
blob312095d0c8164440df690afc51cf9e4ee91e6027
1 <!DOCTYPE html>
2 <style>
3 body {
4 background-color: red;
7 #image {
8 width: 50px;
9 height: 50px;
10 background-image: url('resources/grid-transparent.png');
11 -webkit-user-drag: element;
13 </style>
14 <body>
15 <!-- Simulate dragging an element and dump the generated drag image.
16 The expected result should be the same as the input image,
17 without seeing a red background. -->
18 <div id="image"></div>
19 </body>
20 <script>
21 function drag() {
22 testRunner.dumpDragImage();
24 var image = document.getElementById('image');
25 var startX = image.offsetLeft + image.offsetWidth / 2;
26 var startY = image.offsetTop + image.offsetHeight / 2;
27 var positionX = startX + image.offsetWidth;
28 var positionY = startY + image.offsetHeight;
30 eventSender.dragMode = true;
31 eventSender.mouseMoveTo(startX, startY);
32 eventSender.mouseDown();
33 eventSender.mouseMoveTo(positionX, positionY);
34 eventSender.mouseUp();
37 if (!window.testRunner || !window.eventSender) {
38 document.write("This test does not work in manual mode.");
39 } else {
40 window.onload = drag;
42 </script>