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

Side by Side Diff: LayoutTests/fast/images/image-click-scale-restore-zoomed-image.html

Issue 262053005: Allow zoom/restore in a zoomed document. It is a regression from an earlier fix. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use enums instead of bool. Add layout test to check this condition. Created 6 years, 7 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
« no previous file with comments | « no previous file | LayoutTests/fast/images/image-click-scale-restore-zoomed-image-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
esprehn 2014/05/29 00:12:02 We usually leave off the <html>, <head> and <body>
3 <script>
4 var clicked = false;
5 var count = 0;
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 click(newwindow, image)
19 {
20 var e = newwindow.document.createEvent("MouseEvent");
21 e.initMouseEvent("click", true, true, newwindow, 1, 1, 1, 1, 1, false, false , false, false, 0, newwindow.document);
22 image.dispatchEvent(e);
23 }
24
25 function zoomPage()
esprehn 2014/05/29 00:12:02 onload = function()
26 {
27 var newwindow = window.open("resources/flowchart.jpg");
28 if (window.testRunner)
29 testRunner.useUnfortunateSynchronousResizeMode();
30 newwindow.onload = function() {
31
32 newwindow.onresize = function() {
33 var image = newwindow.document.querySelector("img");
34 if (image.clientWidth == 0) {
35 // On GTK+, sometimes the resize callback fires before the GTK
eseidel 2014/05/19 19:52:49 This seems like a bug...
tony 2014/05/20 16:33:44 Now that Linux is on views, it probably doesn't ap
36 // window has finished resizing. If that happens, try to resize
37 // again.
38 setTimeout(function() {
39 newwindow.resizeTo(100, 100);
40 }, 0);
esprehn 2014/05/29 00:12:02 We shouldn't add this gtk hack. Maybe you want req
41 return;
42 }
43
44 if (window.eventSender && !clicked) {
45 // Zoom in level 1
46 eventSender.zoomPageIn();
47 var w = Math.round(image.clientWidth);
48 var h = Math.round(image.clientHeight);
49 log("Size at zoomed in level : " + w + " x " + h);
50 clicked = true;
51 count++;
52 click(newwindow, image);
53 } else if (window.eventSender && clicked){
esprehn 2014/05/29 00:12:02 put the eventSender guards right around the eventS
54 var w = Math.round(image.clientWidth);
55 var h = Math.round(image.clientHeight);
56 log("Size at zoomed level after scale up click " + count + " : " + w + " x " + h);
57 if (count == 3) {
58 testRunner.notifyDone();
59 }
60
61 // Restore the image size
62 click(newwindow, image);
63 count++;
64 // Brings to normal zoom
65 eventSender.zoomPageOut();
66 // Zoom out level 1
67 eventSender.zoomPageOut();
68 // Restore the image size
69 var w = Math.round(image.clientWidth);
70 var h = Math.round(image.clientHeight);
71 log("Size at zoomed out level after click " + count + " (Image r estored): " + w + " x " + h);
72 count++;
73 click(newwindow, image);
74
75 }
76 };
77
78 newwindow.resizeTo(100, 100);
79 };
80 }
81 </script>
82 <body onload="zoomPage()">
83 <p>This tests that on a zoomed page, click to scale up / down works fine. This test requires testRunner to run. To test manually, open <a href="resources/dice .png">this image</a> in a browser window, resize the window to 100px tall and zo om out and click on the image to scale it up.</p>
84 <pre id="console"></pre>
85 </body>
86 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/images/image-click-scale-restore-zoomed-image-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698