LadybirdBrowser / ancient-history

The Ladybird web browser
BSD 2-Clause "Simplified" License
1.62k stars 107 forks source link

WebView: Disable explicit content scaling in macOS #75

Closed kevmeyer closed 1 month ago

kevmeyer commented 1 year ago

Currently, every website is wrongly scaled in macOS using a high dpi screen. Before:

Screenshot 2022-09-23 at 19 50 20

After:

Screenshot 2022-09-23 at 19 52 14
linusg commented 1 year ago

Not sure if this is broken more generally, this fix also improves things on my Linux laptop with a high DPI screen:

image

image

diegoiast commented 1 year ago

@linusg did you set m_inverse_pixel_scaling_ratio = 1 unconditionally on your laptop to get a "working scaling"? If so, this means that this whole concept is broken .

linusg commented 1 year ago

Yes, that's what I did.

AtkinsSJ commented 1 year ago

I can't be certain, but I think I know what the core issue is: 1px in CSS is supposed to scale based on the device pixel size, but we don't support that yet. So, every px becomes one physical pixel. Spec: https://www.w3.org/TR/css-values-4/#reference-pixel

So the proper fix would be to implement that. Sounds like for now a good temporary fix would be to always set it to 1.0f, with a FIXME comment explaining that it should be 1.0 / devicePixelRatio() once LibWeb knows about HiDPI displays.