| OLD | NEW | 
|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> | 
| 2 <script src="../../../resources/js-test.js"></script> | 2 <script src="../../../resources/js-test.js"></script> | 
| 3 <style> | 3 <style> | 
| 4     body { | 4     body { | 
| 5         height: 2000px; | 5         height: 2000px; | 
| 6         width: 2000px; | 6         width: 2000px; | 
| 7     } | 7     } | 
| 8 </style> | 8 </style> | 
| 9 | 9 | 
| 10 <script> | 10 <script> | 
| 11     window.jsTestIsAsync = true; | 11     window.jsTestIsAsync = true; | 
| 12 | 12 | 
| 13     description("This test ensures that consecutive mouse wheel ticks scroll\ | 13     description("This test ensures that consecutive mouse wheel ticks scroll\ | 
| 14         to the right offset. The main purpose of this test is to ensure that\ | 14         to the right offset. The main purpose of this test is to ensure that\ | 
| 15         smooth scrolling on the compositor works as intended (tested via\ | 15         smooth scrolling on the compositor works as intended (tested via\ | 
| 16         virtual suite virtual/threaded/)."); | 16         virtual suite virtual/threaded/)."); | 
| 17 | 17 | 
|  | 18     function testDiagonalScroll() { | 
|  | 19         // Reset | 
|  | 20         document.scrollingElement.scrollTop = 0; | 
|  | 21         document.scrollingElement.scrollLeft = 0; | 
|  | 22 | 
|  | 23         eventSender.mouseMoveTo(20, 20); | 
|  | 24         // Scroll 3 ticks diagonally. | 
|  | 25         eventSender.mouseScrollBy(-3, -3); | 
|  | 26         // Undo 2 ticks in each direction. | 
|  | 27         eventSender.mouseScrollBy(2, 2); | 
|  | 28         // 40px per tick. | 
|  | 29         shouldBecomeEqual("document.scrollingElement.scrollTop == 40 && " + | 
|  | 30           "document.scrollingElement.scrollLeft == 40", "true", finishJSTest); | 
|  | 31     } | 
|  | 32 | 
| 18     function runTest() { | 33     function runTest() { | 
| 19         if (!window.eventSender || !window.internals) { | 34         if (!window.eventSender || !window.internals) { | 
| 20             finishJSTest(); | 35             finishJSTest(); | 
| 21             return; | 36             return; | 
| 22         } | 37         } | 
| 23 | 38 | 
| 24         // Turn on smooth scrolling. | 39         // Turn on smooth scrolling. | 
| 25         internals.settings.setScrollAnimatorEnabled(true); | 40         internals.settings.setScrollAnimatorEnabled(true); | 
| 26 | 41 | 
| 27         eventSender.mouseMoveTo(20, 20); | 42         eventSender.mouseMoveTo(20, 20); | 
| 28         // Scroll down 3 ticks. | 43         // Scroll down 3 ticks. | 
| 29         eventSender.mouseScrollBy(0, -1); | 44         eventSender.mouseScrollBy(0, -1); | 
| 30         eventSender.mouseScrollBy(0, -1); | 45         eventSender.mouseScrollBy(0, -2); | 
| 31         eventSender.mouseScrollBy(0, -1); |  | 
| 32         // Scroll right 3 ticks. | 46         // Scroll right 3 ticks. | 
| 33         eventSender.mouseScrollBy(-1, 0); | 47         eventSender.mouseScrollBy(-1, 0); | 
| 34         eventSender.mouseScrollBy(-1, 0); | 48         eventSender.mouseScrollBy(-2, 0); | 
| 35         eventSender.mouseScrollBy(-1, 0); |  | 
| 36         // Undo 1 tick in each direction. | 49         // Undo 1 tick in each direction. | 
| 37         eventSender.mouseScrollBy(0, 1); | 50         eventSender.mouseScrollBy(0, 1); | 
| 38         eventSender.mouseScrollBy(1, 0); | 51         eventSender.mouseScrollBy(1, 0); | 
| 39 | 52 | 
| 40         // 40px per tick. | 53         // 40px per tick. | 
| 41         shouldBecomeEqual("document.scrollingElement.scrollTop == 80 && " + | 54         shouldBecomeEqual("document.scrollingElement.scrollTop == 80 && " + | 
| 42           "document.scrollingElement.scrollLeft == 80", "true", finishJSTest); | 55           "document.scrollingElement.scrollLeft == 80", "true", testDiagonalScro
    ll); | 
| 43     } | 56     } | 
| 44 </script> | 57 </script> | 
| 45 | 58 | 
| 46 <body onload="runTest()"></body> | 59 <body onload="runTest()"></body> | 
| OLD | NEW | 
|---|