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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-webp-maximum-quality.html

Issue 1937433002: HTML <canvas>: add WEBP lossless encoding support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Patch for landing. Created 4 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
OLDNEW
(Empty)
1 <!-- The letters in the right image should be crisp like the letters in the left image. -->
2 <canvas></canvas>
3 <img id="result">
4 <pre id="error"></pre>
5
6 <script>
7 if (window.testRunner) {
8 window.testRunner.dumpAsTextWithPixelResults();
9 window.testRunner.waitUntilDone();
10 }
11
12 var image = new Image();
13
14 image.onload = function() {
15 var canvas = document.querySelector('canvas');
16 canvas.width = this.width;
17 canvas.height = this.height;
18 canvas.getContext('2d').drawImage(this, 0, 0);
19
20 var dataURL = canvas.toDataURL('image/webp', 1.0); // maximum quality
21
22 if (!dataURL.match(/^data:image\/webp[;,]/))
23 error.textContent += "FAIL: the dataURL should have 'image/webp' type.";
24 else
25 result.src = dataURL;
26
27 if (window.testRunner)
28 window.testRunner.notifyDone();
29 };
30
31 image.src = "resources/letters.png";
32 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698