[html5] r7482 - [giow] (0) Add supportsContext() Affected topics: Canvas, DOM APIs
whatwg at whatwg.org
whatwg at whatwg.org
Mon Oct 22 16:36:58 PDT 2012
Author: ianh
Date: 2012-10-22 16:36:56 -0700 (Mon, 22 Oct 2012)
New Revision: 7482
Modified:
complete.html
index
source
Log:
[giow] (0) Add supportsContext()
Affected topics: Canvas, DOM APIs
Modified: complete.html
===================================================================
--- complete.html 2012-10-19 23:02:56 UTC (rev 7481)
+++ complete.html 2012-10-22 23:36:56 UTC (rev 7482)
@@ -248,7 +248,7 @@
<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
- <h2 class="no-num no-toc">Living Standard — Last Updated 19 October 2012</h2>
+ <h2 class="no-num no-toc">Living Standard — Last Updated 22 October 2012</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
@@ -36278,106 +36278,81 @@
void <a href=#dom-canvas-toblobhd title=dom-canvas-toBlobHD>toBlobHD</a>(<a href=#filecallback>FileCallback</a>? _callback, optional DOMString type, any... arguments);
object? <a href=#dom-canvas-getcontext title=dom-canvas-getContext>getContext</a>(DOMString contextId, any... arguments);
+ boolean <a href=#dom-canvas-supportscontext title=dom-canvas-supportsContext>supportsContext</a>(DOMString contextId, any... arguments);
};</pre>
</dd>
- </dl><!--REMOVE-TOPIC:DOM APIs--><p>The <code><a href=#the-canvas-element>canvas</a></code> element provides scripts with a
- resolution-dependent bitmap canvas, which can be used for rendering
- graphs, game graphics, art, or other visual images on the fly.</p>
+ </dl><!--REMOVE-TOPIC:DOM APIs--><p>The <code><a href=#the-canvas-element>canvas</a></code> element provides scripts with a resolution-dependent bitmap canvas,
+ which can be used for rendering graphs, game graphics, art, or other visual images on the fly.</p>
- <p>Authors should not use the <code><a href=#the-canvas-element>canvas</a></code> element in a
- document when a more suitable element is available. For example, it
- is inappropriate to use a <code><a href=#the-canvas-element>canvas</a></code> element to render a
- page heading: if the desired presentation of the heading is
- graphically intense, it should be marked up using appropriate
- elements (typically <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>) and then styled using CSS and
- supporting technologies such as XBL.</p>
+ <p>Authors should not use the <code><a href=#the-canvas-element>canvas</a></code> element in a document when a more suitable
+ element is available. For example, it is inappropriate to use a <code><a href=#the-canvas-element>canvas</a></code> element to
+ render a page heading: if the desired presentation of the heading is graphically intense, it
+ should be marked up using appropriate elements (typically <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>) and then styled using
+ CSS and supporting technologies such as XBL.</p>
- <p>When authors use the <code><a href=#the-canvas-element>canvas</a></code> element, they must also
- provide content that, when presented to the user, conveys
- essentially the same function or purpose as the bitmap canvas. This
- content may be placed as content of the <code><a href=#the-canvas-element>canvas</a></code>
- element. The contents of the <code><a href=#the-canvas-element>canvas</a></code> element, if any,
- are the element's <a href=#fallback-content>fallback content</a>.</p>
+ <p>When authors use the <code><a href=#the-canvas-element>canvas</a></code> element, they must also provide content that, when
+ presented to the user, conveys essentially the same function or purpose as the bitmap canvas. This
+ content may be placed as content of the <code><a href=#the-canvas-element>canvas</a></code> element. The contents of the
+ <code><a href=#the-canvas-element>canvas</a></code> element, if any, are the element's <a href=#fallback-content>fallback content</a>.</p>
- <p>In interactive visual media, if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for the
- <code><a href=#the-canvas-element>canvas</a></code> element, and if support for <code><a href=#the-canvas-element>canvas</a></code>
- elements has been enabled, the <code><a href=#the-canvas-element>canvas</a></code> element
- <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> consisting of
- a dynamically created image.</p>
+ <p>In interactive visual media, if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for
+ the <code><a href=#the-canvas-element>canvas</a></code> element, and if support for <code><a href=#the-canvas-element>canvas</a></code> elements has been enabled,
+ the <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> consisting
+ of a dynamically created image.</p>
- <p>In non-interactive, static, visual media, if the
- <code><a href=#the-canvas-element>canvas</a></code> element has been previously painted on (e.g. if
- the page was viewed in an interactive visual medium and is now being
- printed, or if some script that ran during the page layout process
- painted on the element), then the <code><a href=#the-canvas-element>canvas</a></code> element
- <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> with the
- current image and size. Otherwise, the element represents its
- <a href=#fallback-content>fallback content</a> instead.</p>
-
- <p>In non-visual media, and in visual media if <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a> for the
- <code><a href=#the-canvas-element>canvas</a></code> element or if support for <code><a href=#the-canvas-element>canvas</a></code>
- elements has been disabled, the <code><a href=#the-canvas-element>canvas</a></code> element
- <a href=#represents>represents</a> its <a href=#fallback-content>fallback content</a>
+ <p>In non-interactive, static, visual media, if the <code><a href=#the-canvas-element>canvas</a></code> element has been
+ previously painted on (e.g. if the page was viewed in an interactive visual medium and is now
+ being printed, or if some script that ran during the page layout process painted on the element),
+ then the <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> with
+ the current image and size. Otherwise, the element represents its <a href=#fallback-content>fallback content</a>
instead.</p>
+ <p>In non-visual media, and in visual media if <a href=#concept-n-noscript title=concept-n-noscript>scripting is
+ disabled</a> for the <code><a href=#the-canvas-element>canvas</a></code> element or if support for <code><a href=#the-canvas-element>canvas</a></code> elements
+ has been disabled, the <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> its <a href=#fallback-content>fallback
+ content</a> instead.</p>
+
<!-- CANVAS-FOCUS-FALLBACK -->
- <p>When a <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a>
- <a href=#embedded-content>embedded content</a>, the user can still focus descendants
- of the <code><a href=#the-canvas-element>canvas</a></code> element (in the <a href=#fallback-content>fallback
- content</a>). When an element is focused, it is the target of
- keyboard interaction events (even though the element itself is not
- visible). This allows authors to make an interactive canvas
- keyboard-accessible: authors should have a one-to-one mapping of
- interactive regions to focusable elements in the <a href=#fallback-content>fallback
- content</a>. (Focus has no effect on mouse interaction
- events.) <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+ <p>When a <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a>, the
+ user can still focus descendants of the <code><a href=#the-canvas-element>canvas</a></code> element (in the <a href=#fallback-content>fallback
+ content</a>). When an element is focused, it is the target of keyboard interaction events (even
+ though the element itself is not visible). This allows authors to make an interactive canvas
+ keyboard-accessible: authors should have a one-to-one mapping of interactive regions to focusable
+ elements in the <a href=#fallback-content>fallback content</a>. (Focus has no effect on mouse interaction events.)
+ <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
- <p>The <code><a href=#the-canvas-element>canvas</a></code> element has two attributes to control the
- size of the coordinate space: <dfn id=attr-canvas-width title=attr-canvas-width><code>width</code></dfn> and <dfn id=attr-canvas-height title=attr-canvas-height><code>height</code></dfn>. These
- attributes, when specified, must have values that are <a href=#valid-non-negative-integer title="valid non-negative integer">valid non-negative
- integers</a>. <span class=impl>The <a href=#rules-for-parsing-non-negative-integers>rules for parsing
- non-negative integers</a> must be used to obtain their numeric
- values. If an attribute is missing, or if parsing its value returns
- an error, then the default value must be used instead.</span> The
- <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> attribute defaults to
- 300, and the <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code>
- attribute defaults to 150.</p>
+ <p>The <code><a href=#the-canvas-element>canvas</a></code> element has two attributes to control the size of the coordinate space:
+ <dfn id=attr-canvas-width title=attr-canvas-width><code>width</code></dfn> and <dfn id=attr-canvas-height title=attr-canvas-height><code>height</code></dfn>. These attributes, when specified, must have
+ values that are <a href=#valid-non-negative-integer title="valid non-negative integer">valid non-negative integers</a>. <span class=impl>The <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> must be used to obtain their
+ numeric values. If an attribute is missing, or if parsing its value returns an error, then the
+ default value must be used instead.</span> The <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code>
+ attribute defaults to 300, and the <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> attribute
+ defaults to 150.</p>
- <p>The intrinsic dimensions of the <code><a href=#the-canvas-element>canvas</a></code> element equal
- the size of the coordinate space, with the numbers interpreted in
- CSS pixels. However, the element can be sized arbitrarily by a
- style sheet. During rendering, the image is scaled to fit this layout
- size.</p>
+ <p>The intrinsic dimensions of the <code><a href=#the-canvas-element>canvas</a></code> element equal the size of the coordinate
+ space, with the numbers interpreted in CSS pixels. However, the element can be sized arbitrarily
+ by a style sheet. During rendering, the image is scaled to fit this layout size.</p>
<div class=impl>
- <p>The size of the coordinate space does not necessarily represent
- the size of the actual bitmap that the user agent will use
- internally or during rendering. On high-definition displays, for
- instance, the user agent may internally use a bitmap with two device
- pixels per unit in the coordinate space, so that the rendering
- remains at high quality throughout.</p>
+ <p>The size of the coordinate space does not necessarily represent the size of the actual bitmap
+ that the user agent will use internally or during rendering. On high-definition displays, for
+ instance, the user agent may internally use a bitmap with two device pixels per unit in the
+ coordinate space, so that the rendering remains at high quality throughout.</p>
- <p>When the <code><a href=#the-canvas-element>canvas</a></code> element is created, and subsequently
- whenever the <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> and <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> attributes are set (whether
- to a new value or to the previous value), the bitmap and any
- associated contexts must be cleared back to their initial state and
- reinitialized with the newly specified coordinate space
- dimensions.</p>
+ <p>When the <code><a href=#the-canvas-element>canvas</a></code> element is created, and subsequently whenever the <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> and <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code>
+ attributes are set (whether to a new value or to the previous value), the bitmap and any
+ associated contexts must be cleared back to their initial state and reinitialized with the newly
+ specified coordinate space dimensions.</p>
- <p>When the canvas is initialized, its bitmap must be cleared to
- transparent black.</p>
+ <p>When the canvas is initialized, its bitmap must be cleared to transparent black.</p>
- <p>When a <code><a href=#the-canvas-element>canvas</a></code> element does not represent its
- <a href=#fallback-content>fallback content</a>, it <a href=#provides-a-paint-source>provides a paint
- source</a> whose width is the element's intrinsic width, whose
- height is the element's intrinsic height, and whose appearance is
- the element's bitmap.</p>
+ <p>When a <code><a href=#the-canvas-element>canvas</a></code> element does not represent its <a href=#fallback-content>fallback content</a>, it
+ <a href=#provides-a-paint-source>provides a paint source</a> whose width is the element's intrinsic width, whose height is
+ the element's intrinsic height, and whose appearance is the element's bitmap.</p>
- <p>The <dfn id=dom-canvas-width title=dom-canvas-width><code>width</code></dfn> and
- <dfn id=dom-canvas-height title=dom-canvas-height><code>height</code></dfn> IDL
- attributes must <a href=#reflect>reflect</a> the respective content
- attributes of the same name, with the same defaults.</p>
+ <p>The <dfn id=dom-canvas-width title=dom-canvas-width><code>width</code></dfn> and <dfn id=dom-canvas-height title=dom-canvas-height><code>height</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name, with the same defaults.</p>
</div>
@@ -36396,105 +36371,102 @@
<dd>
- <p>Returns an object that exposes an API for drawing on the
- canvas. The first argument specifies the desired API. Subsequent
- arguments are handled by that API.</p>
+ <p>Returns an object that exposes an API for drawing on the canvas. The first argument specifies
+ the desired API. Subsequent arguments are handled by that API.</p>
- <p>This specification defines the "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" context below. There is also
- a specification that defines a "<code title=canvas-context-webgl>webgl</code>" context. <a href=#refsWEBGL>[WEBGL]</a></p>
+ <p>This specification defines the "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" context below.
+ There is also a specification that defines a "<code title=canvas-context-webgl>webgl</code>"
+ context. <a href=#refsWEBGL>[WEBGL]</a></p>
- <p>The list of defined contexts is given on the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki
- CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a>
+ <p>The list of defined contexts is given on the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a>
- <p>Returns null if the given context ID is not supported or if the
- canvas has already been initialized with some other (incompatible)
- context type (e.g. trying to get a "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" context after getting a
- "<code title=canvas-context-webgl>webgl</code>" context).</p>
+ <p>Returns null if the given context ID is not supported or if the canvas has already been
+ initialized with some other (incompatible) context type (e.g. trying to get a "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" context after getting a "<code title=canvas-context-webgl>webgl</code>" context).</p>
</dd>
+ <dt><var title="">context</var> = <var title="">canvas</var> . <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext</a></code>(<var title="">contextId</var> [, ... ])</dt>
+
+ <dd>
+
+ <p>Returns false if calling <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> with the
+ same arguments would definitely return null, and true otherwise.</p>
+
+ <p>This return value is not a guarantee that <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> will or will not return an object, as
+ conditions (e.g. availability of system resources) can vary over time.</p>
+
+ </dd>
+
</dl><div class=impl>
- <p>A <code><a href=#the-canvas-element>canvas</a></code> element can have a <dfn id=primary-context>primary
- context</dfn>, which is the first context to have been obtained for
- that element. When created, a <code><a href=#the-canvas-element>canvas</a></code> element must not
- have a <a href=#primary-context>primary context</a>.</p>
+ <p>A <code><a href=#the-canvas-element>canvas</a></code> element can have a <dfn id=primary-context>primary context</dfn>, which is the first context
+ to have been obtained for that element. When created, a <code><a href=#the-canvas-element>canvas</a></code> element must not have
+ a <a href=#primary-context>primary context</a>.</p>
- <p>The <dfn id=dom-canvas-getcontext title=dom-canvas-getContext><code>getContext(<var title="">contextId</var>, <var title="">arguments...</var>)</code></dfn> method of the
- <code><a href=#the-canvas-element>canvas</a></code> element, when invoked, must run the following
- steps:</p>
+ <p>The <dfn id=dom-canvas-getcontext title=dom-canvas-getContext><code>getContext(<var title="">contextId</var>, <var title="">arguments...</var>)</code></dfn> method of the <code><a href=#the-canvas-element>canvas</a></code> element, when invoked,
+ must run the following steps:</p>
- <ol><li><p>Let <var title="">contextId</var> be the first argument to
- the method.</li>
+ <ol><li><p>Let <var title="">contextId</var> be the first argument to the method.</li>
<li>
- <p>If <var title="">contextId</var> is not the name of a context
- supported by the user agent, return null and abort these
- steps.</p>
+ <p>If <var title="">contextId</var> is not the name of a context supported by the user agent,
+ return null and abort these steps.</p>
- <p class=note>An example of this would be a user agent that
- theoretically supports the "<code title=canvas-context-webgl>webgl</code>" 3D context, in the case
- where the platform does not have hardware support for OpenGL and
- the user agent does not have a software OpenGL implementation.
- Despite the user agent recognising the "<code title=canvas-context-webgl>webgl</code>" name, it would return
- null at this step because that context is not, in practice,
- supported at the time of the call.</p>
+ <p class=note>An example of this would be a user agent that theoretically supports the "<code title=canvas-context-webgl>webgl</code>" 3D context, in the case where the platform does not
+ have hardware support for OpenGL and the user agent does not have a software OpenGL
+ implementation. Despite the user agent recognising the "<code title=canvas-context-webgl>webgl</code>" name, it would return null at this step because that
+ context is not, in practice, supported at the time of the call.</p>
</li>
- <li><p>If the element has a <a href=#primary-context>primary context</a> and that
- context's entry in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki
- CanvasContexts page</a> does not list <var title="">contextId</var>
- as a context with which it is compatible, return null and abort
- these steps. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></li>
+ <li><p>If the element has a <a href=#primary-context>primary context</a> and that context's entry in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki CanvasContexts page</a> does not
+ list <var title="">contextId</var> as a context with which it is compatible, return null and
+ abort these steps. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></li>
- <li><p>If the element does not have a <a href=#primary-context>primary context</a>,
- let the element's <a href=#primary-context>primary context</a> be <var title="">contextId</var>.</li>
+ <li><p>If the element does not have a <a href=#primary-context>primary context</a>, let the element's
+ <a href=#primary-context>primary context</a> be <var title="">contextId</var>.</li>
- <li><p>If the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> method has
- already been invoked on this element for the same <var title="">contextId</var>, return the same object as was returned
- that time, and abort these steps. The additional arguments are
- ignored.</li>
+ <li><p>If the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> method has already been
+ invoked on this element for the same <var title="">contextId</var>, return the same object as was
+ returned that time, and abort these steps. The additional arguments are ignored.</li>
- <li><p><dfn id=getcontext-return title=getContext-return>Return a new object for <var title="">contextId</var></dfn>, as defined by the specification
- given for <var title="">contextId</var>'s entry in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki
- CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></li>
+ <li><p><dfn id=getcontext-return title=getContext-return>Return a new object for <var title="">contextId</var></dfn>, as defined by the specification given for <var title="">contextId</var>'s entry in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></li>
- </ol><p>New context types may be registered in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki
- CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
+ </ol><p>The <dfn id=dom-canvas-supportscontext title=dom-canvas-supportsContext><code>supportContext(<var title="">contextId</var>,
+ <var title="">arguments...</var>)</code></dfn> method of the <code><a href=#the-canvas-element>canvas</a></code> element, when
+ invoked, must return false if calling <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> on
+ the same object and with the same arguments would definitely return null at this time, and true
+ otherwise.</p>
- <p>Anyone is free to edit the WHATWG Wiki CanvasContexts page at any
- time to add a new context type. These new context types must be
- specified with the following information:</p>
+ <p>New context types may be registered in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
+ <p>Anyone is free to edit the WHATWG Wiki CanvasContexts page at any time to add a new context
+ type. These new context types must be specified with the following information:</p>
+
<dl><dt>Keyword</dt>
- <dd><p>The value of <var title="">contextID</var> that will return
- the object for the new API.</dd>
+ <dd><p>The value of <var title="">contextID</var> that will return the object for the new
+ API.</dd>
<dt>Specification</dt>
- <dd><p>A link to a formal specification of the context type's
- API. It could be another page on the Wiki, or a link to an external
- page. If the type does not have a formal specification, an informal
- description can be substituted until such time as a formal
- specification is available.</dd>
+ <dd><p>A link to a formal specification of the context type's API. It could be another page on
+ the Wiki, or a link to an external page. If the type does not have a formal specification, an
+ informal description can be substituted until such time as a formal specification is
+ available.</dd>
<dt>Compatible with</dt>
- <dd><p>The list of context types that are compatible with this one
- (i.e. that operate on the same underlying bitmap). This list must
- be transitive and symmetric; if one context type is defined as
- compatible with another, then all types it is compatible with must
- be compatible with all types the other is compatible with.</dd>
+ <dd><p>The list of context types that are compatible with this one (i.e. that operate on the same
+ underlying bitmap). This list must be transitive and symmetric; if one context type is defined as
+ compatible with another, then all types it is compatible with must be compatible with all types
+ the other is compatible with.</dd>
- </dl><p>Vendors may also define experimental contexts using the syntax
- <code><var title="">vendorname</var>-<var title="">context</var></code>, for example,
- <code>moz-3d</code>. Such contexts should be registered in the
- WHATWG Wiki CanvasContexts page.</p>
+ </dl><p>Vendors may also define experimental contexts using the syntax <code><var title="">vendorname</var>-<var title="">context</var></code>, for example, <code>moz-3d</code>.
+ Such contexts should be registered in the WHATWG Wiki CanvasContexts page.</p>
</div>
Modified: index
===================================================================
--- index 2012-10-19 23:02:56 UTC (rev 7481)
+++ index 2012-10-22 23:36:56 UTC (rev 7482)
@@ -248,7 +248,7 @@
<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
- <h2 class="no-num no-toc">Living Standard — Last Updated 19 October 2012</h2>
+ <h2 class="no-num no-toc">Living Standard — Last Updated 22 October 2012</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
@@ -36278,106 +36278,81 @@
void <a href=#dom-canvas-toblobhd title=dom-canvas-toBlobHD>toBlobHD</a>(<a href=#filecallback>FileCallback</a>? _callback, optional DOMString type, any... arguments);
object? <a href=#dom-canvas-getcontext title=dom-canvas-getContext>getContext</a>(DOMString contextId, any... arguments);
+ boolean <a href=#dom-canvas-supportscontext title=dom-canvas-supportsContext>supportsContext</a>(DOMString contextId, any... arguments);
};</pre>
</dd>
- </dl><!--REMOVE-TOPIC:DOM APIs--><p>The <code><a href=#the-canvas-element>canvas</a></code> element provides scripts with a
- resolution-dependent bitmap canvas, which can be used for rendering
- graphs, game graphics, art, or other visual images on the fly.</p>
+ </dl><!--REMOVE-TOPIC:DOM APIs--><p>The <code><a href=#the-canvas-element>canvas</a></code> element provides scripts with a resolution-dependent bitmap canvas,
+ which can be used for rendering graphs, game graphics, art, or other visual images on the fly.</p>
- <p>Authors should not use the <code><a href=#the-canvas-element>canvas</a></code> element in a
- document when a more suitable element is available. For example, it
- is inappropriate to use a <code><a href=#the-canvas-element>canvas</a></code> element to render a
- page heading: if the desired presentation of the heading is
- graphically intense, it should be marked up using appropriate
- elements (typically <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>) and then styled using CSS and
- supporting technologies such as XBL.</p>
+ <p>Authors should not use the <code><a href=#the-canvas-element>canvas</a></code> element in a document when a more suitable
+ element is available. For example, it is inappropriate to use a <code><a href=#the-canvas-element>canvas</a></code> element to
+ render a page heading: if the desired presentation of the heading is graphically intense, it
+ should be marked up using appropriate elements (typically <code><a href=#the-h1,-h2,-h3,-h4,-h5,-and-h6-elements>h1</a></code>) and then styled using
+ CSS and supporting technologies such as XBL.</p>
- <p>When authors use the <code><a href=#the-canvas-element>canvas</a></code> element, they must also
- provide content that, when presented to the user, conveys
- essentially the same function or purpose as the bitmap canvas. This
- content may be placed as content of the <code><a href=#the-canvas-element>canvas</a></code>
- element. The contents of the <code><a href=#the-canvas-element>canvas</a></code> element, if any,
- are the element's <a href=#fallback-content>fallback content</a>.</p>
+ <p>When authors use the <code><a href=#the-canvas-element>canvas</a></code> element, they must also provide content that, when
+ presented to the user, conveys essentially the same function or purpose as the bitmap canvas. This
+ content may be placed as content of the <code><a href=#the-canvas-element>canvas</a></code> element. The contents of the
+ <code><a href=#the-canvas-element>canvas</a></code> element, if any, are the element's <a href=#fallback-content>fallback content</a>.</p>
- <p>In interactive visual media, if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for the
- <code><a href=#the-canvas-element>canvas</a></code> element, and if support for <code><a href=#the-canvas-element>canvas</a></code>
- elements has been enabled, the <code><a href=#the-canvas-element>canvas</a></code> element
- <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> consisting of
- a dynamically created image.</p>
+ <p>In interactive visual media, if <a href=#concept-n-script title=concept-n-script>scripting is enabled</a> for
+ the <code><a href=#the-canvas-element>canvas</a></code> element, and if support for <code><a href=#the-canvas-element>canvas</a></code> elements has been enabled,
+ the <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> consisting
+ of a dynamically created image.</p>
- <p>In non-interactive, static, visual media, if the
- <code><a href=#the-canvas-element>canvas</a></code> element has been previously painted on (e.g. if
- the page was viewed in an interactive visual medium and is now being
- printed, or if some script that ran during the page layout process
- painted on the element), then the <code><a href=#the-canvas-element>canvas</a></code> element
- <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> with the
- current image and size. Otherwise, the element represents its
- <a href=#fallback-content>fallback content</a> instead.</p>
-
- <p>In non-visual media, and in visual media if <a href=#concept-n-noscript title=concept-n-noscript>scripting is disabled</a> for the
- <code><a href=#the-canvas-element>canvas</a></code> element or if support for <code><a href=#the-canvas-element>canvas</a></code>
- elements has been disabled, the <code><a href=#the-canvas-element>canvas</a></code> element
- <a href=#represents>represents</a> its <a href=#fallback-content>fallback content</a>
+ <p>In non-interactive, static, visual media, if the <code><a href=#the-canvas-element>canvas</a></code> element has been
+ previously painted on (e.g. if the page was viewed in an interactive visual medium and is now
+ being printed, or if some script that ran during the page layout process painted on the element),
+ then the <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a> with
+ the current image and size. Otherwise, the element represents its <a href=#fallback-content>fallback content</a>
instead.</p>
+ <p>In non-visual media, and in visual media if <a href=#concept-n-noscript title=concept-n-noscript>scripting is
+ disabled</a> for the <code><a href=#the-canvas-element>canvas</a></code> element or if support for <code><a href=#the-canvas-element>canvas</a></code> elements
+ has been disabled, the <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> its <a href=#fallback-content>fallback
+ content</a> instead.</p>
+
<!-- CANVAS-FOCUS-FALLBACK -->
- <p>When a <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a>
- <a href=#embedded-content>embedded content</a>, the user can still focus descendants
- of the <code><a href=#the-canvas-element>canvas</a></code> element (in the <a href=#fallback-content>fallback
- content</a>). When an element is focused, it is the target of
- keyboard interaction events (even though the element itself is not
- visible). This allows authors to make an interactive canvas
- keyboard-accessible: authors should have a one-to-one mapping of
- interactive regions to focusable elements in the <a href=#fallback-content>fallback
- content</a>. (Focus has no effect on mouse interaction
- events.) <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
+ <p>When a <code><a href=#the-canvas-element>canvas</a></code> element <a href=#represents>represents</a> <a href=#embedded-content>embedded content</a>, the
+ user can still focus descendants of the <code><a href=#the-canvas-element>canvas</a></code> element (in the <a href=#fallback-content>fallback
+ content</a>). When an element is focused, it is the target of keyboard interaction events (even
+ though the element itself is not visible). This allows authors to make an interactive canvas
+ keyboard-accessible: authors should have a one-to-one mapping of interactive regions to focusable
+ elements in the <a href=#fallback-content>fallback content</a>. (Focus has no effect on mouse interaction events.)
+ <a href=#refsDOMEVENTS>[DOMEVENTS]</a></p>
- <p>The <code><a href=#the-canvas-element>canvas</a></code> element has two attributes to control the
- size of the coordinate space: <dfn id=attr-canvas-width title=attr-canvas-width><code>width</code></dfn> and <dfn id=attr-canvas-height title=attr-canvas-height><code>height</code></dfn>. These
- attributes, when specified, must have values that are <a href=#valid-non-negative-integer title="valid non-negative integer">valid non-negative
- integers</a>. <span class=impl>The <a href=#rules-for-parsing-non-negative-integers>rules for parsing
- non-negative integers</a> must be used to obtain their numeric
- values. If an attribute is missing, or if parsing its value returns
- an error, then the default value must be used instead.</span> The
- <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> attribute defaults to
- 300, and the <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code>
- attribute defaults to 150.</p>
+ <p>The <code><a href=#the-canvas-element>canvas</a></code> element has two attributes to control the size of the coordinate space:
+ <dfn id=attr-canvas-width title=attr-canvas-width><code>width</code></dfn> and <dfn id=attr-canvas-height title=attr-canvas-height><code>height</code></dfn>. These attributes, when specified, must have
+ values that are <a href=#valid-non-negative-integer title="valid non-negative integer">valid non-negative integers</a>. <span class=impl>The <a href=#rules-for-parsing-non-negative-integers>rules for parsing non-negative integers</a> must be used to obtain their
+ numeric values. If an attribute is missing, or if parsing its value returns an error, then the
+ default value must be used instead.</span> The <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code>
+ attribute defaults to 300, and the <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> attribute
+ defaults to 150.</p>
- <p>The intrinsic dimensions of the <code><a href=#the-canvas-element>canvas</a></code> element equal
- the size of the coordinate space, with the numbers interpreted in
- CSS pixels. However, the element can be sized arbitrarily by a
- style sheet. During rendering, the image is scaled to fit this layout
- size.</p>
+ <p>The intrinsic dimensions of the <code><a href=#the-canvas-element>canvas</a></code> element equal the size of the coordinate
+ space, with the numbers interpreted in CSS pixels. However, the element can be sized arbitrarily
+ by a style sheet. During rendering, the image is scaled to fit this layout size.</p>
<div class=impl>
- <p>The size of the coordinate space does not necessarily represent
- the size of the actual bitmap that the user agent will use
- internally or during rendering. On high-definition displays, for
- instance, the user agent may internally use a bitmap with two device
- pixels per unit in the coordinate space, so that the rendering
- remains at high quality throughout.</p>
+ <p>The size of the coordinate space does not necessarily represent the size of the actual bitmap
+ that the user agent will use internally or during rendering. On high-definition displays, for
+ instance, the user agent may internally use a bitmap with two device pixels per unit in the
+ coordinate space, so that the rendering remains at high quality throughout.</p>
- <p>When the <code><a href=#the-canvas-element>canvas</a></code> element is created, and subsequently
- whenever the <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> and <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code> attributes are set (whether
- to a new value or to the previous value), the bitmap and any
- associated contexts must be cleared back to their initial state and
- reinitialized with the newly specified coordinate space
- dimensions.</p>
+ <p>When the <code><a href=#the-canvas-element>canvas</a></code> element is created, and subsequently whenever the <code title=attr-canvas-width><a href=#attr-canvas-width>width</a></code> and <code title=attr-canvas-height><a href=#attr-canvas-height>height</a></code>
+ attributes are set (whether to a new value or to the previous value), the bitmap and any
+ associated contexts must be cleared back to their initial state and reinitialized with the newly
+ specified coordinate space dimensions.</p>
- <p>When the canvas is initialized, its bitmap must be cleared to
- transparent black.</p>
+ <p>When the canvas is initialized, its bitmap must be cleared to transparent black.</p>
- <p>When a <code><a href=#the-canvas-element>canvas</a></code> element does not represent its
- <a href=#fallback-content>fallback content</a>, it <a href=#provides-a-paint-source>provides a paint
- source</a> whose width is the element's intrinsic width, whose
- height is the element's intrinsic height, and whose appearance is
- the element's bitmap.</p>
+ <p>When a <code><a href=#the-canvas-element>canvas</a></code> element does not represent its <a href=#fallback-content>fallback content</a>, it
+ <a href=#provides-a-paint-source>provides a paint source</a> whose width is the element's intrinsic width, whose height is
+ the element's intrinsic height, and whose appearance is the element's bitmap.</p>
- <p>The <dfn id=dom-canvas-width title=dom-canvas-width><code>width</code></dfn> and
- <dfn id=dom-canvas-height title=dom-canvas-height><code>height</code></dfn> IDL
- attributes must <a href=#reflect>reflect</a> the respective content
- attributes of the same name, with the same defaults.</p>
+ <p>The <dfn id=dom-canvas-width title=dom-canvas-width><code>width</code></dfn> and <dfn id=dom-canvas-height title=dom-canvas-height><code>height</code></dfn> IDL attributes must <a href=#reflect>reflect</a> the
+ respective content attributes of the same name, with the same defaults.</p>
</div>
@@ -36396,105 +36371,102 @@
<dd>
- <p>Returns an object that exposes an API for drawing on the
- canvas. The first argument specifies the desired API. Subsequent
- arguments are handled by that API.</p>
+ <p>Returns an object that exposes an API for drawing on the canvas. The first argument specifies
+ the desired API. Subsequent arguments are handled by that API.</p>
- <p>This specification defines the "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" context below. There is also
- a specification that defines a "<code title=canvas-context-webgl>webgl</code>" context. <a href=#refsWEBGL>[WEBGL]</a></p>
+ <p>This specification defines the "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" context below.
+ There is also a specification that defines a "<code title=canvas-context-webgl>webgl</code>"
+ context. <a href=#refsWEBGL>[WEBGL]</a></p>
- <p>The list of defined contexts is given on the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki
- CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a>
+ <p>The list of defined contexts is given on the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a>
- <p>Returns null if the given context ID is not supported or if the
- canvas has already been initialized with some other (incompatible)
- context type (e.g. trying to get a "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" context after getting a
- "<code title=canvas-context-webgl>webgl</code>" context).</p>
+ <p>Returns null if the given context ID is not supported or if the canvas has already been
+ initialized with some other (incompatible) context type (e.g. trying to get a "<code title=canvas-context-2d><a href=#canvas-context-2d>2d</a></code>" context after getting a "<code title=canvas-context-webgl>webgl</code>" context).</p>
</dd>
+ <dt><var title="">context</var> = <var title="">canvas</var> . <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext</a></code>(<var title="">contextId</var> [, ... ])</dt>
+
+ <dd>
+
+ <p>Returns false if calling <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> with the
+ same arguments would definitely return null, and true otherwise.</p>
+
+ <p>This return value is not a guarantee that <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> will or will not return an object, as
+ conditions (e.g. availability of system resources) can vary over time.</p>
+
+ </dd>
+
</dl><div class=impl>
- <p>A <code><a href=#the-canvas-element>canvas</a></code> element can have a <dfn id=primary-context>primary
- context</dfn>, which is the first context to have been obtained for
- that element. When created, a <code><a href=#the-canvas-element>canvas</a></code> element must not
- have a <a href=#primary-context>primary context</a>.</p>
+ <p>A <code><a href=#the-canvas-element>canvas</a></code> element can have a <dfn id=primary-context>primary context</dfn>, which is the first context
+ to have been obtained for that element. When created, a <code><a href=#the-canvas-element>canvas</a></code> element must not have
+ a <a href=#primary-context>primary context</a>.</p>
- <p>The <dfn id=dom-canvas-getcontext title=dom-canvas-getContext><code>getContext(<var title="">contextId</var>, <var title="">arguments...</var>)</code></dfn> method of the
- <code><a href=#the-canvas-element>canvas</a></code> element, when invoked, must run the following
- steps:</p>
+ <p>The <dfn id=dom-canvas-getcontext title=dom-canvas-getContext><code>getContext(<var title="">contextId</var>, <var title="">arguments...</var>)</code></dfn> method of the <code><a href=#the-canvas-element>canvas</a></code> element, when invoked,
+ must run the following steps:</p>
- <ol><li><p>Let <var title="">contextId</var> be the first argument to
- the method.</li>
+ <ol><li><p>Let <var title="">contextId</var> be the first argument to the method.</li>
<li>
- <p>If <var title="">contextId</var> is not the name of a context
- supported by the user agent, return null and abort these
- steps.</p>
+ <p>If <var title="">contextId</var> is not the name of a context supported by the user agent,
+ return null and abort these steps.</p>
- <p class=note>An example of this would be a user agent that
- theoretically supports the "<code title=canvas-context-webgl>webgl</code>" 3D context, in the case
- where the platform does not have hardware support for OpenGL and
- the user agent does not have a software OpenGL implementation.
- Despite the user agent recognising the "<code title=canvas-context-webgl>webgl</code>" name, it would return
- null at this step because that context is not, in practice,
- supported at the time of the call.</p>
+ <p class=note>An example of this would be a user agent that theoretically supports the "<code title=canvas-context-webgl>webgl</code>" 3D context, in the case where the platform does not
+ have hardware support for OpenGL and the user agent does not have a software OpenGL
+ implementation. Despite the user agent recognising the "<code title=canvas-context-webgl>webgl</code>" name, it would return null at this step because that
+ context is not, in practice, supported at the time of the call.</p>
</li>
- <li><p>If the element has a <a href=#primary-context>primary context</a> and that
- context's entry in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki
- CanvasContexts page</a> does not list <var title="">contextId</var>
- as a context with which it is compatible, return null and abort
- these steps. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></li>
+ <li><p>If the element has a <a href=#primary-context>primary context</a> and that context's entry in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki CanvasContexts page</a> does not
+ list <var title="">contextId</var> as a context with which it is compatible, return null and
+ abort these steps. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></li>
- <li><p>If the element does not have a <a href=#primary-context>primary context</a>,
- let the element's <a href=#primary-context>primary context</a> be <var title="">contextId</var>.</li>
+ <li><p>If the element does not have a <a href=#primary-context>primary context</a>, let the element's
+ <a href=#primary-context>primary context</a> be <var title="">contextId</var>.</li>
- <li><p>If the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> method has
- already been invoked on this element for the same <var title="">contextId</var>, return the same object as was returned
- that time, and abort these steps. The additional arguments are
- ignored.</li>
+ <li><p>If the <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> method has already been
+ invoked on this element for the same <var title="">contextId</var>, return the same object as was
+ returned that time, and abort these steps. The additional arguments are ignored.</li>
- <li><p><dfn id=getcontext-return title=getContext-return>Return a new object for <var title="">contextId</var></dfn>, as defined by the specification
- given for <var title="">contextId</var>'s entry in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki
- CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></li>
+ <li><p><dfn id=getcontext-return title=getContext-return>Return a new object for <var title="">contextId</var></dfn>, as defined by the specification given for <var title="">contextId</var>'s entry in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></li>
- </ol><p>New context types may be registered in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki
- CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
+ </ol><p>The <dfn id=dom-canvas-supportscontext title=dom-canvas-supportsContext><code>supportContext(<var title="">contextId</var>,
+ <var title="">arguments...</var>)</code></dfn> method of the <code><a href=#the-canvas-element>canvas</a></code> element, when
+ invoked, must return false if calling <code title=dom-canvas-getContext><a href=#dom-canvas-getcontext>getContext()</a></code> on
+ the same object and with the same arguments would definitely return null at this time, and true
+ otherwise.</p>
- <p>Anyone is free to edit the WHATWG Wiki CanvasContexts page at any
- time to add a new context type. These new context types must be
- specified with the following information:</p>
+ <p>New context types may be registered in the <a href=http://wiki.whatwg.org/wiki/CanvasContexts>WHATWG Wiki CanvasContexts page</a>. <a href=#refsWHATWGWIKI>[WHATWGWIKI]</a></p>
+ <p>Anyone is free to edit the WHATWG Wiki CanvasContexts page at any time to add a new context
+ type. These new context types must be specified with the following information:</p>
+
<dl><dt>Keyword</dt>
- <dd><p>The value of <var title="">contextID</var> that will return
- the object for the new API.</dd>
+ <dd><p>The value of <var title="">contextID</var> that will return the object for the new
+ API.</dd>
<dt>Specification</dt>
- <dd><p>A link to a formal specification of the context type's
- API. It could be another page on the Wiki, or a link to an external
- page. If the type does not have a formal specification, an informal
- description can be substituted until such time as a formal
- specification is available.</dd>
+ <dd><p>A link to a formal specification of the context type's API. It could be another page on
+ the Wiki, or a link to an external page. If the type does not have a formal specification, an
+ informal description can be substituted until such time as a formal specification is
+ available.</dd>
<dt>Compatible with</dt>
- <dd><p>The list of context types that are compatible with this one
- (i.e. that operate on the same underlying bitmap). This list must
- be transitive and symmetric; if one context type is defined as
- compatible with another, then all types it is compatible with must
- be compatible with all types the other is compatible with.</dd>
+ <dd><p>The list of context types that are compatible with this one (i.e. that operate on the same
+ underlying bitmap). This list must be transitive and symmetric; if one context type is defined as
+ compatible with another, then all types it is compatible with must be compatible with all types
+ the other is compatible with.</dd>
- </dl><p>Vendors may also define experimental contexts using the syntax
- <code><var title="">vendorname</var>-<var title="">context</var></code>, for example,
- <code>moz-3d</code>. Such contexts should be registered in the
- WHATWG Wiki CanvasContexts page.</p>
+ </dl><p>Vendors may also define experimental contexts using the syntax <code><var title="">vendorname</var>-<var title="">context</var></code>, for example, <code>moz-3d</code>.
+ Such contexts should be registered in the WHATWG Wiki CanvasContexts page.</p>
</div>
Modified: source
===================================================================
--- source 2012-10-19 23:02:56 UTC (rev 7481)
+++ source 2012-10-22 23:36:56 UTC (rev 7482)
@@ -42343,114 +42343,87 @@
void <span title="dom-canvas-toBlobHD">toBlobHD</span>(<span>FileCallback</span>? _callback, optional DOMString type, any... arguments);
object? <span title="dom-canvas-getContext">getContext</span>(DOMString contextId, any... arguments);
+ boolean <span title="dom-canvas-supportsContext">supportsContext</span>(DOMString contextId, any... arguments);
};</pre>
</dd>
</dl><!--REMOVE-TOPIC:DOM APIs-->
- <p>The <code>canvas</code> element provides scripts with a
- resolution-dependent bitmap canvas, which can be used for rendering
- graphs, game graphics, art, or other visual images on the fly.</p>
+ <p>The <code>canvas</code> element provides scripts with a resolution-dependent bitmap canvas,
+ which can be used for rendering graphs, game graphics, art, or other visual images on the fly.</p>
- <p>Authors should not use the <code>canvas</code> element in a
- document when a more suitable element is available. For example, it
- is inappropriate to use a <code>canvas</code> element to render a
- page heading: if the desired presentation of the heading is
- graphically intense, it should be marked up using appropriate
- elements (typically <code>h1</code>) and then styled using CSS and
- supporting technologies such as XBL.</p>
+ <p>Authors should not use the <code>canvas</code> element in a document when a more suitable
+ element is available. For example, it is inappropriate to use a <code>canvas</code> element to
+ render a page heading: if the desired presentation of the heading is graphically intense, it
+ should be marked up using appropriate elements (typically <code>h1</code>) and then styled using
+ CSS and supporting technologies such as XBL.</p>
- <p>When authors use the <code>canvas</code> element, they must also
- provide content that, when presented to the user, conveys
- essentially the same function or purpose as the bitmap canvas. This
- content may be placed as content of the <code>canvas</code>
- element. The contents of the <code>canvas</code> element, if any,
- are the element's <span>fallback content</span>.</p>
+ <p>When authors use the <code>canvas</code> element, they must also provide content that, when
+ presented to the user, conveys essentially the same function or purpose as the bitmap canvas. This
+ content may be placed as content of the <code>canvas</code> element. The contents of the
+ <code>canvas</code> element, if any, are the element's <span>fallback content</span>.</p>
- <p>In interactive visual media, if <span
- title="concept-n-script">scripting is enabled</span> for the
- <code>canvas</code> element, and if support for <code>canvas</code>
- elements has been enabled, the <code>canvas</code> element
- <span>represents</span> <span>embedded content</span> consisting of
- a dynamically created image.</p>
+ <p>In interactive visual media, if <span title="concept-n-script">scripting is enabled</span> for
+ the <code>canvas</code> element, and if support for <code>canvas</code> elements has been enabled,
+ the <code>canvas</code> element <span>represents</span> <span>embedded content</span> consisting
+ of a dynamically created image.</p>
- <p>In non-interactive, static, visual media, if the
- <code>canvas</code> element has been previously painted on (e.g. if
- the page was viewed in an interactive visual medium and is now being
- printed, or if some script that ran during the page layout process
- painted on the element), then the <code>canvas</code> element
- <span>represents</span> <span>embedded content</span> with the
- current image and size. Otherwise, the element represents its
- <span>fallback content</span> instead.</p>
-
- <p>In non-visual media, and in visual media if <span
- title="concept-n-noscript">scripting is disabled</span> for the
- <code>canvas</code> element or if support for <code>canvas</code>
- elements has been disabled, the <code>canvas</code> element
- <span>represents</span> its <span>fallback content</span>
+ <p>In non-interactive, static, visual media, if the <code>canvas</code> element has been
+ previously painted on (e.g. if the page was viewed in an interactive visual medium and is now
+ being printed, or if some script that ran during the page layout process painted on the element),
+ then the <code>canvas</code> element <span>represents</span> <span>embedded content</span> with
+ the current image and size. Otherwise, the element represents its <span>fallback content</span>
instead.</p>
+ <p>In non-visual media, and in visual media if <span title="concept-n-noscript">scripting is
+ disabled</span> for the <code>canvas</code> element or if support for <code>canvas</code> elements
+ has been disabled, the <code>canvas</code> element <span>represents</span> its <span>fallback
+ content</span> instead.</p>
+
<!-- CANVAS-FOCUS-FALLBACK -->
- <p>When a <code>canvas</code> element <span>represents</span>
- <span>embedded content</span>, the user can still focus descendants
- of the <code>canvas</code> element (in the <span>fallback
- content</span>). When an element is focused, it is the target of
- keyboard interaction events (even though the element itself is not
- visible). This allows authors to make an interactive canvas
- keyboard-accessible: authors should have a one-to-one mapping of
- interactive regions to focusable elements in the <span>fallback
- content</span>. (Focus has no effect on mouse interaction
- events.) <a href="#refsDOMEVENTS">[DOMEVENTS]</a></p>
+ <p>When a <code>canvas</code> element <span>represents</span> <span>embedded content</span>, the
+ user can still focus descendants of the <code>canvas</code> element (in the <span>fallback
+ content</span>). When an element is focused, it is the target of keyboard interaction events (even
+ though the element itself is not visible). This allows authors to make an interactive canvas
+ keyboard-accessible: authors should have a one-to-one mapping of interactive regions to focusable
+ elements in the <span>fallback content</span>. (Focus has no effect on mouse interaction events.)
+ <a href="#refsDOMEVENTS">[DOMEVENTS]</a></p>
- <p>The <code>canvas</code> element has two attributes to control the
- size of the coordinate space: <dfn
- title="attr-canvas-width"><code>width</code></dfn> and <dfn
- title="attr-canvas-height"><code>height</code></dfn>. These
- attributes, when specified, must have values that are <span
- title="valid non-negative integer">valid non-negative
- integers</span>. <span class="impl">The <span>rules for parsing
- non-negative integers</span> must be used to obtain their numeric
- values. If an attribute is missing, or if parsing its value returns
- an error, then the default value must be used instead.</span> The
- <code title="attr-canvas-width">width</code> attribute defaults to
- 300, and the <code title="attr-canvas-height">height</code>
- attribute defaults to 150.</p>
+ <p>The <code>canvas</code> element has two attributes to control the size of the coordinate space:
+ <dfn title="attr-canvas-width"><code>width</code></dfn> and <dfn
+ title="attr-canvas-height"><code>height</code></dfn>. These attributes, when specified, must have
+ values that are <span title="valid non-negative integer">valid non-negative integers</span>. <span
+ class="impl">The <span>rules for parsing non-negative integers</span> must be used to obtain their
+ numeric values. If an attribute is missing, or if parsing its value returns an error, then the
+ default value must be used instead.</span> The <code title="attr-canvas-width">width</code>
+ attribute defaults to 300, and the <code title="attr-canvas-height">height</code> attribute
+ defaults to 150.</p>
- <p>The intrinsic dimensions of the <code>canvas</code> element equal
- the size of the coordinate space, with the numbers interpreted in
- CSS pixels. However, the element can be sized arbitrarily by a
- style sheet. During rendering, the image is scaled to fit this layout
- size.</p>
+ <p>The intrinsic dimensions of the <code>canvas</code> element equal the size of the coordinate
+ space, with the numbers interpreted in CSS pixels. However, the element can be sized arbitrarily
+ by a style sheet. During rendering, the image is scaled to fit this layout size.</p>
<div class="impl">
- <p>The size of the coordinate space does not necessarily represent
- the size of the actual bitmap that the user agent will use
- internally or during rendering. On high-definition displays, for
- instance, the user agent may internally use a bitmap with two device
- pixels per unit in the coordinate space, so that the rendering
- remains at high quality throughout.</p>
+ <p>The size of the coordinate space does not necessarily represent the size of the actual bitmap
+ that the user agent will use internally or during rendering. On high-definition displays, for
+ instance, the user agent may internally use a bitmap with two device pixels per unit in the
+ coordinate space, so that the rendering remains at high quality throughout.</p>
- <p>When the <code>canvas</code> element is created, and subsequently
- whenever the <code title="attr-canvas-width">width</code> and <code
- title="attr-canvas-height">height</code> attributes are set (whether
- to a new value or to the previous value), the bitmap and any
- associated contexts must be cleared back to their initial state and
- reinitialized with the newly specified coordinate space
- dimensions.</p>
+ <p>When the <code>canvas</code> element is created, and subsequently whenever the <code
+ title="attr-canvas-width">width</code> and <code title="attr-canvas-height">height</code>
+ attributes are set (whether to a new value or to the previous value), the bitmap and any
+ associated contexts must be cleared back to their initial state and reinitialized with the newly
+ specified coordinate space dimensions.</p>
- <p>When the canvas is initialized, its bitmap must be cleared to
- transparent black.</p>
+ <p>When the canvas is initialized, its bitmap must be cleared to transparent black.</p>
- <p>When a <code>canvas</code> element does not represent its
- <span>fallback content</span>, it <span>provides a paint
- source</span> whose width is the element's intrinsic width, whose
- height is the element's intrinsic height, and whose appearance is
- the element's bitmap.</p>
+ <p>When a <code>canvas</code> element does not represent its <span>fallback content</span>, it
+ <span>provides a paint source</span> whose width is the element's intrinsic width, whose height is
+ the element's intrinsic height, and whose appearance is the element's bitmap.</p>
- <p>The <dfn title="dom-canvas-width"><code>width</code></dfn> and
- <dfn title="dom-canvas-height"><code>height</code></dfn> IDL
- attributes must <span>reflect</span> the respective content
- attributes of the same name, with the same defaults.</p>
+ <p>The <dfn title="dom-canvas-width"><code>width</code></dfn> and <dfn
+ title="dom-canvas-height"><code>height</code></dfn> IDL attributes must <span>reflect</span> the
+ respective content attributes of the same name, with the same defaults.</p>
</div>
@@ -42474,135 +42447,128 @@
<dd>
- <p>Returns an object that exposes an API for drawing on the
- canvas. The first argument specifies the desired API. Subsequent
- arguments are handled by that API.</p>
+ <p>Returns an object that exposes an API for drawing on the canvas. The first argument specifies
+ the desired API. Subsequent arguments are handled by that API.</p>
- <p>This specification defines the "<code
- title="canvas-context-2d">2d</code>" context below. There is also
- a specification that defines a "<code
- title="canvas-context-webgl">webgl</code>" context. <a
- href="#refsWEBGL">[WEBGL]</a></p>
+ <p>This specification defines the "<code title="canvas-context-2d">2d</code>" context below.
+ There is also a specification that defines a "<code title="canvas-context-webgl">webgl</code>"
+ context. <a href="#refsWEBGL">[WEBGL]</a></p>
<p>The list of defined contexts is given on the <a
- href="http://wiki.whatwg.org/wiki/CanvasContexts">WHATWG Wiki
- CanvasContexts page</a>. <a
+ href="http://wiki.whatwg.org/wiki/CanvasContexts">WHATWG Wiki CanvasContexts page</a>. <a
href="#refsWHATWGWIKI">[WHATWGWIKI]</a>
- <p>Returns null if the given context ID is not supported or if the
- canvas has already been initialized with some other (incompatible)
- context type (e.g. trying to get a "<code
- title="canvas-context-2d">2d</code>" context after getting a
- "<code title="canvas-context-webgl">webgl</code>" context).</p>
+ <p>Returns null if the given context ID is not supported or if the canvas has already been
+ initialized with some other (incompatible) context type (e.g. trying to get a "<code
+ title="canvas-context-2d">2d</code>" context after getting a "<code
+ title="canvas-context-webgl">webgl</code>" context).</p>
</dd>
+ <dt><var title="">context</var> = <var title="">canvas</var> . <code title="dom-canvas-getContext">getContext</code>(<var title="">contextId</var> [, ... ])</dt>
+
+ <dd>
+
+ <p>Returns false if calling <code title="dom-canvas-getContext">getContext()</code> with the
+ same arguments would definitely return null, and true otherwise.</p>
+
+ <p>This return value is not a guarantee that <code
+ title="dom-canvas-getContext">getContext()</code> will or will not return an object, as
+ conditions (e.g. availability of system resources) can vary over time.</p>
+
+ </dd>
+
</dl>
<div class="impl">
- <p>A <code>canvas</code> element can have a <dfn>primary
- context</dfn>, which is the first context to have been obtained for
- that element. When created, a <code>canvas</code> element must not
- have a <span>primary context</span>.</p>
+ <p>A <code>canvas</code> element can have a <dfn>primary context</dfn>, which is the first context
+ to have been obtained for that element. When created, a <code>canvas</code> element must not have
+ a <span>primary context</span>.</p>
- <p>The <dfn title="dom-canvas-getContext"><code>getContext(<var
- title="">contextId</var>, <var
- title="">arguments...</var>)</code></dfn> method of the
- <code>canvas</code> element, when invoked, must run the following
- steps:</p>
+ <p>The <dfn title="dom-canvas-getContext"><code>getContext(<var title="">contextId</var>, <var
+ title="">arguments...</var>)</code></dfn> method of the <code>canvas</code> element, when invoked,
+ must run the following steps:</p>
<ol>
- <li><p>Let <var title="">contextId</var> be the first argument to
- the method.</p></li>
+ <li><p>Let <var title="">contextId</var> be the first argument to the method.</p></li>
<li>
- <p>If <var title="">contextId</var> is not the name of a context
- supported by the user agent, return null and abort these
- steps.</p>
+ <p>If <var title="">contextId</var> is not the name of a context supported by the user agent,
+ return null and abort these steps.</p>
- <p class="note">An example of this would be a user agent that
- theoretically supports the "<code
- title="canvas-context-webgl">webgl</code>" 3D context, in the case
- where the platform does not have hardware support for OpenGL and
- the user agent does not have a software OpenGL implementation.
- Despite the user agent recognising the "<code
- title="canvas-context-webgl">webgl</code>" name, it would return
- null at this step because that context is not, in practice,
- supported at the time of the call.</p>
+ <p class="note">An example of this would be a user agent that theoretically supports the "<code
+ title="canvas-context-webgl">webgl</code>" 3D context, in the case where the platform does not
+ have hardware support for OpenGL and the user agent does not have a software OpenGL
+ implementation. Despite the user agent recognising the "<code
+ title="canvas-context-webgl">webgl</code>" name, it would return null at this step because that
+ context is not, in practice, supported at the time of the call.</p>
</li>
- <li><p>If the element has a <span>primary context</span> and that
- context's entry in the <a
- href="http://wiki.whatwg.org/wiki/CanvasContexts">WHATWG Wiki
- CanvasContexts page</a> does not list <var title="">contextId</var>
- as a context with which it is compatible, return null and abort
- these steps. <a href="#refsWHATWGWIKI">[WHATWGWIKI]</a></p></li>
+ <li><p>If the element has a <span>primary context</span> and that context's entry in the <a
+ href="http://wiki.whatwg.org/wiki/CanvasContexts">WHATWG Wiki CanvasContexts page</a> does not
+ list <var title="">contextId</var> as a context with which it is compatible, return null and
+ abort these steps. <a href="#refsWHATWGWIKI">[WHATWGWIKI]</a></p></li>
- <li><p>If the element does not have a <span>primary context</span>,
- let the element's <span>primary context</span> be <var
- title="">contextId</var>.</p></li>
+ <li><p>If the element does not have a <span>primary context</span>, let the element's
+ <span>primary context</span> be <var title="">contextId</var>.</p></li>
- <li><p>If the <code
- title="dom-canvas-getContext">getContext()</code> method has
- already been invoked on this element for the same <var
- title="">contextId</var>, return the same object as was returned
- that time, and abort these steps. The additional arguments are
- ignored.</p></li>
+ <li><p>If the <code title="dom-canvas-getContext">getContext()</code> method has already been
+ invoked on this element for the same <var title="">contextId</var>, return the same object as was
+ returned that time, and abort these steps. The additional arguments are ignored.</p></li>
<li><p><dfn title="getContext-return">Return a new object for <var
- title="">contextId</var></dfn>, as defined by the specification
- given for <var title="">contextId</var>'s entry in the <a
- href="http://wiki.whatwg.org/wiki/CanvasContexts">WHATWG Wiki
- CanvasContexts page</a>. <a
+ title="">contextId</var></dfn>, as defined by the specification given for <var
+ title="">contextId</var>'s entry in the <a
+ href="http://wiki.whatwg.org/wiki/CanvasContexts">WHATWG Wiki CanvasContexts page</a>. <a
href="#refsWHATWGWIKI">[WHATWGWIKI]</a></p></li>
</ol>
+ <p>The <dfn title="dom-canvas-supportsContext"><code>supportContext(<var title="">contextId</var>,
+ <var title="">arguments...</var>)</code></dfn> method of the <code>canvas</code> element, when
+ invoked, must return false if calling <code title="dom-canvas-getContext">getContext()</code> on
+ the same object and with the same arguments would definitely return null at this time, and true
+ otherwise.</p>
+
<p>New context types may be registered in the <a
- href="http://wiki.whatwg.org/wiki/CanvasContexts">WHATWG Wiki
- CanvasContexts page</a>. <a
+ href="http://wiki.whatwg.org/wiki/CanvasContexts">WHATWG Wiki CanvasContexts page</a>. <a
href="#refsWHATWGWIKI">[WHATWGWIKI]</a></p>
- <p>Anyone is free to edit the WHATWG Wiki CanvasContexts page at any
- time to add a new context type. These new context types must be
- specified with the following information:</p>
+ <p>Anyone is free to edit the WHATWG Wiki CanvasContexts page at any time to add a new context
+ type. These new context types must be specified with the following information:</p>
<dl>
<dt>Keyword</dt>
- <dd><p>The value of <var title="">contextID</var> that will return
- the object for the new API.</p></dd>
+ <dd><p>The value of <var title="">contextID</var> that will return the object for the new
+ API.</p></dd>
<dt>Specification</dt>
- <dd><p>A link to a formal specification of the context type's
- API. It could be another page on the Wiki, or a link to an external
- page. If the type does not have a formal specification, an informal
- description can be substituted until such time as a formal
- specification is available.</p></dd>
+ <dd><p>A link to a formal specification of the context type's API. It could be another page on
+ the Wiki, or a link to an external page. If the type does not have a formal specification, an
+ informal description can be substituted until such time as a formal specification is
+ available.</p></dd>
<dt>Compatible with</dt>
- <dd><p>The list of context types that are compatible with this one
- (i.e. that operate on the same underlying bitmap). This list must
- be transitive and symmetric; if one context type is defined as
- compatible with another, then all types it is compatible with must
- be compatible with all types the other is compatible with.</p></dd>
+ <dd><p>The list of context types that are compatible with this one (i.e. that operate on the same
+ underlying bitmap). This list must be transitive and symmetric; if one context type is defined as
+ compatible with another, then all types it is compatible with must be compatible with all types
+ the other is compatible with.</p></dd>
</dl>
- <p>Vendors may also define experimental contexts using the syntax
- <code><var title="">vendorname</var>-<var
- title="">context</var></code>, for example,
- <code>moz-3d</code>. Such contexts should be registered in the
- WHATWG Wiki CanvasContexts page.</p>
+ <p>Vendors may also define experimental contexts using the syntax <code><var
+ title="">vendorname</var>-<var title="">context</var></code>, for example, <code>moz-3d</code>.
+ Such contexts should be registered in the WHATWG Wiki CanvasContexts page.</p>
</div>
More information about the Commit-Watchers
mailing list