I've noticed that the image previews in Hovercards ('Popups' extension) do not respect high-density displays and can end up a little blurry because of this.
While patching the extension, someone recommended to me to bracket the detected density to the values we use for default thumb generation on the wiki (the 1, 1.5, and 2x densities we specify in 'srcset' attribute on <img>s), so browsers that are zoomed slightly off from default or devices that are not quite on the most common densities don't force extra thumbnail renders.
Do folks have any preference for whether I should add that as a separate function like $.bracketedDevicePixelRatio() or just directly bracket the output of the $.devicePixelRatio wrapper function?
A quick look at code using $.devicePixelRatio() indicates most uses are multiplying an image size to get a thumbnail, so that might be convenient but I don't want to cause surprises. ;)
Task: https://phabricator.wikimedia.org/T97935 Core patch: https://gerrit.wikimedia.org/r/#/c/208820/ Hovercards patch: https://gerrit.wikimedia.org/r/#/c/208515/
Current version of the patch adds a separate $.bracketedDevicePixelRatio().
-- brion