bdakin@apple.com | ef50492 | 2012-03-22 01:36:29 +0000 | [diff] [blame] | 1 | <html> |
| 2 | <head> |
| 3 | <script> |
| 4 | function runTest() { |
rniwa@webkit.org | 06ad32a | 2012-06-22 08:52:23 +0000 | [diff] [blame] | 5 | if (!window.testRunner || !window.sessionStorage) |
bdakin@apple.com | ef50492 | 2012-03-22 01:36:29 +0000 | [diff] [blame] | 6 | return; |
| 7 | |
| 8 | if (!sessionStorage.scaleFactorIsSet) { |
rniwa@webkit.org | 06ad32a | 2012-06-22 08:52:23 +0000 | [diff] [blame] | 9 | testRunner.waitUntilDone(); |
| 10 | testRunner.setBackingScaleFactor(2, scaleFactorIsSet); |
bdakin@apple.com | ef50492 | 2012-03-22 01:36:29 +0000 | [diff] [blame] | 11 | } |
| 12 | |
| 13 | if (sessionStorage.pageReloaded && sessionStorage.scaleFactorIsSet) { |
| 14 | delete sessionStorage.pageReloaded; |
| 15 | delete sessionStorage.scaleFactorIsSet; |
rniwa@webkit.org | 06ad32a | 2012-06-22 08:52:23 +0000 | [diff] [blame] | 16 | testRunner.notifyDone(); |
bdakin@apple.com | ef50492 | 2012-03-22 01:36:29 +0000 | [diff] [blame] | 17 | } else { |
| 18 | // Right now there is a bug that image-set does not properly deal with dynamic changes to the scale factor, |
| 19 | // so to work around that, we must reload the page to get the 2x image. |
| 20 | sessionStorage.pageReloaded = true; |
| 21 | document.location.reload(true); |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | function scaleFactorIsSet() { |
| 26 | sessionStorage.scaleFactorIsSet = true; |
| 27 | } |
| 28 | |
| 29 | window.onload = runTest; |
| 30 | </script> |
| 31 | |
| 32 | <style> |
| 33 | #foo { |
| 34 | width:100px; |
| 35 | height:100px; |
| 36 | border-width: 10px; |
bdakin@apple.com | ef50492 | 2012-03-22 01:36:29 +0000 | [diff] [blame] | 37 | -webkit-border-image: -webkit-image-set(url('resources/blue-100-px-square.png') 1x, url('resources/green-200-px-square.png') 2x) 10 10 10 10 stretch stretch; |
| 38 | } |
| 39 | </style> |
| 40 | </head> |
| 41 | |
| 42 | <body id="body"> |
| 43 | <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> |
| 44 | <div id=foo></div> |
| 45 | </body> |
| 46 | </html> |