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