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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-webp-alpha.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 <canvas style="display: none"></canvas>
2 <!-- The <img> background color should be visible behind the html5.png test imag e: the
3 image has an alpha channel, which should be preserved by the WEBP toDataURL en coder. -->
4 <img id="result" style="background-color: yellow">
5 <pre id="error"></pre>
6
7 <script>
8 if (window.testRunner) {
9 window.testRunner.dumpAsTextWithPixelResults();
10 window.testRunner.waitUntilDone();
11 }
12
13 var image = new Image();
14
15 image.onload = function() {
16 var canvas = document.querySelector('canvas');
17 canvas.width = this.width * 2;
18 canvas.height = this.height * 2;
19 canvas.getContext('2d').drawImage(this, this.width / 2, this.height / 2);
20
21 var dataURL = canvas.toDataURL('image/webp', 0.8); // good quality
22
23 if (!dataURL.match(/^data:image\/webp[;,]/))
24 error.textContent += "FAIL: the dataURL should have 'image/webp' type.";
25 else
26 result.src = dataURL;
27
28 if (window.testRunner)
29 window.testRunner.notifyDone();
30 };
31
32 image.src = 'resources/html5.png';
33 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698