microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.89k stars 3.67k forks source link

[Feature] [WebKit] support AVIF (in Windows) #22781

Open tats-u opened 1 year ago

tats-u commented 1 year ago

Safari on iOS 16+ supports AVIF but Playwright WebKit browser doesn't. Edge also supports in Canary (possibly Dev) and the other browsers have already done in stable versions.

npx playwright install webkit
npx playwright wk https://tests.caniuse.com/avif

image

fujii commented 1 year ago

WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=261368

donny-dont commented 1 year ago

Would it be possible for the Playwright folks to add in a built version of libavif to their Windows build? We could make it so the build checks to see if the library is present and then build with support for it. I'm happy to go over how one could set this up if its doable @mxschmitt

There's a maintenance burden for us every time we add a new image codec and AVIF file support isn't needed for anything we're shipping with our WebKit builds. For example I would like to remove openjpeg from the WebKitRequirements to have one less library to deal with.

tats-u commented 1 year ago

@donny-dont

AVIF file support isn't needed for anything we're shipping with our WebKit builds

It's now supported by all browsers except for Edge. Lossy WebP has a problem about the color space, so new images that used to be JPEG will be AVIF after Edge adds the support for it until JPEG XL is supported by Chromium & Safari Firefox.

donny-dont commented 1 year ago

Myself and @fujii work on the Windows and PlayStation ports of WebKit. We have internal clients that use a build of the Windows ports but they don't use them as a general browser so AVIF support is not needed for those customers. So at this time we will not be adding libavf and its dependencies to the WebKitForWindows/WebKitRequirements repository.

Again this doesn't mean that the folks building out Playwright couldn't add libavif on top of the requirements we release. And I am pro making it so someone building out the Windows port can easily add libavif support so we will add the plumbing in and the Playwright folks can decide whether they want to build out libavif.

tats-u commented 1 year ago

Is libjxl in the requirement? If so why do you discriminate libavif? They should be both required or both optional.

tats-u commented 1 week ago

PR in WebKit repo: https://github.com/WebKit/WebKit/pull/17640

donny-dont commented 1 week ago

Hi @tats-u this was already fixed in the WebKit repo at https://github.com/WebKit/WebKit/commit/e9271eae9cb9a6fbb46598c171dc1b3d927813e3 and the PR you mentioned is obsoleted by it.

As I've been telling you the maintainers of Playwright can just do a build of libavif through vcpkg and add that to their WebKitLibraries/win folder and everything should work,

tats-u commented 1 week ago

@donny-dont I'd always thought this were blocked by https://github.com/WebKit/WebKit/pull/17640, which were blocked by https://github.com/WebKitForWindows/WebKitRequirements/pull/168. I'm glad to know that it's wrong and the ball is in the court of Playwright now.

https://webkit.org/webkit-on-windows/

Doesn't build-webkitautomatically fetch libavif in Windows (or Linux) via vcpkg by default, right?

tats-u commented 1 week ago

https://github.com/microsoft/playwright/issues/32673

Looks like Linux is opt-in, too.

mxschmitt commented 1 week ago

Update from the Playwright side, we are actively exploring ways to add avif support to the Windows port. We are not blocked by upstream WebKit project - its more that we didn't like the bundle size it was adding size wise.

@tats-u

fujii commented 1 week ago

I think the upstream WebKit should adopt Playwright team's new WebKitRequirment. Do you object, @donny-dont ?

tats-u commented 1 week ago

If we avoid the bundle of libavif, we will have to make WebKit use WindowsAPI (I doubt it can) as the macOS and iOS ports do. We need a list of the names of vcpkg packages recommended by WebKit other than WebKitRequirement. It's a pitfall for browsers' developers that the AVIF support in WebKit in other than macOS is opt-in.