| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <script> | 3 <script> |
| 4 var count = 0; | 4 var count = 0; |
| 5 | 5 |
| 6 if (window.testRunner) { | 6 if (window.testRunner) { |
| 7 testRunner.dumpAsText(); | 7 testRunner.dumpAsText(); |
| 8 testRunner.setCanOpenWindows(); | 8 testRunner.setCanOpenWindows(); |
| 9 testRunner.waitUntilDone(); | 9 testRunner.waitUntilDone(); |
| 10 } | 10 } |
| 11 | 11 |
| 12 function log(message) | 12 function log(message) |
| 13 { | 13 { |
| 14 var console = document.getElementById("console"); | 14 var console = document.getElementById("console"); |
| 15 console.appendChild(document.createTextNode(message + "\n")); | 15 console.appendChild(document.createTextNode(message + "\n")); |
| 16 } | 16 } |
| 17 | 17 |
| 18 function zoomPage() | 18 function zoomPage() |
| 19 { | 19 { |
| 20 var newwindow = window.open("resources/dice.png"); | 20 var newwindow = window.open("resources/dice.png"); |
| 21 newwindow.onload = function() { | 21 newwindow.onload = function() { |
| 22 newwindow.onresize = function() { | 22 newwindow.onresize = function() { |
| 23 var image = newwindow.document.querySelector("img"); |
| 24 if (image.clientWidth == 0) { |
| 25 // On GTK+, sometimes the resize callback fires before the GTK |
| 26 // window has finished resizing. If that happens, try to resize |
| 27 // again. |
| 28 setTimeout(function() { |
| 29 newwindow.resizeTo(400, 400); |
| 30 }, 0); |
| 31 return; |
| 32 } |
| 23 | 33 |
| 24 » if (window.eventSender) { | 34 if (window.eventSender) { |
| 25 » var image = newwindow.document.querySelector("img"); | 35 eventSender.zoomPageIn(); |
| 26 » eventSender.zoomPageIn(); | 36 log("Size at zoom level" + (count) + " : " + image.clientWidth
+ "x" + image.clientHeight); |
| 27 » log("Size at zoom level" + (count) + " : " + image.clie
ntWidth + "x" + image.clientHeight); | 37 ++count; |
| 28 » ++count; | 38 if (count == 10) |
| 39 testRunner.notifyDone(); |
| 40 } |
| 41 }; |
| 29 | 42 |
| 30 » if (count == 10) | 43 newwindow.resizeTo(400, 400); |
| 31 » » » testRunner.notifyDone(); | 44 }; |
| 32 } | 45 } |
| 33 }; | 46 </script> |
| 34 | |
| 35 newwindow.resizeTo(400, 400); | |
| 36 }; | |
| 37 | |
| 38 } | |
| 39 </script> | |
| 40 <body onload="zoomPage()"> | 47 <body onload="zoomPage()"> |
| 41 <p>This tests that page zoom and image auto-sizing interact well together. This
test requires testRunner to run. To test manually, open <a href="resources/dic
e.png">this image</a> in a browser window, resize the window to 600px tall and z
oom in 10 times. The image should get bigger at each step proportionately.</p> | 48 <p>This tests that page zoom and image auto-sizing interact well together. This
test requires testRunner to run. To test manually, open <a href="resources/dic
e.png">this image</a> in a browser window, resize the window to 600px tall and z
oom in 10 times. The image should get bigger at each step proportionately.</p> |
| 42 <pre id="console"></pre> | 49 <pre id="console"></pre> |
| 43 </body> | 50 </body> |
| 44 </html> | 51 </html> |
| OLD | NEW |