| if (!window.testRunner || !window.sessionStorage) |
| if (!sessionStorage.scaleFactorIsSet) { |
| testRunner.waitUntilDone(); |
| testRunner.setBackingScaleFactor(2, scaleFactorIsSet); |
| if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { |
| delete sessionStorage.pageReloaded; |
| delete sessionStorage.scaleFactorIsSet; |
| // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor, |
| // so to work around that, we must reload the page to get the 2x image. |
| // https://bugs.webkit.org/show_bug.cgi?id=119764 |
| sessionStorage.pageReloaded = true; |
| document.location.reload(true); |
| function scaleFactorIsSet() { |
| sessionStorage.scaleFactorIsSet = true; |
| background-image: image-set("resources/blue-100-px-square.png" 1x, "resources/green-200-px-square.png" 2x); |
| <div>This test passes if the div below is a blue 100px square when the deviceScaleFactor is 1, and if it is a 100px green square when the deviceScaleFactor is 2.</div> |