Change fast/e* files to use pre and post js files in LayoutTests/resources.
[WebKit-https.git] / LayoutTests / fast / events / platform-wheelevent-paging-x-in-scrolling-div.html
1 <html>
2     <head>
3         <link rel="stylesheet" href="../js/resources/js-test-style.css">
4         <script src="../../resources/js-test-pre.js"></script>
5         <script>
6             var givenScrollTop = 0;
7             var givenScrollLeft = 2;
8             var expectedScrollTop = 0;
9             var expectedScrollLeft = 322;
10             var event;
11             var div;
12
13             if (window.testRunner)
14                 testRunner.waitUntilDone();
15
16             function dispatchWheelEvent()
17             {
18                 var overflowElement = document.getElementById("overflow");
19                 if (overflowElement)
20                     overflowElement.addEventListener("mousewheel", mousewheelHandler, false);
21
22                 if (window.eventSender) {
23                     eventSender.mouseMoveTo(100, 110);
24                     eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true);
25                 }
26
27                 setTimeout('checkOffsets();', 100);
28             }
29
30             function checkOffsets()
31             {
32                 div = document.getElementById("overflow");
33                 shouldBe("div.scrollTop", "window.expectedScrollTop");
34                 shouldBe("div.scrollLeft", "window.expectedScrollLeft");
35
36                 if (window.testRunner)
37                     window.testRunner.notifyDone();
38             }
39
40             function mousewheelHandler(e)
41             {
42                 event = e;
43                 shouldBe("event.wheelDeltaY", "0");
44                 shouldBe("event.wheelDeltaX", "window.givenScrollLeft * -3");
45
46                 if (e.wheelDeltaY)
47                     shouldBe("event.wheelDelta", "0");
48                 else
49                     shouldBe("event.wheelDelta", "window.givenScrollLeft * -3");
50             }
51         </script>
52     </head>
53
54     <body style="margin:0" onload="setTimeout('dispatchWheelEvent();', 100)">
55          <!-- This div is 200 pixels high. The content results in scrool bars on
56           both edges, resulting in an effective content area of 185 x 185 on
57           linux. The paging context overlap is 24 pixels. So one page of scroll
58           moves the content by 185 - 24 -= 161 pixels. -->
59         <div id="overflow" style="border:2px solid black;overflow:auto;height:200px;width:200px;">
60             <div style="height:300px;width:600px">
61               <div style="background-color:red;height:300px;width:300px;position:relative;left:0px;top:0px"></div>
62               <div style="background-color:green;height:300px;width:300px;position:relative;left:300px;top:-300px"></div>
63             </div>
64             <div style="height:300px;width:600px">
65               <div style="background-color:blue;height:300px;width:300px;position:relative;left:0px;top:0px"></div>
66               <div style="background-color:yellow;height:300px;width:300px;position:relative;left:300px;top:-300px"></div>
67             </div>
68         </div>
69         <div id="console"></div>
70     </body>
71 </html>