| Index: third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-webp.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-webp.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-webp.html
|
| index 24f7f92a231cc13eb21dd8fe027ba9ac7bbb61f5..e57c27065f1c4ce06699527382f23e518c36fbf0 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-webp.html
|
| +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-toDataURL-webp.html
|
| @@ -1,29 +1,34 @@
|
| -<canvas id="canvas" width="64px" height="64px" style="display: none"></canvas>
|
| -<pre id="log"></pre>
|
| +<!-- The letters in the right image should be blurry compared to the letters in the left image. -->
|
| +<canvas></canvas>
|
| <img id="result">
|
| +<pre id="error"></pre>
|
| +
|
| <script>
|
| if (window.testRunner) {
|
| window.testRunner.dumpAsTextWithPixelResults();
|
| window.testRunner.waitUntilDone();
|
| }
|
|
|
| -function webpDataURLTest()
|
| -{
|
| - var canvas = document.getElementById('canvas');
|
| - var context = canvas.getContext('2d');
|
| - context.drawImage(window.image, 0, 0, canvas.width, canvas.height);
|
| +var image = new Image();
|
| +
|
| +image.onload = function() {
|
| + var canvas = document.querySelector('canvas');
|
| + canvas.width = this.width;
|
| + canvas.height = this.height;
|
| + canvas.getContext('2d').drawImage(this, 0, 0);
|
| +
|
| + var dataURL = canvas.toDataURL('image/webp', 0.3); // low quality
|
|
|
| - var dataURL = canvas.toDataURL('image/webp', 0.8);
|
| if (!dataURL.match(/^data:image\/webp[;,]/))
|
| - document.getElementById('log').textContent += "FAIL: canvas.toDataURL('image/webp') not supported";
|
| + error.textContent += "FAIL: the dataURL should have 'image/webp' type.";
|
| else
|
| - document.getElementById('result').src = dataURL;
|
| + result.src = dataURL;
|
| +
|
| + document.body.style.zoom = 1.3; // zoom in to see the low quality
|
|
|
| if (window.testRunner)
|
| window.testRunner.notifyDone();
|
| -}
|
| +};
|
|
|
| -var image = new Image();
|
| -image.onload = webpDataURLTest;
|
| -image.src = 'resources/html5.png';
|
| +image.src = "resources/letters.png";
|
| </script>
|
|
|