| Index: LayoutTests/fast/images/image-distorted-aspect-ratios.html
|
| diff --git a/LayoutTests/fast/images/image-distorted-aspect-ratios.html b/LayoutTests/fast/images/image-distorted-aspect-ratios.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3bc62c0f84ff5a9903be7a52cb7ea6acab6c734a
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/images/image-distorted-aspect-ratios.html
|
| @@ -0,0 +1,67 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<script>
|
| +var newwindow;
|
| +var imageWidthBeforeReload;
|
| +var imageHeightBeforeReload;
|
| +if (window.testRunner) {
|
| + testRunner.dumpAsText();
|
| + testRunner.setCanOpenWindows();
|
| + testRunner.setPopupBlockingEnabled(false);
|
| + testRunner.setCloseRemainingWindowsWhenComplete(true);
|
| + testRunner.waitUntilDone();
|
| +}
|
| +
|
| +function log(message)
|
| +{
|
| + var console = document.getElementById("console");
|
| + console.appendChild(document.createTextNode(message));
|
| +}
|
| +
|
| +function loadImageInNewWindow()
|
| +{
|
| + newwindow = window.open("resources/image-distorted-aspect-ratios.jpg");
|
| + if (window.testRunner) {
|
| + testRunner.useUnfortunateSynchronousResizeMode();
|
| +
|
| + newwindow.onload = function() {
|
| + newwindow.onresize = function() {
|
| + var image = newwindow.document.querySelector("img");
|
| + if (image.clientWidth == 0) {
|
| + // On GTK+, sometimes the resize callback fires before the GTK
|
| + // window has finished resizing. If that happens, try to resize
|
| + // again.
|
| + setTimeout(function() {
|
| + newwindow.resizeTo(360, 360);
|
| + }, 0);
|
| + return;
|
| + } else {
|
| + imageWidthBeforeReload = image.clientWidth;
|
| + imageHeightBeforeReload = image.clientHeight;
|
| + newwindow.location.reload();
|
| + setTimeout(function() {
|
| + var image = newwindow.document.querySelector("img");
|
| + if (image.clientWidth == imageWidthBeforeReload &&
|
| + image.clientHeight == imageHeightBeforeReload &&
|
| + image.clientWidth < image.clientHeight) {
|
| + log("Test passed! The image's aspect ratios is correct.");
|
| + } else {
|
| + log("Test failed! The image size before reload was " +
|
| + imageWidthBeforeReload + "x" + imageHeightBeforeReload +
|
| + ", and the image size after reload is " +
|
| + image.clientWidth + "x" + image.clientHeight +
|
| + ". The image width should be less than height.");
|
| + }
|
| + testRunner.notifyDone();
|
| + }, 1000);
|
| + }
|
| + };
|
| + newwindow.resizeTo(360, 360);
|
| + };
|
| + }
|
| +}
|
| +</script>
|
| +<body onload="loadImageInNewWindow()">
|
| +<pre id="console"></pre>
|
| +</body>
|
| +</html>
|
|
|