Skip to content
Permalink
Browse files

[gow] (2) Put pixelratio='' to rest.

git-svn-id: http://svn.whatwg.org/webapps@2493 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
Hixie committed Dec 1, 2008
1 parent b558d74 commit 00574e7a0651b713bc3717df809b28c4f8a9ebb6
Showing with 50 additions and 242 deletions.
  1. +23 −110 index
  2. +27 −132 source
133 index
element represent a link to an external video playback utility or to
the video data itself.</p>

<hr><p>The intrinsic width and height of the video are the aspect-ratio
corrected dimensions given by the video data itself: the <dfn id=concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</dfn> is the
number of pixels per line of the video data multiplied by the pixel
ratio given by the resource, multiplied by the resolution of the
resource; the <dfn id=concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic
height</dfn> is the number of pixels per column of the video data
multiplied by the resolution of the resource. The <dfn id=concept-video-resolution title=concept-video-resolution>resolution of the resource</dfn> is
the physical distance intended for each pixel of video data, and
assumes square pixels, with the resource's pixel ratio then
adjusting the width of the pixels to the actual
aspect-ratio-corrected width. In the absence of resolution
information defining the mapping of pixels in the video to physical
dimensions, user agents should assume that one pixel in the video
corresponds to one CSS pixel. The <dfn id=concept-video-pixel-ratio title=concept-video-pixel-ratio>pixel ratio of the resource</dfn>
is the corrected aspect ratio of the video divided by the ratio of
the number of pixels per line to the number of pixels per column. In
the absence of pixel ratio information in the resource, user agents
should assume a default of 1.0 (square pixels).</p>
<hr><p>The <dfn id=concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic
width</dfn> and <dfn id=concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</dfn> of the
<a href=#media-resource>media resource</a> are the dimensions of the resource in
CSS pixels after taking into account the resource's dimensions,
aspect ratio, clean aperture, resolution, and so forth, as defined
for the format used by the resource..</p>

<p>The <dfn id=dom-video-videowidth title=dom-video-videoWidth><code>videoWidth</code></dfn> DOM
attribute must return the <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a> of the
the video in CSS pixels. If no video data is available, then the
attributes must return 0.</p>

<p>If the video's <a href=#pixel-ratio-override>pixel ratio override</a>'s is
<i>none</i>, then the video's <dfn id=concept-video-adjusted-width title=concept-video-adjusted-width>adjusted width</dfn> is the
same as the video's <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a>. If the
video has a <a href=#pixel-ratio-override>pixel ratio override</a> other than
<i>none</i>, then the adjusted width of the video is the number of
pixels per line of the video data multiplied by the video's
<a href=#pixel-ratio-override>pixel ratio override</a>, multiplied by the <a href=#concept-video-resolution title=concept-video-resolution>resolution of the resource</a>;
the <a href=#concept-video-pixel-ratio title=concept-video-pixel-ratio>pixel ratio of the
resource</a> is thus ignored.</p>

<p>The video's <dfn id=concept-video-adjusted-height title=concept-video-adjusted-height>adjusted
height</dfn> is the same as the video's <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic height</a>.</p>

<p>The <dfn id=concept-video-adjusted-ratio title=concept-video-adjusted-ratio>adjusted aspect
ratio</dfn> of a video is the ratio of its <a href=#concept-video-adjusted-width title=concept-video-adjusted-width>adjusted width</a> to its
<a href=#concept-video-adjusted-height title=concept-video-adjusted-height>adjusted
height</a>.</p>

<p>User agents may adjust the <a href=#concept-video-adjusted-width title=concept-video-adjusted-width>adjusted width</a> and <a href=#concept-video-adjusted-height title=concept-video-adjusted-height>height</a> of the video to
ensure that each pixel of video data corresponds to at least one
device pixel, so long as this doesn't affect the <a href=#concept-video-adjusted-ratio title=concept-video-adjusted-ratio>adjusted aspect ratio</a>
(this is especially relevant for pixel ratios that are less than
1.0).</p>

<p>The <code><a href=#video>video</a></code> element supports <a href=#dimension-attributes>dimension
attributes</a>.</p>

<p>Video content should be rendered inside the element's playback
area such that the video content is shown centered in the playback
area at the largest possible size that fits completely within it,
with the video content's <a href=#concept-video-adjusted-ratio title=concept-video-adjusted-ratio>adjusted aspect ratio</a>
being preserved. Thus, if the aspect ratio of the playback area does
not match the <a href=#concept-video-adjusted-ratio title=concept-video-adjusted-ratio>adjusted
aspect ratio</a> of the video, the video will be shown
letterboxed. Areas of the element's playback area that do not
contain the video represent nothing.</p>
with the video content's aspect ratio being preserved. Thus, if the
aspect ratio of the playback area does not match the aspect ratio of
the video, the video will be shown letterboxed or pillarboxed. Areas
of the element's playback area that do not contain the video
represent nothing.</p>

<p>The intrinsic width of a <code><a href=#video>video</a></code> element's playback
area is the <a href=#concept-video-adjusted-width title=concept-video-adjusted-width>adjusted
area is the <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic
width</a> of the video resource, if that is available; otherwise
it is the intrinsic width of the <a href=#poster-frame>poster frame</a>, if that
is available; otherwise it is 300 CSS pixels.</p>

<p>The intrinsic height of a <code><a href=#video>video</a></code> element's playback
area is the <a href=#concept-video-adjusted-height title=concept-video-adjusted-height>intrinsic
area is the <a href=#concept-video-intrinsic-height title=concept-video-intrinsic-height>intrinsic
height</a> of the video resource, if that is available; otherwise
it is the intrinsic height of the <a href=#poster-frame>poster frame</a>, if that
is available; otherwise it is 150 CSS pixels.</p>

<p class=note>The <a href=#poster-frame>poster frame</a> is not affected by the
pixel ratio conversions.</p>

<hr><!-- XXX
default activation behavior is to do the play() if paused, pause()
otherwise
<dd><code title=attr-source-src><a href=#attr-source-src>src</a></code></dd>
<dd><code title=attr-source-type><a href=#attr-source-type>type</a></code></dd>
<dd><code title=attr-source-media><a href=#attr-source-media>media</a></code></dd>
<dd><code title=attr-source-pixelratio><a href=#attr-source-pixelratio>pixelratio</a></code></dd>
<dt>DOM interface:</dt>
<dd>
<pre class=idl>interface <dfn id=htmlsourceelement>HTMLSourceElement</dfn> : <a href=#htmlelement>HTMLElement</a> {
attribute DOMString <a href=#dom-source-src title=dom-source-src>src</a>;
attribute DOMString <a href=#dom-source-type title=dom-source-type>type</a>;
attribute DOMString <a href=#dom-source-media title=dom-source-media>media</a>;
attribute float <a href=#dom-source-pixelratio title=dom-source-pixelRatio>pixelRatio</a>;
};</pre>
</dd>
</dl><p>The <code><a href=#the-source-element>source</a></code> element allows authors to specify
<a href=#media-resource>media resource</a> is useful to the user before fetching
it. Its value must be a valid <a href=#mq>media query</a>. <a href=#refsMQ>[MQ]</a></p>

<p>The <dfn id=attr-source-pixelratio title=attr-source-pixelratio><code>pixelratio</code></dfn>
attribute allows the author to specify the pixel ratio of anamorphic
<a href=#media-resource title="media resource">media resources</a> that do not
self-describe their <a href=#concept-video-adjusted-ratio title=concept-video-adjusted-ratio>pixel
ratio</a>. The attribute value, if specified, must be a
<a href=#valid-floating-point-number>valid floating point number</a> greater than zero giving
the ratio of the correct rendered width of each pixel to the actual
height of each pixel in the image. The default value, if the
attribute is omitted or cannot be parsed, is 1.0.</p>

<p class=note>The only way this default is used is in deciding
what number the <code title=dom-source-pixelRatio><a href=#dom-source-pixelratio>pixelRatio</a></code> DOM attribute will
return if the content attribute is omitted or cannot be parsed. If
the content attribute is omitted or cannot be parsed, then the user
agent doesn't adjust the <a href=#concept-video-intrinsic-width title=concept-video-intrinsic-width>intrinsic width</a> of the
video at all; the intrinsic dimensions and the <a href=#concept-video-pixel-ratio title=concept-video-pixel-ratio>pixel ratio</a> of the video
are honoured.</p>

<p>If a <code><a href=#the-source-element>source</a></code> element is inserted into a <a href=#media-element>media
element</a> that is already in a document and whose <code title=dom-media-networkState><a href=#dom-media-networkstate>networkState</a></code> is in the <code title=dom-media-NETWORK_EMPTY><a href=#dom-media-network_empty>NETWORK_EMPTY</a></code> state, the user
agent must <a href=#queue-a-task>queue a task</a> that implicitly invokes the
<a href=#reflect>reflect</a> the respective content attributes of the same
name.</p>

<p>The DOM attribute <dfn id=dom-source-pixelratio title=dom-source-pixelRatio><code>pixelRatio</code></dfn> must
<a href=#reflect>reflect</a> the <code title=attr-source-pixelratio><a href=#attr-source-pixelratio>pixelratio</a></code> content
attribute.</p>



<h4 id=media-elements><span class=secno>4.8.10 </span>Media elements</h4>
algorithm for the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method
defined below.</p>

<p>The <dfn id=pixel-ratio-override>pixel ratio override</dfn> of a <a href=#media-element>media
element</a> is initially <i>none</i>. Its value is changed by the
algorithm for the <code title=dom-media-load><a href=#dom-media-load>load()</a></code> method
defined below.</p>

<p>To <dfn id=generate-the-list-of-potential-media-resources>generate the list of potential media resources</dfn> for
a <a href=#media-element>media element</a>, a user agent must use the following
steps. These steps return a list of items, each consisting of an
<a href=#absolute-url>absolute URL</a> giving a resource's address, and the
resource's pixel ratio override (either a number or
<i>none</i>).</p>
steps. These steps return a list of <a href=#absolute-url title="absolute
URL">absolute URLs</a> giving a resource's address.</p>

<ol><li>

<a href=#url>URL</a> given in that attribute.</p>

<li><p>If that is successful, then return a list consisting of
only one entry, with the resulting <a href=#absolute-url>absolute URL</a> as
the resource's address, and with the resource's pixel ratio
override being <i>none</i>.</li>
only one entry, the resulting <a href=#absolute-url>absolute URL</a> as the
resource's address.</li>

<li><p>Otherwise, return the empty list.</li>

<li><p><i>Loop</i>: this is the start of the loop that looks at the
<code><a href=#the-source-element>source</a></code> elements.</li>

<li><p>If <var title="">candidate</var> has a <code title=attr-source-pixelratio><a href=#attr-source-pixelratio>pixelratio</a></code> attribute, and the
result of applying the <a href=#rules-for-parsing-floating-point-number-values>rules for parsing floating point
number values</a> to the value of that attribute is a number
greater than zero, then let the <var title="">candidate pixel ratio
override</var> be that result. Otherwise, let it be
<i>none</i>.</li>

<li>

<p>If all the following conditions are true:</p>
processed according to the rules for <a href=#mq>media
queries</a>, matches the current environment. <a href=#refsMQ>[MQ]</a></li>

</ul><p>...then append an item to the <var title="">result</var> list
consisting of the <a href=#absolute-url>absolute URL</a> resulting from <a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>URL</a> given
in that <var title="">candidate</var> element's <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute as the resource's
address, and the <var title="">candidate pixel ratio
override</var> as the resource's pixel ratio override.</p>
</ul><p>...then append the <a href=#absolute-url>absolute URL</a> resulting from
<a href=#resolve-a-url title="resolve a url">resolving</a> the <a href=#url>URL</a>
given in that <var title="">candidate</var> element's <code title=attr-source-src><a href=#attr-source-src>src</a></code> attribute to the <var title="">result</var> list.</p>

</li>

item in <var title="">candidates</var>. This is now the element's
<a href=#media-resource>media resource</a>.</li>

<li><p>Set the <a href=#media-element>media element</a>'s <a href=#pixel-ratio-override>pixel ratio
override</a> to the pixel ratio override given for the current
item in <var title="">candidates</var>.</li>

<li><p>Set the <code title=dom-media-currentSrc><a href=#dom-media-currentsrc>currentSrc</a></code> attribute to the
<a href=#absolute-url>absolute URL</a> of the <var title="">current media
resource</var>.</li>
<var title="">specified width</var> / <var title="">target ratio</var> &le;
<var title="">specified height</var> + 0.5</span></li>

</ul><p>The <var title="">target ratio</var> is, in the
<code><a href=#video>video</a></code> element, the same as the <a href=#concept-video-adjusted-ratio title=concept-video-adjusted-ratio>adjusted ratio</a>, and in
the other cases, the ratio of the intrinsic width to the intrinsic
height in the resource. The <var title="">specified width</var> and
<var title="">specified height</var> are the values of the <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes respectively.</p>
</ul><p>The <var title="">target ratio</var> is the ratio of the
intrinsic width to the intrinsic height in the resource. The <var title="">specified width</var> and <var title="">specified
height</var> are the values of the <code title=attr-dim-width><a href=#attr-dim-width>width</a></code> and <code title=attr-dim-height><a href=#attr-dim-height>height</a></code> attributes respectively.</p>

<p>The two attributes must be omitted if the resource in question
does not have both an intrinsic width and an intrinsic height.</p>

0 comments on commit 00574e7

Please sign in to comment.
You can’t perform that action at this time.