| 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 ::-webkit-scrollbar { | 8 ::-webkit-scrollbar { |
| 9 width: 0px; | 9 width: 0px; |
| 10 height: 0px; | 10 height: 0px; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 } | 24 } |
| 25 | 25 |
| 26 // Turn off smooth scrolling. | 26 // Turn off smooth scrolling. |
| 27 internals.settings.setScrollAnimatorEnabled(false); | 27 internals.settings.setScrollAnimatorEnabled(false); |
| 28 | 28 |
| 29 // Scroll both viewports. | 29 // Scroll both viewports. |
| 30 eventSender.mouseMoveTo(100, 100); | 30 eventSender.mouseMoveTo(100, 100); |
| 31 eventSender.continuousMouseScrollBy(100, 100); | 31 eventSender.continuousMouseScrollBy(100, 100); |
| 32 | 32 |
| 33 debug(" **** Initial visual viewport dimensions *****"); | 33 debug(" **** Initial visual viewport dimensions *****"); |
| 34 shouldBe("document.visualViewport.scrollTop", "0"); | 34 shouldBe("window.visualViewport.scrollTop", "0"); |
| 35 shouldBe("document.visualViewport.scrollLeft", "0"); | 35 shouldBe("window.visualViewport.scrollLeft", "0"); |
| 36 shouldBe("document.visualViewport.clientWidth", "800"); | 36 shouldBe("window.visualViewport.clientWidth", "800"); |
| 37 shouldBe("document.visualViewport.clientHeight", "600"); | 37 shouldBe("window.visualViewport.clientHeight", "600"); |
| 38 shouldBe("document.visualViewport.pageScale", "1"); | 38 shouldBe("window.visualViewport.pageScale", "1"); |
| 39 | 39 |
| 40 // Scale and scroll visual viewport. | 40 // Scale and scroll visual viewport. |
| 41 internals.setPageScaleFactor(2); | 41 internals.setPageScaleFactor(2); |
| 42 internals.setVisualViewportOffset(10, 10); | 42 internals.setVisualViewportOffset(10, 10); |
| 43 | 43 |
| 44 debug(" **** Viewport dimensions after scale and scroll *****"); | 44 debug(" **** Viewport dimensions after scale and scroll *****"); |
| 45 shouldBe("document.visualViewport.scrollTop", "10"); | 45 shouldBe("window.visualViewport.scrollTop", "10"); |
| 46 shouldBe("document.visualViewport.scrollLeft", "10"); | 46 shouldBe("window.visualViewport.scrollLeft", "10"); |
| 47 shouldBe("document.visualViewport.clientWidth", "400"); | 47 shouldBe("window.visualViewport.clientWidth", "400"); |
| 48 shouldBe("document.visualViewport.clientHeight", "300"); | 48 shouldBe("window.visualViewport.clientHeight", "300"); |
| 49 shouldBe("document.visualViewport.pageScale", "2"); | 49 shouldBe("window.visualViewport.pageScale", "2"); |
| 50 | 50 |
| 51 document.visualViewport.scrollTop = 20; | 51 window.visualViewport.scrollTop = 20; |
| 52 document.visualViewport.scrollLeft = 0; | 52 window.visualViewport.scrollLeft = 0; |
| 53 debug(" **** Writable viewport dimensions *****"); | 53 debug(" **** Writable viewport dimensions *****"); |
| 54 shouldBe("document.visualViewport.scrollTop", "20"); | 54 shouldBe("window.visualViewport.scrollTop", "20"); |
| 55 shouldBe("document.visualViewport.scrollLeft", "0"); | 55 shouldBe("window.visualViewport.scrollLeft", "0"); |
| 56 document.visualViewport.scrollTop = -20; | 56 window.visualViewport.scrollTop = -20; |
| 57 shouldBe("document.visualViewport.scrollTop", "0"); | 57 shouldBe("window.visualViewport.scrollTop", "0"); |
| 58 document.visualViewport.scrollTop = 20.5; | 58 window.visualViewport.scrollTop = 20.5; |
| 59 shouldBe("document.visualViewport.scrollTop", "20.5"); | 59 shouldBe("window.visualViewport.scrollTop", "20.5"); |
| 60 | 60 |
| 61 finishJSTest(); | 61 finishJSTest(); |
| 62 } | 62 } |
| 63 </script> | 63 </script> |
| 64 | 64 |
| 65 <body onload="runTest()"></body> | 65 <body onload="runTest()"></body> |
| OLD | NEW |