Page MenuHomePhabricator

Change $wgLogoHD usage to show 1.5x instead of 1x on 1.25x screens (120 DPI)
Closed, InvalidPublic


Thanks to Isarra's patch on T37337 ( we now can set HD site logos. The configuration, entirely reasonably, only supports 1.5x and 2x pixel densities. However, when using a 1.25x screen (or zooming in on normal screen), the 1x logo is displayed; I think it would be better to display the 1.5x one, scaled down.

Some mid-end Windows 7 and Windows 8 laptops use 125% DPI by default. I think it's worthwhile to support them in this regard. (Alas, I couldn't find any hard data on what kind of screens this affects and how many there are, although there's plenty people reporting this over the internet; I can provide a data point of my 15" laptop with 1680px horizontal resolution being this way.)

The current code uses 1.5x image for DPIs >=1.5x, and 2x image for DPIs >=2x; can we instead do it for >1x and >1.5x, respectively?

Event Timeline

matmarex raised the priority of this task from to Medium.
matmarex updated the task description. (Show Details)
matmarex added a project: MediaWiki-General.
matmarex added subscribers: Isarra, brooke, Legoktm, Krinkle.

We should double-check the behavior of native 'srcset' at that zoom level; if browsers use the 1x image at 1.25x zoom with srcset then it'd be a bit difficult to override that short of adding a 1.25x entry and sized thumbnail.

If it's just our JS shim for srcset processing (or our JS shim for window.devicePixelRatio on Internet Explorer) then that's probably fixable.

Ok did a quick comparison of srcset behavior - sample page

density	Chrome	Firefox dev	Spartan
1	1.0 set	1.0 set	1.0 set
1.25	1.0 set	1.5 set	1.5 set
1.5	1.5 set	1.5 set	1.5 set
1.75	cannot set 175% in windows 10?		
2	2.0 set	2.0 set	2.0 set

Chrome uses the 1.0 density at 125% scaling, but Firefox developer edition and the Spartan/Edge new Windows browser use the 1.5 image.

Can't test 175% as Windows doesn't seem to take it and forces it up to 200%.

In Chrome 47.0.2501.0 canary viewing with Dev Tools' device mode, I get set1.png up until DPR 1.22.
DPR 1.23 and higher result in set15.png being fetched instead, up until DPR 1.73.
DPR 1.75 and higher result in set2.png being fetched.

Note: When using Device Emulation in Chrome, you may find both the 1x or 1.5x being downloaded for the emulated device, and the 2x always as well (if you're on a 2x Mac). This is upstream, which got fixed in Chrome canary 47.

Krinkle renamed this task from High-resolution site logos ($wgLogoHD) are blurry on 120 DPI screens (1.25x) to Change $wgLogoHD usage to show 1.5x instead of 1x on 1.25x screens (120 DPI).Nov 27 2017, 10:44 PM
Krinkle reopened this task as Open.
Krinkle edited projects, added MediaWiki-User-Interface; removed MediaWiki-General.

Some browsers round, some browsers ceil. One browser (Chrome) used to floor, but now rounds. So in all cases we should be displaying 1.5x on 1.25x (120 DPI) screens.

@matmarex Is that enough to close this task?

Hmm, that should be fine I guess.