| <!DOCTYPE html> <!-- webkit-test-runner [ shouldIgnoreMetaViewport=true ] --> |
| <html> |
| <head> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <style> |
| body, html { |
| margin: 0; |
| width: 100%; |
| height: 100%; |
| } |
| |
| .bar { |
| width: 960px; |
| height: 100px; |
| background: linear-gradient(to right, red 0%, green 50%, blue 100%); |
| } |
| |
| #description { |
| width: 300px; |
| overflow: scroll; |
| } |
| </style> |
| <script src="../../../resources/ui-helper.js"></script> |
| <script src="../../../resources/js-test.js"></script> |
| <script> |
| jsTestIsAsync = true; |
| |
| description("This test verifies that the shrink-to-fit-content heuristic prevents horizontal scrolling by shrinking the page, even when a page specifies a responsive viewport. To run the test manually, load the page and check that the bar entirely fits within the viewport, and the page is not horizontally scrollable."); |
| |
| addEventListener("load", async () => { |
| if (!window.testRunner) |
| return; |
| |
| await UIHelper.ensurePresentationUpdate(); |
| minScale = (await UIHelper.minimumZoomScale()).toFixed(2); |
| expectedScale = (screen.width / 960).toFixed(2); |
| shouldBe("minScale", "expectedScale"); |
| shouldBecomeEqual("innerWidth", "960", finishJSTest); |
| }); |
| </script> |
| </head> |
| <body> |
| <div id="description"></div> |
| <div class="bar"></div> |
| </body> |
| </html> |