Skip to content

Commit

Permalink
Merge pull request #451 from w3c/remove_density
Browse files Browse the repository at this point in the history
Feat(density): remove density member (closes #450)
  • Loading branch information
mounirlamouri committed Apr 14, 2016
2 parents 325ebe3 + 07c87db commit f9d234b
Showing 1 changed file with 20 additions and 80 deletions.
100 changes: 20 additions & 80 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1486,20 +1486,18 @@ <h3>
<li>The developer has included two icons at the same size, but in
two different formats. One is explicitly marked as WebP through the
<code>type</code> member. If the user agent doesn't support WebP,
it falls back to the second icon of the same size (and density).
The media type of this icon can then be either determined via a
HTTP header, or can be sniffed by the user agent once the first few
bytes of the icon are received.
it falls back to the second icon of the same size. The media type
of this icon can then be either determined via a HTTP header, or
can be sniffed by the user agent once the first few bytes of the
icon are received.
</li>
<li>The developer wants to use an SVG icon for devices with at
least 2dppx as the display density and only when the available
dimensions are at least 72px. She has found that the SVG file looks
too blurry at small sizes, even on high-density screens. To deal
with this problem, she's included an SVG icon that is only used
when the dimensions are at least 72px and the pixel density is at
least 2dppx. Otherwise, the user agent uses the ICO file
(hd_hi.ico), which includes a gamut of icons individually tailored
for small display sizes.
<li>The developer wants to use an SVG for greater than or equal to
257x257px. She has found that the SVG file looks too blurry at
small sizes, even on high-density screens. To deal with this
problem, she's included an SVG icon that is only used when the
dimensions are at least 257px. Otherwise, the user agent uses the
ICO file (hd_hi.ico), which includes a gamut of raster icons
individually tailored for small display sizes.
</li>
</ul>
<pre class="">
Expand All @@ -1517,8 +1515,7 @@ <h3>
"sizes": "72x72 96x96 128x128 256x256"
},{
"src": "icon/hd_hi.svg",
"sizes": "72x72",
"density": 2
"sizes": "257x257"
}]
}
</pre>
Expand Down Expand Up @@ -2014,11 +2011,11 @@ <h2>
to use in various contexts depending on the semantics of the member
that is using the object (e.g., an icon that is part of an application
menu, etc.). For an image object, this specification provides
developers with a means of specifying the dimensions, optimal pixel
density, and media type of an image (i.e., a "responsive image"
solution [[respimg-usecases]]). A user agent can use these values to
select an image that is best suited to display on the end-user's device
or most closely matches the end-user's preferences.
developers with a means of specifying the dimensions, and media type of
an image (i.e., a "responsive image" solution [[respimg-usecases]]). A
user agent can use these values to select an image that is best suited
to display on the end-user's device or most closely matches the
end-user's preferences.
</p>
<section>
<h3>
Expand Down Expand Up @@ -2068,54 +2065,6 @@ <h3>
</p>
</div>
</section>
<section>
<h3>
<code>density</code> member
</h3>
<p>
The <dfn><code>density</code> member</dfn> of an <a>image object</a>
is the device pixel density for which this image was designed. The
device pixel density is expressed as the number of dots per 'px' unit
(equivalent to a dppx as defined in [[css3-values]]). The value is a
positive number greater than 0. If the developer omits the value, the
user agent assumes the value <code>1.0</code>.
</p>
<p>
The <dfn>steps for processing a <code>density</code> member of an
image</dfn> are given by the following algorithm. The algorithm takes
an <var>image</var> <a>image object</a> as an argument and returns a
positive number.
</p>
<ol>
<li>If [[\HasOwnProperty]] internal method of <var>image</var>
passing <code>density</code> as the argument returns
<code>false</code>:
<ol>
<li>Return 1.0.
</li>
</ol>
</li>
<li>Let <var>value</var> be the result of calling the
[[\GetOwnProperty]] internal method of <var>image</var> passing "
<code>density</code>" as the argument.
</li>
<li>Let <var>result</var> be the result of <a>parseFloat</a>(
<var>value</var>);
</li>
<li>If <var>result</var> is <code>NaN</code>, +∞, or less than or
equal to +0, then:
<ol>
<li>
<a>Issue a developer warning</a>.
</li>
<li>Return 1.0.
</li>
</ol>
</li>
<li>Return <var>result</var>.
</li>
</ol>
</section>
<section>
<h3>
<code>sizes</code> member
Expand Down Expand Up @@ -2298,9 +2247,9 @@ <h3>
the next item in <var>images</var> (if any are left).
</li>
<li>Otherwise, let <var>image</var> be an object with
properties <code>src</code>, <code>type</code>,
<code>sizes</code>, and <code>density</code>. All properties
initially set to <code>undefined</code>.
properties <code>src</code>, <code>type</code>, and
<code>sizes</code>. All properties initially set to
<code>undefined</code>.
</li>
<li>Set <var>image</var>'s <code>src</code> property to be
<var>src</var>.
Expand All @@ -2321,15 +2270,6 @@ <h3>
<var>image</var>'s <code>sizes</code> property to be
<var>sizes</var>.
</li>
<li>Let <var>density</var> be the result from running the <a>
steps for processing a <code>density</code> member of an
image</a> are given by the passing <var>potential
image</var> .
</li>
<li>If <var>density</var> is not <code>undefined</code>, set
<var>image</var>'s <code>density</code> property to be <var>
value</var>.
</li>
<li>Append <var>image</var> to <var>images</var>.
</li>
</ol>
Expand Down

0 comments on commit f9d234b

Please sign in to comment.