Skip to content

Commit

Permalink
[gow] (2) Revamp of the intrinsic dimensions and pixel ratio definiti…
Browse files Browse the repository at this point in the history
…ons. (Re: HTMLMediaElement: more issues and ambiguities) (credit: pj)

git-svn-id: http://svn.whatwg.org/webapps@1903 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 22, 2008
1 parent 0fd1faf commit 26f2b6b
Show file tree
Hide file tree
Showing 2 changed files with 189 additions and 122 deletions.
154 changes: 94 additions & 60 deletions index
Expand Up @@ -16922,65 +16922,94 @@ the time Marco had stuck his tongue out...&lt;/p></pre>

<hr>

<p>The <code><a href="#video1">video</a></code> element supports <a
href="#dimension0">dimension attributes</a>.
<p>The intrinsic width and height of the video are the aspect-ratio
corrected dimensions given by the video data itself: the <dfn id=intrinsic
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=intrinsic0 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=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=pixel0
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>The <dfn id=videowidth
title=dom-video-videoWidth><code>videoWidth</code></dfn> DOM attribute
must return the intrinsic width of the video in CSS pixels. The <dfn
id=videoheight title=dom-video-videoHeight><code>videoHeight</code></dfn>
DOM attribute must return the intrinsic height of the video in CSS pixels.
In the absence of resolution information defining the mapping of pixels in
the video to physical dimensions, user agents may assume that one pixel in
the video corresponds to one CSS pixel. If no video data is available,
then the attributes must return 0.
must return the <a href="#intrinsic"
title=concept-video-intrinsic-width>intrinsic width</a> of the video in
CSS pixels. The <dfn id=videoheight
title=dom-video-videoHeight><code>videoHeight</code></dfn> DOM attribute
must return the <a href="#intrinsic0"
title=concept-video-intrinsic-height>intrinsic height</a> of the video in
CSS pixels. If no video data is available, then the attributes must return
0.

<p>If the video's <a href="#pixel1">pixel ratio override</a>'s is
<i>none</i>, then the video's <dfn id=adjusted
title=concept-video-adjusted-width>adjusted width</dfn> is the same as the
video's <a href="#intrinsic" title=concept-video-intrinsic-width>intrinsic
width</a>. If the video has a <a href="#pixel1">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="#pixel1">pixel ratio override</a>, multiplied by the <a
href="#resolution" title=concept-video-resolution>resolution of the
resource</a>; the <a href="#pixel0" title=concept-video-pixel-ratio>pixel
ratio of the resource</a> is thus ignored.

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

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

<p>User agents may adjust the <a href="#adjusted"
title=concept-video-adjusted-width>adjusted width</a> and <a
href="#adjusted0" 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="#adjusted1"
title=concept-video-adjusted-ratio>adjusted aspect ratio</a> (this is
especially relevant for pixel ratios that are less than 1.0).

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

<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="#adjusted">adjusted aspect ratio</a> being preserved.
Thus, if the aspect ratio of the playback area does not match the <a
href="#adjusted">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>The <dfn id=adjusted>adjusted aspect ratio</dfn> of a video is the ratio
of its intrinsic width to its intrinsic height.

<p>If the video's <a href="#pixel0">pixel ratio override</a>'s is
<i>none</i>, then the video's intrinsic width is the width given by the
resource itself. If the video has a <a href="#pixel0">pixel ratio
override</a> other than <i>none</i>, then the intrinsic width of the video
is the width given by the resource itself, divided by the pixel ratio
given by the resource itself, multiplied by the video's <a
href="#pixel0">pixel ratio override</a>. If the resource doesn't give an
explicit width, then user agents should assume that the width of each
pixel of the video data is exactly one CSS pixel multiplied by the
resource's pixel ratio. If the resource doesn't give an explicit pixel
ratio, then user agents should assume that the pixel ratio is 1.0.

<p>The intrinsic height of a video is the height given by the resource
itself. If the resource doesn't give an explicit height, then user agents
should assume that the height of each pixel of the video data is exactly
one CSS pixel.

<p>User agents may adjust the intrinsic width and height 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="#adjusted">adjusted
aspect ratio</a> (this is especially relevant for pixel ratios that are
less than 1.0).
content's <a href="#adjusted1" 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="#adjusted1"
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>The intrinsic width of a <code><a href="#video1">video</a></code>
element's playback area is the intrinsic width of the video resource, if
that is available; otherwise it is the intrinsic width of the <a
href="#poster0">poster frame</a>, if that is available; otherwise it is
element's playback area is the <a href="#adjusted"
title=concept-video-adjusted-width>adjusted width</a> of the video
resource, if that is available; otherwise it is the intrinsic width of the
<a href="#poster0">poster frame</a>, if that is available; otherwise it is
300 CSS pixels.

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

<p class=note>The <a href="#poster0">poster frame</a> is not affected by
the pixel ratio conversions.
Expand Down Expand Up @@ -17345,19 +17374,21 @@ the time Marco had stuck his tongue out...&lt;/p></pre>
title=attr-source-pixelratio><code>pixelratio</code></dfn> attribute
allows the author to specify the pixel ratio of anamorphic <a
href="#media10" title="media resource">media resources</a> that do not
self-describe their pixel ratio. The attribute value, if specified, must
be a <a href="#valid2">valid floating point number</a> 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.
self-describe their <a href="#adjusted1"
title=concept-video-adjusted-ratio>pixel ratio</a>. The attribute value,
if specified, must be a <a href="#valid2">valid floating point number</a>
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 class=note>The only way this default is used is in deciding what number
the <code title=dom-source-pixelRatio><a
href="#pixelratio0">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
intrinsic width of the video at all; the intrinsic dimensions and the
intrinsic pixel ratio of the video are honoured.
is omitted or cannot be parsed, then the user agent doesn't adjust the <a
href="#intrinsic" title=concept-video-intrinsic-width>intrinsic width</a>
of the video at all; the intrinsic dimensions and the <a href="#pixel0"
title=concept-video-pixel-ratio>pixel ratio</a> of the video are honoured.

<p>If a <code><a href="#source">source</a></code> element is inserted into
a <a href="#media7">media element</a> that is already in a document and
Expand Down Expand Up @@ -17660,7 +17691,7 @@ the time Marco had stuck his tongue out...&lt;/p></pre>
<li>
<p>Let the address of the <dfn id=chosen>chosen media resource</dfn> be
the <a href="#absolute">absolute URL</a> that was found before jumping
to this step, and let its <dfn id=pixel0>pixel ratio override</dfn> be
to this step, and let its <dfn id=pixel1>pixel ratio override</dfn> be
the value of the <var title="">chosen resource's pixel ratio
override</var>.
</ol>
Expand Down Expand Up @@ -21811,7 +21842,7 @@ XXXDVT (also check for '- -' bits in the part above) -->
of the target element, not the rendered image (e.g. height/width
attributes don't affect it -->

<h6 id=pixel><span class=secno>4.7.11.1.11. </span><dfn id=pixel1>Pixel
<h6 id=pixel><span class=secno>4.7.11.1.11. </span><dfn id=pixel2>Pixel
manipulation</dfn></h6>

<p>The <dfn id=createimagedata
Expand Down Expand Up @@ -22969,9 +23000,12 @@ function AddCloud(data, x, y) { ... }</pre>
resolution of 96ppi, but in general the CSS pixel resolution depends on
the reading distance.) If both attributes are specified, then the ratio of
the specified width to the specified height must be the same as the ratio
of the logical width to the logical height in the resource. The two
attributes must be omitted if the resource in question does not have both
a logical width and a logical height.
of the intrinsic width to the intrinsic height in the resource, or
alternatively, in the case of the <code><a href="#video1">video</a></code>
element, the same as the <a href="#adjusted1"
title=concept-video-adjusted-ratio>adjusted ratio</a>. The two attributes
must be omitted if the resource in question does not have both an
intrinsic width and an intrinsic height.

<p>To parse the attributes, user agents must use the <a
href="#rules2">rules for parsing dimension values</a>. This will return
Expand Down

0 comments on commit 26f2b6b

Please sign in to comment.