Closed Bug 1335465 Opened 7 years ago Closed 7 years ago

On Linux, devPixelsPerPx defaults to 1 on 141 DPI screens when 1.5 is much more appropriate

Categories

(Core :: Graphics, defect)

51 Branch
x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla54
Tracking Status
firefox54 --- fixed

People

(Reporter: alexhenrie24, Assigned: alexhenrie24)

Details

Attachments

(1 file, 1 obsolete file)

I have a System76 Gazelle laptop with a 141 DPI screen, and I could not figure out why Firefox's user interface was so tiny. Finally I searched the source code and discovered that gfxPlatformGtk::GetDPIScale calculates the scale factor based on a table:

  0 to 143 DPI: 1.0
144 to 167 DPI: 1.5
168 to 240 DPI: 2.0
241 to 336 DPI: 3.0

The problem is that DPIs between 121 and 143 are actually closer to 1.5 * 96 than they are to 1.0 * 96. The attached patch moves DPIs in this range to the 1.5 category, which makes Firefox look much better.
Attached patch Proposed patch (obsolete) — Splinter Review
Assignee: nobody → alexhenrie24
Attachment #8832102 - Flags: review?(karlt)
Comment on attachment 8832102 [details] [diff] [review]
Proposed patch

There are pros and cons in this and many people will have opinions about which is the better value to use.

However, the value of 144 was intentional because IMO the cons of a non-unit scale factor outweigh the benefits of larger size when dpi is near 120.

Perhaps we can reconsider an additional return value of 1.25 when more of the dependencies of bug 820679 and bug 1119846 are resolved.

In the meantime, we can try a cutoff at 132.  (That would be linearly half way between 1.25 and 1.5.)  If you'd like to submit a patch for that, I'd be happy to review.
Attachment #8832102 - Flags: review?(karlt) → review-
I will happily take a cutoff of 132.
Attachment #8832102 - Attachment is obsolete: true
Attachment #8832751 - Flags: review?(karlt)
Comment on attachment 8832751 [details] [diff] [review]
Proposed patch v2

Thanks!
Attachment #8832751 - Flags: review?(karlt) → review+
Requesting checkin of attachment 8832751 [details] [diff] [review]
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/829669851e91
Default devPixelsPerPx to 1.5 for DPIs between 133 and 167 on GTK. r=karl
Keywords: checkin-needed
It's too late to change it now, but if anyone cares, the commit message should have said "from 132 to 167", not "between 133 and 167". My bad.
https://hg.mozilla.org/mozilla-central/rev/829669851e91
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
FWIW I recently switched to a new machine, a Dell Precision 5520 running Linux by default with a High DPI screen which I was running with a scaling factor of 1.2 (DPI 115) because almost everything looked very nice except Firefox looked aweful.  After digging though the source code I finally found this bug where the threshold was switched to 132.  If I set my scaling factor to 132, now web pages in Firefox are barely readbable and everything else in the system looks nice still.

Chrome on this system uses a scaling factor of 2 as far as I can tell and things look nice in web pages there (although their UI is awfully small.)  I think this is the code they use <https://cs.chromium.org/chromium/src/chrome/browser/ui/libgtkui/gtk_ui.cc?l=337&rcl=727830d6051803fe78533922089672dfb652b3ac> and it doesn't look like they are choosing scaling factors based on the steppings like we do.

Anyways, not sure if this comment is useful, but for now I resorted to setting layout.css.devPixelsPerPx to 2 in my main browsing profile and squinting every time I have to run a debug build.  :-/
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: