Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 932397288bfe883a25b12c440430fd10df2bbf47
      
https://github.com/WebKit/WebKit/commit/932397288bfe883a25b12c440430fd10df2bbf47
  Author: Yury Semikhatsky <[email protected]>
  Date:   2026-06-18 (Thu, 18 Jun 2026)

  Changed paths:
    M LayoutTests/platform/gtk/TestExpectations
    M LayoutTests/platform/win/TestExpectations
    M LayoutTests/platform/wpe/TestExpectations
    M Source/WebCore/platform/MIMETypeRegistry.cpp

  Log Message:
  -----------
  [GTK] canvas.toDataURL() does not support image/webp
https://bugs.webkit.org/show_bug.cgi?id=317254

Reviewed by Carlos Garcia Campos and Devin Rousso.

The set of MIME types canvas.toDataURL() can encode to had a PLATFORM(GTK)
branch (image/png, image/jpeg, image/tiff, image/bmp, image/ico) left over
from the Cairo/gdk-pixbuf era. It precedes the USE(SKIA) branch in the #elif
chain, so the now-Skia-based GTK port took the stale list: it omitted
image/webp, which the Skia encoder supports, and advertised image/tiff,
image/bmp and image/ico, which it cannot encode. Those produced an empty
"data:," URL instead of the spec-mandated image/png fallback.

Remove the dead PLATFORM(GTK) branch so the GTK port uses the USE(SKIA) list
(image/png, image/jpeg, image/webp), matching the WPE port and the formats
ImageUtilitiesSkia actually produces.

Also drop image/jpg from the USE(SKIA) list. image/jpg is not a valid MIME
type, so canvas.toDataURL('image/jpg') must fall back to image/png per the
spec (as the toDataURL.jpg WPT asserts).
Listing it made every Skia port (GTK, WPE, Windows) encode JPEG instead.
Dropping it restores the PNG fallback and makes two tests pass that
previously only passed when the type was unsupported:
fast/canvas/toDataURL-alpha-permutation.html, a reftest that renders
toDataURL('image/jpg') and matches the reference only when it falls back to
PNG (JPEG has no alpha channel), and the toDataURL.jpg WPT.

* LayoutTests/platform/gtk/TestExpectations:
* LayoutTests/platform/win/TestExpectations:
* LayoutTests/platform/wpe/TestExpectations:
* Source/WebCore/platform/MIMETypeRegistry.cpp:
(WebCore::MIMETypeRegistry::createMIMETypeRegistryThreadGlobalData):

This commit include:

Canonical link: https://commits.webkit.org/315446@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to