Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / user-drag-none.html
blob1c2208fa3e32241deb345e484854fc13fdd90290
1 <style>
2 .box { width: 100px; height: 90px; margin-bottom: 10px; background-color: lightblue; }
3 .drag-element { -webkit-user-drag: element; }
4 .drag-none { -webkit-user-drag: none; }
5 a { display: block; width: 80px; height: 80px; background-color: yellow; font-family: Ahem; font-size: 25px; }
6 a span { color: orange; }
7 a img { vertical-align: bottom; }
8 </style>
9 <div id="container" style="position: relative;">
10 <div class="box" expect="IMG nil">
11 <img src="resources/greenbox.png">
12 </div>
14 <div class="box" expect="nil nil">
15 <img class="drag-none" src="resources/greenbox.png">
16 </div>
18 <div class="box drag-element" expect="DIV DIV">
19 <img class="drag-none" src="resources/greenbox.png">
20 </div>
22 <div class="box" expect="IMG A A A nil">
23 <a href="#"><img src="resources/greenbox.png">x<br><span>y</span></a>
24 </div>
26 <div class="box" expect="IMG A A A nil">
27 <a href="#" class="drag-element"><img src="resources/greenbox.png">x<br><span>y</span></a>
28 </div>
30 <div class="box" expect="IMG nil nil nil nil">
31 <a href="#" class="drag-none"><img src="resources/greenbox.png">x<br><span>y</span></a>
32 </div>
34 <div class="box" expect="A A A A nil">
35 <a href="#"><img class="drag-none" src="resources/greenbox.png">x<br><span>y</span></a>
36 </div>
38 <div class="box" expect="A A A A nil">
39 <a href="#" class="drag-element"><img class="drag-none" src="resources/greenbox.png">x<br><span>y</span></a>
40 </div>
42 <div class="box drag-element" expect="IMG DIV DIV DIV DIV">
43 <a href="#" class="drag-none"><img src="resources/greenbox.png">x<br><span>y</span></a>
44 </div>
46 <div class="box drag-element" expect="A A A A DIV">
47 <a href="#"><img class="drag-none" src="resources/greenbox.png">x<br><span>y</span></a>
48 </div>
50 <div class="box drag-element" expect="A A A A DIV">
51 <a href="#" class="drag-element"><img class="drag-none" src="resources/greenbox.png">x<br><span>y</span></a>
52 </div>
53 </div>
54 <pre id="console"></pre>
55 <script>
56 function log(message)
58 document.getElementById("console").appendChild(document.createTextNode(message + "\n"));
61 onload = window.testRunner ? function()
63 testRunner.dumpAsText();
65 var container = document.getElementById("container");
66 var y = container.getBoundingClientRect().top;
67 for (var i = 0; i < container.childElementCount; ++i) {
68 var listener = function(event)
70 result = event.target.nodeType === Node.TEXT_NODE ? "text" : event.target.tagName;
73 container.addEventListener("dragstart", listener);
75 var child = container.children[i];
76 log("Test #" + i);
78 var expectedResults = child.getAttribute("expect").split(" ");
79 var result;
81 function test(h, v)
83 if (expectedResults.length) {
84 getSelection().empty();
85 result = "nil";
86 eventSender.mouseMoveTo(h, y - scrollY + v);
87 eventSender.mouseDown();
88 eventSender.mouseMoveTo(220, y - scrollY + v);
89 eventSender.mouseUp();
90 var expected = expectedResults.shift();
91 log(result === expected ? "PASS" : "FAIL: expected " + expected + " but got " + result);
95 test(20, 20);
96 test(45, 20);
97 test(20, 45);
98 test(45, 45);
99 test(95, 85);
101 container.removeEventListener("dragstart", listener);
102 y += 100;
103 scrollBy(0, 100);
105 } : undefined;
106 </script>