Closed Bug 1778068 Opened 2 years ago Closed 2 years ago

PDF Viewer should not set the background of PDF documents to browser.display.background_color

Categories

(Firefox :: PDF Viewer, defect, P1)

Firefox 102
defect

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox-esr102 --- fixed
firefox102 --- wontfix
firefox103 --- wontfix
firefox104 --- fixed

People

(Reporter: vincent-moz, Assigned: calixte)

References

(Regression)

Details

(Keywords: regression)

Attachments

(3 files, 1 obsolete file)

Attached file test.pdf

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0

Steps to reproduce:

  1. Set browser.display.background_color to #FFFF00
  2. Open a PDF file that has a usual background (i.e. white, as generated by pdflatex, but I don't know the internals; just in case, I have attached a small PDF file to reproduce the issue).

Actual results:

The background of the PDF document is what is specified by browser.display.background_color, e.g. yellow (#FFFF00) with the above test.

Expected results:

The background of the PDF document should be white.

Note: this is a recent regression (appearing with FF 102?).

Component: Untriaged → PDF Viewer

It has been done on purpose: we want to improve pdf readability for people with visual disabilities:
https://github.com/mozilla/pdf.js/pull/14874

Changing the value of browser.display.background_color modifies the value of the css name Canvas which is a system color:
https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#system_colors
used in forced color mode:
https://developer.mozilla.org/en-US/docs/Web/CSS/@media/forced-colors
and usually forced colors mode is chosen for accessibility reasons (for example in setting HCM mode on Windows).

It's possible to reset to the default colors in setting:

  • pdfjs.pageColorsBackground to #FFFFFF;
  • pdfjs.pageColorsForeground to #000000.
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → WONTFIX

This kind of information should have been announced. In particular, I've noticed that this change also makes all colors disappear from PDF files, while colors improve readability and/or convey information.

BTW, I'm also wondering what is the point of changing the rendering of PDF documents for people with visual disabilities, while nothing is "improved" on the HTML side (i.e. the change of text and background colors are still honored in HTML pages, contrary to PDF).

It has been announced in nightly release notes:
https://www.mozilla.org/en-US/firefox/102.0a1/releasenotes/

Colors improve readability for people who are able to see them correctly.
And finally I just switched to Dusk theme through a11y in Windows settings and the colors in Bugzilla are the ones from the Dusk theme, so if you see something wrong on the HTML side with forced colors, please file a bug.

(In reply to Calixte Denizet (:calixte) from comment #3)

It has been announced in nightly release notes:
https://www.mozilla.org/en-US/firefox/102.0a1/releasenotes/

Well, there are just a few unhelpful words: "Improved PDF reading in high contrast mode". I suppose that most users (like me) don't know the concept of "high contrast mode" (I just changed the background color, and that was about 20 years ago).

And finally I just switched to Dusk theme through a11y in Windows settings and the colors in Bugzilla are the ones from the Dusk theme, so if you see something wrong on the HTML side with forced colors, please file a bug.

Bug 1778095

In pdf.js we only rely on Canvas and CanvasText values:
https://drafts.csswg.org/css-color/#css-system-colors

which are set whatever the values of Use system color or Overrides... in colors settings are.
So we should take them into account.

Severity: -- → S3
Status: RESOLVED → REOPENED
Ever confirmed: true
Priority: -- → P3
Resolution: WONTFIX → ---
Assignee: nobody → cdenizet
Status: REOPENED → ASSIGNED
Priority: P3 → P1
Regressed by: 1768821

Set release status flags based on info from the regressing bug 1768821

This way it'll help to know when the user-defined colors have to be used
when rendering a pdf.

Attachment #9284370 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED
Pushed by cdenizet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a194660c7ea6
Add a test to check that the colors used to render a pdf are the correct ones r=pdfjs-reviewers,marco

Backed out for causing mochitest failures in browser_pdfjs_hcm.js

  • Backout link
  • Push with failures
  • Failure Log
  • Failure line: TEST-UNEXPECTED-FAIL | toolkit/components/pdfjs/test/browser_pdfjs_hcm.js | [63,63,63,255] deepEqual [0,0,0,255] - JS frame :: chrome://mochitests/content/browser/toolkit/components/pdfjs/test/browser_pdfjs_hcm.js :: test/< :: line 75
Flags: needinfo?(cdenizet)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---

Set release status flags based on info from the regressing bug 1768821

The failure is very likely due to a difference with the screen resolution between linux and windows machines. So I just increased the zoom level (and set it correctly thanks to a #) to 800 in order to be sure that we have a correct color at the first pixel.
I triggered a try:
https://treeherder.mozilla.org/jobs?repo=try&revision=038b1c268b2d92104b07a1f89eea7b1c7c39aecd&selectedTaskRun=UVDHDRurS1S-G7YGBefNzA.0

Flags: needinfo?(cdenizet)
Pushed by cdenizet@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/36c226955cb0
Add a test to check that the colors used to render a pdf are the correct ones r=pdfjs-reviewers,marco
Status: REOPENED → RESOLVED
Closed: 2 years ago2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 104 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: