Skip to content

Commit

Permalink
Add image-related Client Hints headers removed from the IETF draft
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavweiss committed Mar 8, 2019
1 parent 12e5e98 commit 7bd134e
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -4021,6 +4021,18 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ul>
</dd>

<dt>Structured Headers</dt>

<dd>
<p>The following terms are defined in <cite>Structured Headers</cite>: <ref spec="STRUCTUREDHEADERS"></p>

<ul class="brief">
<li><dfn data-x-href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html#float">sh-float</dfn></li>
<li><dfn data-x-href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html#integer">sh-integer</dfn></li>
</ul>
</dd>


<dt>Feature Policy</dt>

<dd>
Expand Down Expand Up @@ -28595,6 +28607,47 @@ was an English &lt;a href="/wiki/Music_hall">music hall&lt;/a> singer, ...</pre>

</div>

<h5>Image-related Client Hints request headers</h5>
There are several image-related Client Hints which enable proactive content negotiation of the
most adapted image based on the user's device characteristics. If these headers appear in a
request more than once or have multiple values, the server SHOULD only take the last value of the
last request header into account.

<h6>DPR</h6>
The “DPR” request header field is a number that indicates the client’s current Device Pixel
Ratio (DPR). Its value SHOULD be identical to `window.devicePixelRatio`.
<!-- TODO(yoav): Switch to link to the specific algorithm once one is exposed -->
<!-- TODO(yoav): change from SHOULD to "determine the value of DPR" kind of processing model -->

The header's value is a <code>sh-float</code>.

<h6>Viewport-Width</h6>
The “Viewport-Width” request header field is a number that indicates the layout viewport width
in CSS pixels. Its value SHOULD be the <span>viewport</span> width excluding the size of a
rendered scroll bar (if any), rounded to the smallest following integer (i.e. ceiling value).

The header's value is a <code>sh-integer</code>.

<h6>Width</h6>
The “Width” request header field is a number that indicates the desired resource width in CSS
pixels. Its value should be the initiator element's source set's source size, if one exists,
rounded to the smallest following integer (i.e. ceiling value).
<!-- TODO(yoav): once we define a proper algorithm, we need to pass the source-size from the caller into Fetch -->

The header's value is a <code>sh-integer</code>.

<h5>Image-related response headers</h5>
<h6>Content-DPR</h6>
The “Content-DPR” response header field is a number that indicates the received image's
<span>current pixel density</span>.

The header's value is a <code>sh-float</code>.
<!-- TODO(yoav): add a processing model that overrides the current pixel density with that value -->

The <span>current pixel density</span> affects the calculation of density corrected intrinsic
size of image resources. As a result, the server MUST explicitly indicate the DPR of the
selected image response whenever the DPR client hint was used, or when the server otherwise
modified the image dimensions to compensate for the device's screen density.

<h5 id="alt">Requirements for providing text to act as an alternative for images</h5>

Expand Down Expand Up @@ -120676,6 +120729,10 @@ INSERT INTERFACES HERE
<dt id="refsSRI">[SRI]</dt>
<dd><cite><a href="https://w3c.github.io/webappsec-subresource-integrity/">Subresource Integrity</a></cite>, D. Akhawe, F. Braun, F. Marier, J. Weinberger. W3C.</dd>

<dt id="refsSTRUCTUREDHEADERS">[STRUCTUREDHEADERS]</dt>
<dd><cite><a href="https://httpwg.org/http-extensions/draft-ietf-httpbis-header-structure.html">Structured Headers</a></cite>, M. Nottingham, P-H. Kamp.</dd>


<dt id="refsSVG">[SVG]</dt>
<dd><cite><a href="https://svgwg.org/svg2-draft/">Scalable Vector Graphics (SVG) 2</a></cite>, N Andronikos, R. Atanassov, T. Bah, B. Birtles, B. Brinza, C. Concolato, E. Dahlström, C. Lilley, C. McCormack, D. Schepers, R. Schwerdtfeger, D. Storey, S. Takagi, J. Watt. W3C.</dd>

Expand Down

0 comments on commit 7bd134e

Please sign in to comment.