SVG filters aren't working correctly in the pdf builtin viewer
Categories
(Firefox :: PDF Viewer, defect)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr102 | --- | unaffected |
firefox110 | --- | unaffected |
firefox111 | --- | unaffected |
firefox112 | --- | verified |
firefox113 | --- | verified |
People
(Reporter: calixte, Assigned: calixte)
References
(Regression)
Details
(Keywords: regression)
Attachments
(4 files, 1 obsolete file)
54.88 KB,
application/pdf
|
Details | |
48 bytes,
text/x-phabricator-request
|
diannaS
:
approval-mozilla-beta+
|
Details | Review |
44 bytes,
text/x-github-pull-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
diannaS
:
approval-mozilla-beta+
|
Details | Review |
In nightly, the image on the right isn't rendered correctly because the SVG filters aren't applied.
If you open the pdf in https://mozilla.github.io/pdf.js/web/viewer.html then it works as expected.
The code we've in both viewers is almost exactly the same.
The code to create the svg node and the filter is:
https://github.com/mozilla/pdf.js/blob/a0ef5a4ae1ff7a5ed225d1ecac78695f10b3348b/src/display/display_utils.js#L68-L160
then we return url(#transfer_map_0)
which is used here:
https://github.com/mozilla/pdf.js/blob/a0ef5a4ae1ff7a5ed225d1ecac78695f10b3348b/src/display/canvas.js#L3056-L3058
I added a console.log here:
https://searchfox.org/mozilla-central/rev/cd2121e7d83af1b421c95e8c923db70e692dab5f/toolkit/components/pdfjs/content/build/pdf.js#6787
to check that the filter is ok and it's.
So it looks like the filter is not applied or found.
Assignee | ||
Comment 1•2 years ago
|
||
:lslazman, would you have an idea on what's wrong here ?
Comment 2•2 years ago
|
||
Set release status flags based on info from the regressing bug 1819982
Comment 3•2 years ago
|
||
(In reply to Calixte Denizet (:calixte) from comment #1)
:lslazman, would you have an idea on what's wrong here ?
Offhand, not exactly. Can you please check with Mozregression what change might have caused the issue?
Assignee | ||
Comment 4•2 years ago
|
||
I think I found what the issue is:
- the
Element
returned: https://searchfox.org/mozilla-central/rev/2af0d81d29bcd264083e04a2473d82a91f0f7eb6/layout/svg/SVGFilterInstance.cpp#151 isnull
which means that we don't have a filter hence it isn't applied. - it's null because of: https://searchfox.org/mozilla-central/rev/2af0d81d29bcd264083e04a2473d82a91f0f7eb6/dom/base/IDTracker.cpp#100
the filter URI is something likeresource://pdf.js/web/#transfer_map_0
but the document URI is the original URI (something likefile:///tmp/issue6931_reduced.pdf
).
I'll try to write a patch tomorrow.
Assignee | ||
Comment 5•2 years ago
|
||
PDF.js is now using some SVG filters to implement the transfer maps stuff.
Those filters are used in using an url with an id but because of a mismatch
between the document URI and the URI used to find the id, the SVG element
wasn't found.
Consequently, this patch just add an exception when the id is searched for
a pdf document.
Updated•2 years ago
|
Comment 6•2 years ago
|
||
Updated•2 years ago
|
Comment 7•2 years ago
|
||
Comment 8•2 years ago
|
||
Set release status flags based on info from the regressing bug 1819982
Assignee | ||
Updated•2 years ago
|
Comment 9•2 years ago
|
||
:calixte will the pdf.js version be updated and uplifted to 112?
Comment 10•2 years ago
|
||
Comment 11•2 years ago
|
||
Backed out for causing failures in browser_pdfjs_filters.js.
- Backout link
- Push with failures
- Failure Log
- Failure line: TEST-UNEXPECTED-FAIL | toolkit/components/pdfjs/test/browser_pdfjs_filters.js | Not enough red pixels: only 5521 red pixels! - false == true - {"filename":"chrome://mochitests/content/browser/toolkit/components/pdfjs/test/browser_pdfjs_filters.js","name":"test/<","sourceId":675,"lineNumber":73,"columnNumber":14,"sourceLine":"","asyncCause":null,"asyncCaller":{"filename":"resource://testing-common/BrowserTestUtils.sys.mjs","name":"withNewTab","s
Comment 12•2 years ago
|
||
Assignee | ||
Comment 13•2 years ago
|
||
Assignee | ||
Comment 14•2 years ago
|
||
Comment on attachment 9324363 [details]
Bug 1821408 - Remove <base> tag from the pdf viewer in order to have SVG filters working correctly r=#pdfjs-reviewers
Beta/Release Uplift Approval Request
- User impact if declined: Some pdfs could have some wrong colors because some filters won't be applied and it'll be a regression.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: Yes
- Needs manual test from QE?: Yes
- If yes, steps to reproduce: Open the attachment and observe a red "heart".
It can be tested with the pdf in https://github.com/mozilla/pdf.js/issues/16114 (the spider must be in blue/green shades). - List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): It's a small and self contained change.
- String changes made/needed:
- Is Android affected?: Yes
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Comment 15•2 years ago
|
||
bugherder |
Updated•2 years ago
|
Comment 16•2 years ago
|
||
I have reproduced this issue using Firefox 112.0a1 (2023.03.09) on Windows 10 x64.
I can confirm this issue is fixed, I verified using Firefox 113.0a1 on Windows 10, Ubuntu 22 and on macOS 12, both of pdf links works as expected, in
the attachment the "heart" is red and the spider is blue/green shades.
Updated•2 years ago
|
Comment 17•2 years ago
|
||
Comment on attachment 9322319 [details]
Bug 1821408 - Add a test for testing SVG filters in pdf.js r=#pdfjs-reviewers
Approved for 112.0b7
Updated•2 years ago
|
Comment 18•2 years ago
|
||
bugherder uplift |
https://hg.mozilla.org/releases/mozilla-beta/rev/d5f86dfd8309
https://hg.mozilla.org/releases/mozilla-beta/rev/3b0fd6564203
Updated•2 years ago
|
Comment 19•2 years ago
|
||
I can confirm this issue is fixed, I verified using Firefox 112.0b7 on Windows 10, Ubuntu 22 and on macOS 10.15, both of pdf links works as expected, in
the attachment the "heart" is red and the spider is blue/green shades.
Description
•