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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/images/image-click-scale-restore-zoomed-image.html
diff --git a/LayoutTests/fast/images/image-click-scale-restore-zoomed-image.html b/LayoutTests/fast/images/image-click-scale-restore-zoomed-image.html
new file mode 100644
index 0000000000000000000000000000000000000000..c84384331cfa5920f173d214974614d84d233704
--- /dev/null
+++ b/LayoutTests/fast/images/image-click-scale-restore-zoomed-image.html
@@ -0,0 +1,86 @@
+<!DOCTYPE html>
+<html>
esprehn 2014/05/29 00:12:02 We usually leave off the <html>, <head> and <body>
+<script>
+var clicked = false;
+var count = 0;
+if (window.testRunner) {
+ testRunner.dumpAsText();
+ testRunner.setCanOpenWindows();
+ testRunner.waitUntilDone();
+}
+
+function log(message)
+{
+ var console = document.getElementById("console");
+ console.appendChild(document.createTextNode(message + "\n"));
+}
+
+function click(newwindow, image)
+{
+ var e = newwindow.document.createEvent("MouseEvent");
+ e.initMouseEvent("click", true, true, newwindow, 1, 1, 1, 1, 1, false, false, false, false, 0, newwindow.document);
+ image.dispatchEvent(e);
+}
+
+function zoomPage()
esprehn 2014/05/29 00:12:02 onload = function()
+{
+ var newwindow = window.open("resources/flowchart.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
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
+ // window has finished resizing. If that happens, try to resize
+ // again.
+ setTimeout(function() {
+ newwindow.resizeTo(100, 100);
+ }, 0);
esprehn 2014/05/29 00:12:02 We shouldn't add this gtk hack. Maybe you want req
+ return;
+ }
+
+ if (window.eventSender && !clicked) {
+ // Zoom in level 1
+ eventSender.zoomPageIn();
+ var w = Math.round(image.clientWidth);
+ var h = Math.round(image.clientHeight);
+ log("Size at zoomed in level : " + w + " x " + h);
+ clicked = true;
+ count++;
+ click(newwindow, image);
+ } else if (window.eventSender && clicked){
esprehn 2014/05/29 00:12:02 put the eventSender guards right around the eventS
+ var w = Math.round(image.clientWidth);
+ var h = Math.round(image.clientHeight);
+ log("Size at zoomed level after scale up click " + count + " : " + w + " x " + h);
+ if (count == 3) {
+ testRunner.notifyDone();
+ }
+
+ // Restore the image size
+ click(newwindow, image);
+ count++;
+ // Brings to normal zoom
+ eventSender.zoomPageOut();
+ // Zoom out level 1
+ eventSender.zoomPageOut();
+ // Restore the image size
+ var w = Math.round(image.clientWidth);
+ var h = Math.round(image.clientHeight);
+ log("Size at zoomed out level after click " + count + " (Image restored): " + w + " x " + h);
+ count++;
+ click(newwindow, image);
+
+ }
+ };
+
+ newwindow.resizeTo(100, 100);
+ };
+}
+</script>
+<body onload="zoomPage()">
+<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 zoom out and click on the image to scale it up.</p>
+<pre id="console"></pre>
+</body>
+</html>
« 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