| <!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true internal:AsyncOverflowScrollingEnabled=true internal:AsyncFrameScrollingEnabled=true ] --> |
| <html> |
| <head> |
| <script src="../../../resources/ui-helper.js"></script> |
| <script src="../../../resources/basic-gestures.js"></script> |
| <style> |
| html, body { width: 100%; height: 100%; margin: 0px; padding: 0px; } |
| body { overflow: hidden; } |
| #content { width: 100%; height: 100%; box-sizing: border-box; padding: 20px; background: #ccc; } |
| </style> |
| <script> |
| if (window.testRunner) { |
| testRunner.waitUntilDone(); |
| testRunner.dumpAsText(); |
| } |
| |
| async function runTest() { |
| if (!window.testRunner) |
| return; |
| |
| let result = ''; |
| const log = (text) => result += text + '\n'; |
| |
| const initialScale = await UIHelper.zoomScale(); |
| await UIHelper.zoomToScale(initialScale * 1.5); |
| const finalScale = await UIHelper.zoomScale(); |
| |
| log(visualViewport.pageTop > 100 ? 'PASS - the document did scroll with zooming' : `FAIL - the document did not scroll with zooming: ${visualViewport.pageTop}`); |
| |
| const x = visualViewport.pageLeft; |
| const y = visualViewport.pageTop; |
| |
| await touchAndDragFromPointToPoint(x + 100, y + 100, x + 100, y + 200); |
| await liftUpAtPoint(x + 100, y + 200); |
| await UIHelper.delayFor(200); |
| |
| const expectedY = y - 80 * finalScale; |
| log(visualViewport.pageTop < expectedY ? 'PASS - the document scrolled back to the top' : `FAIL - the document did not scroll back to the top: expected ${visualViewport.pageTop} < ${expectedY}`); |
| |
| document.getElementById('log').textContent = result; |
| |
| testRunner.notifyDone(); |
| } |
| |
| </script> |
| <body onload="runTest()"> |
| <div id="content"> |
| This document shouldn't be scrollable normally but should be scrollable when pinch zoomed.<br> |
| To manually test, pinch zoom on the page. The document should become scrollable. |
| </div> |
| <pre id="log"></pre> |
| </body> |
| </html> |