Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: LayoutTests/fast/images/image-distorted-aspect-ratios.html

Issue 136823005: Fix distorted image issue when open some images in a new browser window. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: create renderer to get correct size Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
esprehn 2014/02/19 02:13:02 We often leave off the <html>, <body> and <head> e
3 <script>
4 var newwindow;
5 var imageWidthBeforeReload;
6 var imageHeightBeforeReload;
7 if (window.testRunner) {
8 testRunner.dumpAsText();
9 testRunner.setCanOpenWindows();
10 testRunner.setPopupBlockingEnabled(false);
11 testRunner.setCloseRemainingWindowsWhenComplete(true);
12 testRunner.waitUntilDone();
13 }
14
15 function log(message)
16 {
17 var console = document.getElementById("console");
18 console.appendChild(document.createTextNode(message));
19 }
20
21 function loadImageInNewWindow()
esprehn 2014/02/19 02:13:02 onload = function() {
22 {
23 newwindow = window.open("resources/image-distorted-aspect-ratios.jpg");
24 if (window.testRunner) {
25 testRunner.useUnfortunateSynchronousResizeMode();
26
27 newwindow.onload = function() {
28 newwindow.onresize = function() {
29 var image = newwindow.document.querySelector("img");
30 if (image.clientWidth == 0) {
31 // On GTK+, sometimes the resize callback fires before the GTK
32 // window has finished resizing. If that happens, try to resize
33 // again.
34 setTimeout(function() {
35 newwindow.resizeTo(360, 360);
36 }, 0);
37 return;
38 } else {
39 imageWidthBeforeReload = image.clientWidth;
40 imageHeightBeforeReload = image.clientHeight;
41 newwindow.location.reload();
42 setTimeout(function() {
43 var image = newwindow.document.querySelector("img");
44 if (image.clientWidth == imageWidthBeforeReload &&
45 image.clientHeight == imageHeightBeforeReload &&
46 image.clientWidth < image.clientHeight) {
47 log("Test passed! The image's aspect ratios is correct.");
48 } else {
49 log("Test failed! The image size before reload was " +
50 imageWidthBeforeReload + "x" + imageHeightBeforeReload +
51 ", and the image size after reload is " +
52 image.clientWidth + "x" + image.clientHeight +
53 ". The image width should be less than height.");
esprehn 2014/02/19 02:13:02 This test could probably be better written with js
54 }
55 testRunner.notifyDone();
56 }, 1000);
57 }
58 };
59 newwindow.resizeTo(360, 360);
60 };
61 }
62 }
63 </script>
64 <body onload="loadImageInNewWindow()">
65 <pre id="console"></pre>
66 </body>
67 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/images/image-distorted-aspect-ratios-expected.txt » ('j') | Source/core/html/ImageDocument.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698