Skip to content

Commit

Permalink
Update <canvas> to be more normative; update patterns to start on coo…
Browse files Browse the repository at this point in the history
…rdinate system origin (should match mozilla/safari, and be implementable, unlike before); introduce a clause allowing hardware limitations to guide implementations; use that clause to allow arbitrary nesting depth limitations in html parser. Changes made in parallel, in response to requests from vlad (in bugzilla) and mrbkap (on IRC).

git-svn-id: http://svn.whatwg.org/webapps@6 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Mar 8, 2006
1 parent 89a273d commit ec528fd
Show file tree
Hide file tree
Showing 2 changed files with 179 additions and 108 deletions.
143 changes: 89 additions & 54 deletions index
Expand Up @@ -36,7 +36,7 @@

<h1 id="web-applications">Web Applications 1.0</h1>

<h2 class="no-num no-toc" id="working">Working Draft &mdash; 7 March 2006</h2>
<h2 class="no-num no-toc" id="working">Working Draft &mdash; 8 March 2006</h2>

<p>You can take part in this work. <a
href="http://www.whatwg.org/mailing-list">Join the working group's
Expand Down Expand Up @@ -836,10 +836,11 @@
<li><a href="#shadows"><span class="secno">6.1.1.6. </span><dfn
id="shadows0">Shadows</dfn></a>

<li><a href="#shapes"><span class="secno">6.1.1.7. </span>Shapes</a>

<li><a href="#simple"><span class="secno">6.1.1.7. </span>Simple
shapes (rectangles)</a>

<li><a href="#paths"><span class="secno">6.1.1.8. </span>Paths</a>
<li><a href="#complex"><span class="secno">6.1.1.8. </span>Complex
shapes (paths)</a>

<li><a href="#images"><span class="secno">6.1.1.9. </span>Images</a>

Expand Down Expand Up @@ -1456,6 +1457,11 @@ and suggestions on this to the list, btw).
particular, the algorithms defined in this specification are intended to
be easy to follow, and not intended to be performant.)

<p id="hardwareLimitations">User agents may impose implementation-specific
limits on otherwise unconstrained inputs, e.g. to prevent denial of
service attacks, to guard against running out of memory, or to work around
platform-specific limitations.

<p class="note">There is no implied relationship between document
conformance requirements and implementation conformance requirements. User
agents are not free to handle non-conformant documents as they please; the
Expand Down Expand Up @@ -1608,7 +1614,9 @@ and suggestions on this to the list, btw).
of any content inserted using <code>document.write()</code> and
<code>document.writeln()</code> calls. Other changes, including fragment
insertions involving <code>innerHTML</code> and similar attributes, must
fire mutation events. <a href="#refsDOM3Events">[DOM3EVENTS]</a>
fire mutation events. <a href="#refsDOM3Events">[DOM3EVENTS]</a></p>
<!-- XXX move
part of this to the parser section, other part to d.w section -->

<p id="default-content-style-type">The default value of
<code>Content-Style-Type</code> and the default value of the <code
Expand Down Expand Up @@ -14669,50 +14677,57 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {
id="transformations1">Transformations</dfn></h5>

<p>The transformation matrix is applied to all drawing operations prior to
their being rendered. It is also applied when creating the clip region.
their being rendered. It is also applied when creating the clip region.</p>
<!-- conformance criteria for actual drawing are
described in "drawing model" below -->

<p>When the context is created, the transformation matrix is initially the
identity transform. It may then be adjusted using the three transformation
methods.
<p>When the context is created, the transformation matrix must initially be
the identity transform. It may then be adjusted using the three
transformation methods.

<p>The transformations are performed in reverse order. For instance, if a
scale transformation that doubles the width is applied, followed by a
<p>The transformations must be performed in reverse order. For instance, if
a scale transformation that doubles the width is applied, followed by a
rotation transformation that rotates drawing operations by a quarter turn,
and a rectangle twice as wide as it is tall is then drawn on the canvas,
the actual result will be a square.

<p>The <dfn id="scalex" title="scale"><code>scale(x, y)</code></dfn> method
adds a scaling transformation to the transformation matrix. The
<code>x</code> argument represents the scale factor in the horizontal
direction and the <code>y</code> argument represents the scale factor in
the vertical direction. The factors are multiples.
must add the scaling transformation described by the arguments to the
transformation matrix. The <code>x</code> argument represents the scale
factor in the horizontal direction and the <code>y</code> argument
represents the scale factor in the vertical direction. The factors are
multiples.

<p>The <dfn id="rotateangle"
title="rotate"><code>rotate(angle)</code></dfn> method adds a rotation
transformation to the transformation matrix. The <code>angle</code>
argument represents a clockwise rotation angle expressed in radians.
title="rotate"><code>rotate(angle)</code></dfn> method must add the
rotation transformation described by the argument to the transformation
matrix. The <code>angle</code> argument represents a clockwise rotation
angle expressed in radians.

<p>The <dfn id="translatex" title="translate"><code>translate(x,
y)</code></dfn> method adds a translating transformation to the
transformation matrix. The <code>x</code> argument represents the
translation distance in the horizontal direction and the <code>y</code>
argument represents the translation distance in the vertical direction.
The arguments are in coordinate space units.
y)</code></dfn> method must add the translation transformation described
by the arguments to the transformation matrix. The <code>x</code> argument
represents the translation distance in the horizontal direction and the
<code>y</code> argument represents the translation distance in the
vertical direction. The arguments are in coordinate space units.

<h5 id="compositing"><span class="secno">6.1.1.3. </span>Compositing</h5>

<p>All drawing operations are affected by the global compositing
attributes, <code><a href="#globalalpha">globalAlpha</a></code> and
<code><a
href="#globalcompositeoperation">globalCompositeOperation</a></code>.
href="#globalcompositeoperation">globalCompositeOperation</a></code>.</p>
<!-- conformance criteria for painting are described in the "drawing
model" section below -->

<p>The <dfn id="globalalpha"><code>globalAlpha</code></dfn> attribute gives
an alpha value that is applied to shapes and images before they are
composited onto the canvas. The valid range of values is from 0.0 (fully
transparent) to 1.0 (no additional transparency). If the attribute is set
to values outside this range, they are ignored. When the context is
created, the <code><a href="#globalalpha">globalAlpha</a></code> attribute
must initially have the value 1.0.
transparent) to 1.0 (no additional transparency). If an attempt is made to
set the attribute to a value outside this range, the attribute must retain
its previous value. When the context is created, the <code><a
href="#globalalpha">globalAlpha</a></code> attribute must initially have
the value 1.0.

<p>The <dfn
id="globalcompositeoperation"><code>globalCompositeOperation</code></dfn>
Expand Down Expand Up @@ -14801,8 +14816,8 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {
use this syntax.
</dl>

<p>If the user agent does not recognise the specified value, it must be
ignored, leaving the value of <code><a
<p>On setting, if the user agent does not recognise the specified value, it
must be ignored, leaving the value of <code><a
href="#globalcompositeoperation">globalCompositeOperation</a></code>
unaffected.

Expand Down Expand Up @@ -14945,15 +14960,16 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {
href="#canvaspattern0">CanvasPattern</a></code> object suitably
initialised.

<p>Patterns are painted so that the first image is centered in the middle
of the coordinate space, and images are then repeated horizontally to the
left and right (if the <code>repeat-x</code> string was specified) or
vertically up and down (if the <code>repeat-y</code> string was specified)
or in all four directions all over the canvas (if the <code>repeat</code>
string was specified). The images are not be scaled by this process; one
CSS pixel of the image must be painted on one coordinate space unit. Of
course, patterns must only actually painted where the stroking or filling
effect requires that they be drawn.
<p>Patterns are painted so that the top left of the first image is anchored
at the origin of the coordinate space, and images are then repeated
horizontally to the left and right (if the <code>repeat-x</code> string
was specified) or vertically up and down (if the <code>repeat-y</code>
string was specified) or in all four directions all over the canvas (if
the <code>repeat</code> string was specified). The images are not be
scaled by this process; one CSS pixel of the image must be painted on one
coordinate space unit. Of course, patterns must only actually painted
where the stroking or filling effect requires that they be drawn, and are
affected by the current transformation matrix.

<p>Support for patterns is optional. If the user agent doesn't support
patterns, then <code><a
Expand All @@ -14963,7 +14979,7 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {

<p>The <dfn id="linewidth"><code>lineWidth</code></dfn> attribute gives the
default width of lines, in coordinate space units. On setting, zero and
negative values are ignored, and leave the value unchanged.
negative values must be ignored, leaving the value unchanged.

<p>When the context is created, the <code><a
href="#linewidth">lineWidth</a></code> attribute must initially have the
Expand All @@ -14980,7 +14996,7 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {
line width and the width of half the line width, placed flat against the
edge perpendicular to the direction of the line. On setting, any other
value than the literal strings <code>butt</code>, <code>round</code>, and
<code>square</code> are ignored and leave the value unchanged.
<code>square</code> must be ignored, leaving the value unchanged.

<p>When the context is created, the <code><a
href="#linecap">lineCap</a></code> attribute must initially have the value
Expand All @@ -14992,8 +15008,8 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {
<code>miter</code>.

<p>On setting, any other value than the literal strings <code>round</code>,
<code>bevel</code> and <code>miter</code> are ignored and leave the value
unchanged.
<code>bevel</code> and <code>miter</code> must be ignored, leaving the
value unchanged.

<p>When the context is created, the <code><a
href="#linejoin">lineJoin</a></code> attribute must initially have the
Expand Down Expand Up @@ -15023,7 +15039,7 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {

<p>The miter limit ratio can be explicitly set using the <dfn
id="miterlimit"><code>miterLimit</code></dfn> attribute. On setting, zero
and negative values are ignored, and leave the value unchanged.
and negative values must be ignored, leaving the value unchanged.

<p>When the context is created, the <code><a
href="#miterlimit">miterLimit</a></code> attribute must initially have the
Expand All @@ -15039,7 +15055,7 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {
the colour of the shadow.

<p>When the context is created, the <code><a
href="#shadowcolor">shadowColor</a></code> attribute initially is
href="#shadowcolor">shadowColor</a></code> attribute initially must be
fully-transparent black.

<p>The <dfn id="shadowoffsetx"><code>shadowOffsetX</code></dfn> and <dfn
Expand All @@ -15053,7 +15069,7 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {

<p>The <dfn id="shadowblur"><code>shadowBlur</code></dfn> attribute
specifies the number of coordinate space units that the blurring should
cover. On setting, negative numbers are ignored and leave the attribute
cover. On setting, negative numbers must be ignored, leaving the attribute
unmodified.

<p>When the context is created, the <code><a
Expand All @@ -15062,7 +15078,8 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {

<p>Support for shadows is optional.

<h5 id="shapes"><span class="secno">6.1.1.7. </span>Shapes</h5>
<h5 id="simple"><span class="secno">6.1.1.7. </span>Simple shapes
(rectangles)</h5>

<p>There are three methods that immediately draw rectangles to the bitmap.
They each take four arguments; the first two give the <var
Expand Down Expand Up @@ -15096,7 +15113,7 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {
href="#linejoin">lineJoin</a></code>, and (if appropriate) <code><a
href="#miterlimit">miterLimit</a></code> attributes.

<h5 id="paths"><span class="secno">6.1.1.8. </span>Paths</h5>
<h5 id="complex"><span class="secno">6.1.1.8. </span>Complex shapes (paths)</h5>

<p>The context always has a current path. There is only one current path,
it is not part of the <span><a href="#drawing0">drawing state</a></span>.
Expand Down Expand Up @@ -15299,19 +15316,22 @@ interface <dfn id="canvaspattern">CanvasPattern</dfn> {
<ol>
<li>The coordinates are transformed by the current transformation matrix.

<li>The shape or image is rendered, creating image <var title="">A</var>.
<li>The shape or image is rendered, creating image <var title="">A</var>,
as described in the previous sections. For shapes, the current fill,
stroke, and line styles must be honoured.

<li>The shadow is rendered from image <var title="">A</var>, creating
image <var title="">B</var>.
<li>The shadow is rendered from image <var title="">A</var>, using the
current shadow styles, creating image <var title="">B</var>.

<li>Image <var title="">A</var> is composited over image <var
title="">B</var> creating the source image.

<li>The source image has its alpha adjusted by <code><a
href="#globalalpha">globalAlpha</a></code>.

<li>Within the clip region, the source image is composited over the
current canvas bitmap using the composition operator.
<li>Within the clip region (as affected by the current transformation
matrix), the source image is composited over the current canvas bitmap
using the current composition operator.
</ol>

<h4 id="the-3d"><span class="secno">6.1.2. </span>The 3D context</h4>
Expand Down Expand Up @@ -18548,6 +18568,13 @@ function receiver(e) {
They still form part of the algorithm that implementations are required to
implement to claim conformance.

<p class="note">The algorithm described below places no limit on the depth
of the DOM tree generated, or on the length of tag names, attribute names,
attribute values, text nodes, etc. While implementators are encouraged to
avoid arbitrary limits, it is recognised that <a
href="#hardwareLimitations">practical concerns</a> will likely force user
agents to impose nesting depths.

<h5 id="the-initial"><span class="secno">8.2.2.1. </span><dfn
id="the-initial1">The initial phase</dfn></h5>

Expand Down Expand Up @@ -20174,7 +20201,7 @@ function receiver(e) {
"section", "nav", "article", "aside", "header", "footer", "datagrid",
"command"

<dd> <!-- XXXXXXXXX -->
<dd> <!-- XXXX -->
<p class="big-issue">Work in progress!</p>

<dt>A start tag token not covered by the previous entries
Expand Down Expand Up @@ -21018,6 +21045,14 @@ see also CTextToken::ConsumeCharacterData() for CDATA parsing?
1913 // such cases. So, let's simulate that effect for compatibility.
1914 // Ex. <html><body>Hello</P>There</body></html>
http://lxr.mozilla.org/mozilla/source/parser/htmlparser/src/CNavDTD.cpp#1912

http://lxr.mozilla.org/seamonkey/search?string=nested
/parser/htmlparser/src/CNavDTD.cpp, line 791 -- * 2. <CENTER><DL><DT><A><CENTER> allow nested <CENTER>
/parser/htmlparser/src/CNavDTD.cpp, line 792 -- * 3. <TABLE><TR><TD><TABLE>... allow nested <TABLE>
/parser/htmlparser/src/CNavDTD.cpp, line 2562 -- // Discard nested forms - bug 72639
/parser/htmlparser/src/nsElementTable.cpp, line 1453 -- * 2. <CENTER><DL><DT><A><CENTER> allow nested <CENTER>
/parser/htmlparser/src/nsElementTable.cpp, line 1454 -- * 3. <TABLE><TR><TD><TABLE>... allow nested <TABLE>
/parser/htmlparser/src/nsElementTable.cpp, line 1901 -- // Ex: <H1><LI><H1><LI>. Inner LI has the potential of getting nested
-->

<h3 id="namespaces"><span class="secno">8.3. </span>Namespaces</h3>
Expand Down

0 comments on commit ec528fd

Please sign in to comment.