Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / scrollbars / scrollbar-added-during-drag.html
blobe4a4ba28985b7ea1f00cfdc67049cb3437e4189b
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <!--
5 This test verifies that removing a horizontal scrollbar while the vertical
6 scrollbar's thumb is being dragged does not reset the vertical scroll offset.
7 -->
8 <style>
10 body {
11 margin: 0;
12 overflow: hidden;
14 iframe {
15 border: 0;
16 width: 800px;
17 height: 600px;
19 ::-webkit-scrollbar {
20 width: 20px;
21 height: 20px;
23 ::-webkit-scrollbar-button {
24 height: 20px;
25 width: 20px;
26 background-color: gray;
28 ::-webkit-scrollbar-thumb {
29 height: 20px;
30 width: 20px;
31 background-color: blue;
34 </style>
35 </head>
36 <body>
37 <iframe id="f"></iframe>
38 <script>
40 var frame = document.getElementById("f").contentWindow;
41 var frameBody = frame.document.body;
43 frameBody.style.width = "2000px";
44 frameBody.style.height = "2000px";
46 frame.addEventListener('scroll', function() {
47 if (frameBody.scrollTop > 400)
48 frameBody.style.width = "600px";
49 });
51 function runTest() {
52 testRunner.waitUntilDone();
54 // Tell eventSender not to batch mouse move events.
55 eventSender.dragMode = false;
57 eventSender.mouseMoveTo(790, 50);
58 eventSender.mouseDown();
59 eventSender.mouseMoveTo(790, 250);
61 frame.addEventListener('scroll', finish);
64 function finish() {
65 eventSender.mouseMoveTo(790, 350);
66 eventSender.mouseUp();
68 document.body.innerText = frameBody.scrollTop > 0 ? "PASS" : "FAIL";
70 testRunner.dumpAsText();
71 testRunner.notifyDone();
74 if (window.testRunner && window.eventSender)
75 runTest();
76 else
77 frameBody.innerText = 'Scroll down by dragging the thumb. ' +
78 'Test passes if scroll offset does not jump back to 0.';
80 </script>
81 </body>
82 </html>