PHANTOM
🇮🇳 IN
Skip to content

update Width to report in physical pixels#61

Merged
igrigorik merged 2 commits intomasterfrom
width-physical
Sep 16, 2015
Merged

update Width to report in physical pixels#61
igrigorik merged 2 commits intomasterfrom
width-physical

Conversation

@igrigorik
Copy link
Owner

We originally defined Width to report in CSS px because the same header was responsible for reporting both the "intended image display width", or the "layout viewport size" for resources that don't have a "display width". However, we've since split these use cases (see #48) into separate headers: Viewport-Width and Width.

This update changes the definition of Width to report image display width (when it's known) in physical pixels, instead of CSS pixels. This offers a couple of important benefits:

<img srcset="wolf-480.jpg 480w, ..., wolf-1920.jpg 1920w" sizes="...">
  1. The communicated value is aligned with w descriptor used for viewport-based selection.
  2. The communicated value significantly improves interaction with HTTP caches:
    • With current definition the cache has to vary the response based on DPR and Width (i.e. Vary: DPR, Width) which leads to unnecessary fragmentation (see viewport-based selection use case and caching #59).
    • With updated definition the cache would have to vary on Width only.

Closes #59.

@yoavweiss
Copy link
Contributor

LGTM for these changes, but we'd need to also change the browser implementation considerations document.

@igrigorik
Copy link
Owner Author

Updated UA considerations doc.

@yoavweiss
Copy link
Contributor

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants