| <html> |
| <head> |
| <script src="../../resources/js-test.js"></script> |
| <script> |
| window.jsTestIsAsync = true; |
| var isMacOSX = navigator.userAgent.indexOf("Mac OS X") >= 0; |
| |
| var givenScrollTop = 2; // Only one page per event, so this should be interpreted as 1 |
| var givenScrollLeft = 2; |
| |
| var maxOverlapBetweenPages = 40; |
| |
| // Window is 800x600. Page scrolls 87.5% of window size. |
| var expectedScrollTop = 600 * 0.875; |
| var expectedScrollLeft = 800 * 0.875; |
| |
| if (isMacOSX) { |
| // On Mac, there is a max overlap between pages that can affect the page scroll size. |
| expectedScrollTop = Math.max(expectedScrollTop, 600 - maxOverlapBetweenPages); |
| expectedScrollLeft = Math.max(expectedScrollLeft, 800 - maxOverlapBetweenPages); |
| } |
| |
| var event; |
| var div; |
| |
| function runTest() |
| { |
| document.body.addEventListener("mousewheel", mousewheelHandler, false); |
| |
| if (window.eventSender) { |
| eventSender.mouseMoveTo(100, 110); |
| eventSender.continuousMouseScrollBy(-window.givenScrollLeft, -window.givenScrollTop, true); |
| } |
| |
| shouldBecomeEqual("document.scrollingElement.scrollTop == window.expectedScrollTop && " + |
| "document.scrollingElement.scrollLeft == window.expectedScrollLeft", "true", finishJSTest) |
| } |
| |
| function mousewheelHandler(e) |
| { |
| event = e; |
| shouldBe("event.wheelDeltaY", "window.givenScrollTop * -3"); |
| shouldBe("event.wheelDeltaX", "window.givenScrollLeft * -3"); |
| |
| if (e.wheelDeltaY) |
| shouldBe("event.wheelDelta", "window.givenScrollTop * -3"); |
| else |
| shouldBe("event.wheelDelta", "window.givenScrollLeft * -3"); |
| } |
| </script> |
| </head> |
| |
| <body style="margin:0" onload="runTest()"> |
| <div style="height:900px;width:2400px"> |
| <div style="background-color:red;height:900px;width:1200px;position:relative;left:0px;top:0px"></div> |
| <div style="background-color:green;height:900px;width:1200px;position:relative;left:1200px;top:-900px"></div> |
| </div> |
| <div style="height:900px;width:2400px"> |
| <div style="background-color:blue;height:900px;width:1200px;position:relative;left:0px;top:0px"></div> |
| <div style="background-color:yellow;height:900px;width:1200px;position:relative;left:1200px;top:-900px"></div> |
| </div> |
| <div id="console"></div> |
| </body> |
| </html> |