Provide $.bracketedDevicePixelRatio convenience function

Authored by brion.


Provide $.bracketedDevicePixelRatio convenience function

Brackets the detected value from $.devicePixelRatio() to
one of the values [1, 1.5, 2] that we use for generating
images in default srcset attribute.

This is convenient for runtime fetching of images that match
our standard rendering sizes on devices/browsers that are
slightly off normal, to avoid creating extra thumbs and slowing
the fetching.

Bug: T97935
Change-Id: Ic9cb16543edee629543fa362f569414567756d79