diff --git a/dom/canvas/CanvasRenderingContextHelper.cpp b/dom/canvas/CanvasRenderingContextHelper.cpp index 7c48103501d2..94c48616ba09 100644 --- a/dom/canvas/CanvasRenderingContextHelper.cpp +++ b/dom/canvas/CanvasRenderingContextHelper.cpp @@ -261,8 +261,9 @@ nsresult CanvasRenderingContextHelper::UpdateContext( nsresult CanvasRenderingContextHelper::ParseParams( JSContext* aCx, const nsAString& aType, const JS::Value& aEncoderOptions, nsAString& outParams, bool* const outUsingCustomParseOptions) { - // Quality parameter is only valid for the image/jpeg MIME type - if (aType.EqualsLiteral("image/jpeg")) { + // Quality parameter is only valid for the image/jpeg and image/webp MIME + // types. + if (aType.EqualsLiteral("image/jpeg") || aType.EqualsLiteral("image/webp")) { if (aEncoderOptions.isNumber()) { double quality = aEncoderOptions.toNumber(); // Quality must be between 0.0 and 1.0, inclusive diff --git a/dom/canvas/test/test_toDataURL_parameters.html b/dom/canvas/test/test_toDataURL_parameters.html index 2cc8b0bb7f2c..b288e4d329ea 100644 --- a/dom/canvas/test/test_toDataURL_parameters.html +++ b/dom/canvas/test/test_toDataURL_parameters.html @@ -4,13 +4,13 @@

-This test covers the JPEG quality parameter. If (when) the HTML5 spec changes the +This test covers the JPEG and webp quality parameter. If (when) the HTML5 spec changes the allowed parameters for ToDataURL, new tests should go here.

FAIL (fallback content)

diff --git a/image/imgIEncoder.idl b/image/imgIEncoder.idl index 11bdf4af6fe4..0e38a08bebbc 100644 --- a/image/imgIEncoder.idl +++ b/image/imgIEncoder.idl @@ -64,6 +64,13 @@ interface imgIEncoder : nsIAsyncInputStream // quality=# -- default: "92" // Quality of compression, 0-100 (worst-best). // Quality >= 90 prevents down-sampling of the color channels. + // + // + // WEBP: + // ----- + // + // quality=# -- default: "92" + // Quality of compression, 0-100 (worst-best). // Possible values for input format (note that not all image formats