Skip to content

Commit 822a7bd

Browse files
Donovan Gloverdomenic
authored andcommitted
Editorial: add a definition for canvas width/height numeric values
Previously, this concept was informally defined and referred to. Now it is properly defined with a <dfn>, and cross-referenced. Fixes whatwg#2066.
1 parent a5586f1 commit 822a7bd

1 file changed

Lines changed: 29 additions & 22 deletions

File tree

source

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59248,13 +59248,14 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</pre>
5924859248
<hr>
5924959249

5925059250
<p>The <code>canvas</code> element has two attributes to control the size of the element's bitmap:
59251-
<dfn><code data-x="attr-canvas-width">width</code></dfn> and <dfn><code data-x="attr-canvas-height">height</code></dfn>. These attributes, when specified, must have
59251+
<dfn><code data-x="attr-canvas-width">width</code></dfn> and <dfn><code
59252+
data-x="attr-canvas-height">height</code></dfn>. These attributes, when specified, must have
5925259253
values that are <span data-x="valid non-negative integer">valid non-negative integers</span>. <span
59253-
w-nodev>The <span>rules for parsing non-negative integers</span> must be used to obtain their
59254-
numeric values. If an attribute is missing, or if parsing its value returns an error, then the
59255-
default value must be used instead.</span> The <code data-x="attr-canvas-width">width</code>
59256-
attribute defaults to 300, and the <code data-x="attr-canvas-height">height</code> attribute
59257-
defaults to 150.</p>
59254+
w-nodev>The <span>rules for parsing non-negative integers</span> must be used to <dfn
59255+
data-x="obtain-numeric-values">obtain their numeric values</dfn>. If an attribute is missing,
59256+
or if parsing its value returns an error, then the default value must be used instead.</span>
59257+
The <code data-x="attr-canvas-width">width</code> attribute defaults to 300, and the
59258+
<code data-x="attr-canvas-height">height</code> attribute defaults to 150.</p>
5925859259

5925959260
<p>When setting the value of the <code data-x="attr-canvas-width">width</code> or <code
5926059261
data-x="attr-canvas-height">height</code> attribute, if the <span
@@ -59298,8 +59299,9 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</pre>
5929859299
<p>When its <span data-x="concept-canvas-context-mode">canvas context mode</span> is <span
5929959300
data-x="concept-canvas-none">none</span>, a <code>canvas</code> element has no rendering context,
5930059301
and its bitmap must be <span>transparent black</span> with an <span>intrinsic width</span> equal
59301-
to the numeric value of the element's <code data-x="attr-canvas-width">width</code> attribute and
59302-
an <span>intrinsic height</span> equal to the numeric value of the element's <code
59302+
to <span data-x="obtain-numeric-values">the numeric value</span> of the element's <code
59303+
data-x="attr-canvas-width">width</code> attribute and an <span>intrinsic height</span> equal to
59304+
<span data-x="obtain-numeric-values">the numeric value</span> of the element's <code
5930359305
data-x="attr-canvas-height">height</code> attribute, those values being interpreted in <span
5930459306
data-x="'px'">CSS pixels</span>, and being updated as the attributes are set, changed, or
5930559307
removed.</p>
@@ -59335,8 +59337,9 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</pre>
5933559337
<p><span data-x="concept-canvas-2d">2d</span></p>
5933659338
<td>
5933759339
<p>Follow the steps to <span data-x="concept-canvas-set-bitmap-dimensions">set bitmap
59338-
dimensions</span> to the numeric values of the <code data-x="attr-canvas-width">width</code>
59339-
and <code data-x="attr-canvas-height">height</code> content attributes.</p>
59340+
dimensions</span> to <span data-x="obtain-numeric-values">the numeric values</span>
59341+
of the <code data-x="attr-canvas-width">width</code> and <code
59342+
data-x="attr-canvas-height">height</code> content attributes.</p>
5934059343

5934159344
<tr>
5934259345
<th>
@@ -60029,9 +60032,10 @@ interface <dfn>Path2D</dfn> {
6002960032
<li><p>Set <var>context</var>'s <span>output bitmap</span> to the same bitmap as
6003060033
<var>target</var>'s bitmap (so that they are shared).</p></li>
6003160034

60032-
<li><p><span data-x="concept-canvas-set-bitmap-dimensions">Set bitmap dimensions</span> to the
60033-
numeric values of <var>target</var>'s <code data-x="attr-canvas-width">width</code> and
60034-
<code data-x="attr-canvas-height">height</code> content attributes.</p></li>
60035+
<li><p><span data-x="concept-canvas-set-bitmap-dimensions">Set bitmap dimensions</span> to
60036+
<span data-x="obtain-numeric-values">the numeric values</span> of <var>target</var>'s <code
60037+
data-x="attr-canvas-width">width</code> and <code data-x="attr-canvas-height">height</code>
60038+
content attributes.</p></li>
6003560039

6003660040
<li>
6003760041
<p>Process each of the members of <var>settings</var> as follows:</p>
@@ -60061,13 +60065,15 @@ interface <dfn>Path2D</dfn> {
6006160065
<li><p>Let <var>canvas</var> be the <code>canvas</code> element to which the rendering
6006260066
context's <code data-x="dom-context-2d-canvas">canvas</code> attribute was initialized.</p></li>
6006360067

60064-
<li><p>If the numeric value of <var>canvas</var>'s <code data-x="attr-canvas-width">width</code>
60065-
content attribute differs from <var>width</var>, then set <var>canvas</var>'s <code
60068+
<li><p>If <span data-x="obtain-numeric-values">the numeric value</span> of
60069+
<var>canvas</var>'s <code data-x="attr-canvas-width">width</code> content
60070+
attribute differs from <var>width</var>, then set <var>canvas</var>'s <code
6006660071
data-x="attr-canvas-width">width</code> content attribute to the shortest possible string
6006760072
representing <var>width</var> as a <span>valid non-negative integer</span>.</p></li>
6006860073

60069-
<li><p>If the numeric value of <var>canvas</var>'s <code data-x="attr-canvas-height">height</code>
60070-
content attribute differs from <var>height</var>, then set <var>canvas</var>'s <code
60074+
<li><p>If <span data-x="obtain-numeric-values">the numeric value</span> of
60075+
<var>canvas</var>'s <code data-x="attr-canvas-height">height</code> content
60076+
attribute differs from <var>height</var>, then set <var>canvas</var>'s <code
6007160077
data-x="attr-canvas-height">height</code> content attribute to the shortest possible string
6007260078
representing <var>height</var> as a <span>valid non-negative integer</span>.</p></li>
6007360079

@@ -64716,11 +64722,12 @@ dictionary <dfn>ImageBitmapRenderingContextSettings</dfn> {
6471664722

6471764723
<li><p>Set <var>context</var>'s <span
6471864724
data-x="concept-ImageBitmapRenderingContext-output-bitmap">output bitmap</span> to be
64719-
<span>transparent black</span> with an <span>intrinsic width</span> equal to the numeric value
64720-
of <var>canvas</var>'s <code data-x="attr-canvas-width">width</code> attribute and an
64721-
<span>intrinsic height</span> equal to the numeric value of <var>canvas</var>'s <code
64722-
data-x="attr-canvas-height">height</code> attribute, those values being interpreted in <span
64723-
data-x="'px'">CSS pixels</span>.</p></li>
64725+
<span>transparent black</span> with an <span>intrinsic width</span> equal to <span
64726+
data-x="obtain-numeric-values">the numeric value</span> of <var>canvas</var>'s <code
64727+
data-x="attr-canvas-width">width</code> attribute and an <span>intrinsic height</span> equal
64728+
to <span data-x="obtain-numeric-values">the numeric value</span> of <var>canvas</var>'s
64729+
<code data-x="attr-canvas-height">height</code> attribute, those values being interpreted
64730+
in <span data-x="'px'">CSS pixels</span>.</p></li>
6472464731

6472564732
<li><p>Set the <span
6472664733
data-x="concept-ImageBitmapRenderingContext-output-bitmap">output bitmap</span>'s <span

0 commit comments

Comments
 (0)