Bug 278675 - REGRESSION(275829@main): [GTK][WPE] Images broken in various PDFs
Summary: REGRESSION(275829@main): [GTK][WPE] Images broken in various PDFs
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: PDF (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Michael Catanzaro
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-26 13:27 PDT by Michael Catanzaro
Modified: 2024-09-11 09:26 PDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2024-08-26 13:27:20 PDT
This is the same as bug #271726, but for GTK/WPE. Unfortunately still we need the JPEG 2000 support for images to work properly in many PDFs. There is a sample PDF attached to bug #271726.
Comment 1 Michael Catanzaro 2024-09-04 11:01:31 PDT
Plan:

 * Revert 273978@main, bring back OpenJPEG for now
 * Future improvement: ideally try to limit JPEG 2000 to PDF documents only rather than allowing it on the entire web
 * Future improvement: try building OpenJPEG for wasm as part of the PDF.js build process, bug #273435, so we can remove system OpenJPEG dependency again
Comment 2 Michael Catanzaro 2024-09-04 14:07:44 PDT
(In reply to Michael Catanzaro from comment #1)
>  * Revert 273978@main, bring back OpenJPEG for now

Bad plan. After attempting this, I spent a while trying to figure out why images in PDF documents were still broken. Turns out, this commit actually didn't break anything.

The only other suspicious commit is 277629@main, but that also didn't break things.

I will need to bisect this.
Comment 3 Michael Catanzaro 2024-09-04 14:29:02 PDT
Wow, we actually have multiple bugs.

Test document one is https://bug-271726-attachments.webkit.org/attachment.cgi?id=470613

Test document two is https://insurance.mo.gov/earthquake/documents/EarthquakeInsuranceMarketsInMissouriReport20197-8-2019_000.pdf

They did not break at the same time. At the first step of my bisect, I can display test document one, but not test document two. :S

So now I'll bisect twice.
Comment 4 Michael Catanzaro 2024-09-05 12:23:54 PDT
(In reply to Michael Catanzaro from comment #3)
> Test document two is
> https://insurance.mo.gov/earthquake/documents/
> EarthquakeInsuranceMarketsInMissouriReport20197-8-2019_000.pdf

Unfortunately this broke in 275829@main "[GTK] Make it possible to build with Skia instead of Cairo".

Let's focus this bug report on this issue. I will create a separate bug report for the problem with test document one.
Comment 5 Michael Catanzaro 2024-09-05 12:47:57 PDT
(In reply to Michael Catanzaro from comment #4) 
> Unfortunately this broke in 275829@main "[GTK] Make it possible to build
> with Skia instead of Cairo".

Building with -DUSE_CAIRO=ON does *not* solve the problem, which I suppose is unsurprising, since that commit does not yet actually switch the default from USE_CAIRO to USE_SKIA. I have no guesses as to what aspect of that change breaks PDF images.
Comment 6 Michael Catanzaro 2024-09-05 12:55:05 PDT
(In reply to Michael Catanzaro from comment #4) 
> Let's focus this bug report on this issue. I will create a separate bug
> report for the problem with test document one.

Test document one displays fine in my development build. It is only broken in Ephy Tech Preview. So I cannot bisect it.
Comment 7 Michael Catanzaro 2024-09-10 08:53:48 PDT
(In reply to Michael Catanzaro from comment #5)
> Building with -DUSE_CAIRO=ON does *not* solve the problem, which I suppose
> is unsurprising, since that commit does not yet actually switch the default
> from USE_CAIRO to USE_SKIA. I have no guesses as to what aspect of that
> change breaks PDF images.

Well today it most certainly does. I made a stupid mistake: the default value of CMake variables doesn't change unless you delete your build directory, and I didn't do that when bisecting.

So that's good news actually. To avoid the regression, we can simply switch back to USE_CAIRO=ON and USE_SKIA=OFF. That would be a quick/easy solution for 2.46.
Comment 8 Carlos Garcia Campos 2024-09-11 00:52:38 PDT
Even better news is that https://github.com/WebKit/WebKit/pull/33122 fixes the issue
Comment 9 Michael Catanzaro 2024-09-11 09:26:43 PDT
Nice, thanks for investigating!