Open Bug 1649467 Opened 4 years ago Updated 1 years ago

devicePixelRatio at 110% is incorrect

Categories

(Core :: Widget: Gtk, defect, P3)

77 Branch
defect

Tracking

()

People

(Reporter: post, Unassigned)

Details

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

Steps to reproduce:

Go to https://mozilla.github.io/pdf.js/web/viewer.html
Zoom to 110% (the browser, not the PDF).

Actual results:

The PDF rendering is not crisp. The console reports window.devicePixelRatio = 1.0909090909090908

Expected results:

window.devicePixelRatio = 1.10

In case this is reproducible, I added a custom zoom level at 125%, maybe this exposed a bug.

Hi,

I was not able to reproduce this issue on Ubuntu 18.
Could you please try on our latest nightly build? You can download it from here: http://nightly.mozilla.org/. Also could you try with a NEW profile and in SAFE MODE (https://support.mozilla.org/en-US/kb/troubleshoot-firefox-issues-using-safe-mode) in case any configuration or addon is affecting.
And for the last could you try on Chrome to see if this behavior is consistent in another browsers.

Thanks.

Flags: needinfo?(hermanbergwerf)

I have the same on nightly and in a new profile. But the same happens in Chrome (except it has 1.100000023841858). The main problem is that I have visibly blurry PDFs when zooming the browser (not the embedded PDF viewer) to 110%, but this may be invisible on high pixel density screens.
I have a t430 running Debian. I just reported it in case someone can easily reproduce it. Otherwise I guess it is an obscure bug (I only noticed it because of the blurry PDFs of which I attached a screenshot), and it should perhaps be closed.

110%: https://postimg.cc/bGrV431L
100%: https://postimg.cc/w1f05LnN

Flags: needinfo?(hermanbergwerf)

EDIT: the previous example of blurriness of a PDF happens only at 110% where the device pixel ratio is also off from the expected value. At 133% for example it is crisp. For some reason Chrome is affected in the same way, so it may be a bug with the PDF viewer https://mozilla.github.io/pdf.js/web/viewer.html (in case it gets a zoom level from somewhere else and incorrectly combines it with the devicepixelratio).

Bugbug thinks this bug should belong to this component, but please revert this change in case of error.

Component: Untriaged → Widget: Gtk
Product: Firefox → Core
Priority: -- → P3

STR work for me. Testing on Windows might isolate it to pdf.js?

Status: UNCONFIRMED → NEW
Ever confirmed: true
Severity: -- → S4

The value 1.0909090909090908 is equal to 12/11 and in pdf.js we approximate it in using Farey sequence with a limit of 8 hence it's approximated as 8/7:
https://github.com/mozilla/pdf.js/blob/839be801a0d943d3426d4115f8f42b93de69e102/web/pdf_page_view.js#L921
If I set the limit to 11 here:
https://github.com/mozilla/pdf.js/blob/839be801a0d943d3426d4115f8f42b93de69e102/web/ui_utils.js#L265
the rendering is better.
Increasing the value will likely lead to increase the memory use.
Anyway there's likely a bug in pdf.js.
I don't know if this 12/11 for 11/10 is expected or not.

As far as I can tell the Firefox builtin pdf viewer is not affected.

You need to log in before you can comment on or make changes to this bug.