[webkit-dev] Content-DPR: Image resolution optimization at CDN/transport layer

Noam Rosenthal noam at webkit.org
Mon Nov 11 04:37:11 PST 2019

On Mon, Nov 11, 2019 at 12:13 AM Maciej Stachowiak <mjs at apple.com> wrote:

> - Is there a specification for Content-DPR? All I could find in bugzila
> and elsewhere is links to <
> https://httpwg.org/http-extensions/client-hints.html>, which does not
> mention Content-DPR at all).
In a nutshell, the spec is in transition from IETF to HTML/fetch, and the
client-hints aspects of it are still in progress (unlike conent-dpr, which
is much simpler hasn't changed since introduced). It's documented here:
I will answer more about this separately if required, waiting for some info
from the people working on the spec originally.

> - Can you give us some examples of how the CDN would make the decision of
> what density of image to serve without knowing the client’s DPR via
>  client-hints?
 Some examples from  https://github.com/eeeps/content-dpr-explainer:
- making decisions by user agent, like choosing to cap certain images for
user-agents known to have smaller displays
- making decisions by traffic/geo, like serving lower-resolution images
when traffic is bogged down
- A client may ask for "placeholder image" (e.g. ?placeholder=true in the
URL), and the CDN would decide whether to serve a lower-quality JPEG or to
scale it down, or do both.

- Is this presuming situations where the CDN serves the images but not the
> markup or CSS (which presumably could be rewritten to account for DPR)?

> - What happens if Content-DPR is provided, but the markup or CSS has
> conflicting explicit info? For example, <img srcset=“image-2x.jpg 2x,
> image.jpg 1x”>, and image-2x.jpg is served with a Content-DPR header of 3x.
> Or the analogous thing with CSS.
When image size is decided, css/markup takes precedence, then content DPR,
and finally srcset-selection DPR. This is actually a bonus value of this
feature - if the server happens to serve an image that differs from the
ratio requested in the srcset tag, the intrinsic size match the served
content and not the request (which is more of a recommendation).

- Does Content-DPR have any effect on images where an explicit size is
> provided, either in markup or in CSS? (I’m assuming no.)
No, it only has effect on intrinsic size.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20191111/e0a36f8e/attachment.htm>

More information about the webkit-dev mailing list