DescriptionSrcset resource selection use a geometric mean to determine resource.
Currently the srcset resource selection simply picks the first candidate with a density that's equal or larger than DPR.
That results in cases where slight zooming causes a DPR of 1.1 and the download of a 2x resource,
even though the 1x resource would have been enough.
This CL fixes that, by making sure that a higher resolution resource is downloaded only if
the DPR is larger than the geometric mean of that resource's density and the density of the resource that preceded it in the sorted candidate list.
The srcset resource selection is intentionally defined as UA specific in the spec:
https://html.spec.whatwg.org/multipage/embedded-content.html#the-img-element:image-source-2
That is in order to allow browsers to play around with resource selection logic heuristics.
Geometric mean was proposed by Tab Atkins as a "decent first draft":
http://ircbot.responsiveimages.org/bot/log/respimg/2014-04-22#T66515
BUG=425511
Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=184187
Patch Set 1 #Patch Set 2 : Fixed a broken test #Patch Set 3 : Added test cases #
Total comments: 3
Patch Set 4 : Review nits #
Messages
Total messages: 9 (2 generated)
|