OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <html> | |
3 <script> | |
4 var count = 0; | |
5 | |
6 if (window.testRunner) { | |
7 testRunner.dumpAsText(); | |
8 testRunner.setCanOpenWindows(); | |
9 testRunner.waitUntilDone(); | |
10 } | |
11 | |
12 function log(message) | |
13 { | |
14 var console = document.getElementById("console"); | |
15 console.appendChild(document.createTextNode(message + "\n")); | |
16 } | |
17 | |
18 function zoomPage() | |
19 { | |
20 var newwindow = window.open("resources/dice.png"); | |
21 if (window.testRunner) | |
22 testRunner.useUnfortunateSynchronousResizeMode(); | |
23 newwindow.onload = function() { | |
24 | |
25 newwindow.onresize = function() { | |
26 var image = newwindow.document.querySelector("img"); | |
27 if (image.clientWidth == 0) { | |
28 // On GTK+, sometimes the resize callback fires before the GTK | |
29 // window has finished resizing. If that happens, try to resize | |
30 // again. | |
31 setTimeout(function() { | |
32 newwindow.resizeTo(200, 200); | |
33 }, 0); | |
34 return; | |
35 } | |
36 | |
37 if (window.eventSender) { | |
38 eventSender.zoomPageOut(); | |
39 var w = Math.round(image.clientWidth); | |
40 var h = Math.round(image.clientHeight); | |
41 log("Size at zoom level" + (count) + " : " + w + " x " + h); | |
42 if (++count == 6) { | |
43 newwindow.onresize = undefined; | |
44 testRunner.notifyDone(); | |
45 } | |
46 } | |
47 }; | |
48 | |
49 newwindow.resizeTo(200, 200); | |
50 }; | |
51 } | |
52 </script> | |
53 <body onload="zoomPage()"> | |
54 <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 200px tall and z
oom out 6 times. The image should get smaller at each step.</p> | |
55 <pre id="console"></pre> | |
56 </body> | |
57 </html> | |
OLD | NEW |