Skip to content

Commit

Permalink
Change the way that paths work to be compatible with safari
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@115 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Aug 29, 2006
1 parent eda2def commit 36dafaf
Show file tree
Hide file tree
Showing 2 changed files with 288 additions and 197 deletions.
250 changes: 144 additions & 106 deletions index
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

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

<h2 class="no-num no-toc" id="working">Working Draft &mdash; 21 August
<h2 class="no-num no-toc" id="working">Working Draft &mdash; 29 August
2006</h2>

<p>You can take part in this work. <a
Expand Down Expand Up @@ -1723,49 +1723,72 @@ and suggestions on this to the list, btw).
determining the <em><a href="#origin">origin</a></em> of a particular
piece of content depends on the nature of the content.

<p>For <code>Document</code>s:
<p class="big-issue">...</p>
<!--
XXX this is a very confused section, so I've commented it out

<p>For <code>Document</code>s:</p>

<dl class="switch">
<dt>If it was served over the network using HTTP, HTTPS, FTP, or another
protocol whose scheme contains a <em>host authority component</em>:

<dt>If it was served over the network using HTTP, HTTPS, FTP, or
another protocol whose scheme contains a <em>host authority
component</em>:</dt>

<dd>
<p>The resource's origin consists of the scheme, host, and port parts of
the resource's full URI.</p>

<p>The resource's origin consists of the scheme, host, and port
parts of the resource's full URI.</p>

<p class="example">For example, if a Web page has the address
<code>https://www.example.com/demo.html</code>, the origin consists of
the tuple "https", "www.example.com", and "443".</p>
<code>https://www.example.com/demo.html</code>, the origin
consists of the tuple "https", "www.example.com", and "443".</p>

<dt>If it was created by script...
</dd>

<dt>If it was created by script...</dt>

<dd>
<p>The resource's origin consists of the scheme, host, and port parts of
the resource's full URI.</p>

<p>The resource's origin consists of the scheme, host, and port
parts of the resource's full URI.</p>

<p class="example">For example, if a Web page has the address
<code>https://www.example.com/demo.html</code>, the origin consists of
the tuple "https", "www.example.com", and "443".</p>
<code>https://www.example.com/demo.html</code>, the origin
consists of the tuple "https", "www.example.com", and "443".</p>

</dd>


<dt>A document resource (a <code>Document</code>) that was served over the
network using HTTP, HTTPS, FTP, or another protocol whose scheme contains
a <em>host authority component</em>:
<dt>A document resource (a <code>Document</code>) that was served
over the network using HTTP, HTTPS, FTP, or another protocol whose
scheme contains a <em>host authority component</em>:</dt>

<dd>
<p>The resource's origin consists of the scheme, host, and port parts of
the resource's full URI.</p>

<p>The resource's origin consists of the scheme, host, and port
parts of the resource's full URI.</p>

<p class="example">For example, if a Web page has the address
<code>https://www.example.com/demo.html</code>, the origin consists of
the tuple "https", "www.example.com", and "443".</p>
<code>https://www.example.com/demo.html</code>, the origin
consists of the tuple "https", "www.example.com", and "443".</p>

</dd>

<dt>If the content was generated by script:
<dt>If the content was generated by script:</dt>

<dd>The content shares the same origin as the script itself.
<dd>The content shares the same origin as the script itself.</dd>

<dt>If the content was generated by

<dt>If the content was generated by
</dl>


what other kinds of content do we care about the origin of?
images, for the purpose of <canvas>?
Window objects?
-->

<p>The <dfn id="domain" title="document's domain">domain of a
<code>Document</code> object</dfn> is the domain given by the
<code>hostname</code> attribute of the <code><a
Expand Down Expand Up @@ -1860,14 +1883,13 @@ and suggestions on this to the list, btw).
NodeList <span title="dom-document-getElementsByClassName"><a href="#getelementsbyclassname">getElementsByClassName</a></span>(in DOMString className1 [, in DOMString className2, ...] );

<span><a href="#selection1">Selection</a></span> <span title="dom-document-getSelection"><a href="#getselection0">getSelection</a></span>();
readonly attribute HTMLCollection <span title="dom-document-commands"><a href="#commands0">commands</a></span>;
readonly attribute <span>HTMLCollection</span> <span title="dom-document-commands"><a href="#commands0">commands</a></span>;

// <span title="contenteditable"><a href="#contenteditable">editing</a></span>:
attribute boolean <span title="dom-document-designMode">designMode</span>;
boolean <span title="dom-document-execCommand"><a href="#execcommand">execCommand</a></span>(in DOMString commandID);
boolean <span title="dom-document-execCommand"><a href="#execcommand">execCommand</a></span>(in DOMString commandID, in boolean doShowUI);
boolean <span title="dom-document-execCommand"><a href="#execcommand">execCommand</a></span>(in DOMString commandID, in boolean doShowUI, in DOMString value);

<!-- lots of other stuff to come XXX
see e.g. http://lxr.mozilla.org/seamonkey/source/dom/public/idl/html/nsIDOMNSHTMLDocument.idl -->
};</pre>
Expand All @@ -1878,7 +1900,7 @@ and suggestions on this to the list, btw).
<!--
XXX also, document.body might need to point to the first <frameset>
in framed pages -->
<!-- implied window.open() call when parsing starts, not when
<!-- implied document.open() call when parsing starts, not when
.write() called; xref to parsing section -->

<p>The <dfn id="getelementsbyclassname"
Expand Down Expand Up @@ -16143,117 +16165,133 @@ interface <dfn id="imagedata">ImageData</dfn> {
<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>.

<p>A <dfn id="path">path</dfn> has a list of subpaths and a current
position. Each subpath consists of a list of points, some of which may be
connected by straight and curved lines, and a flag indicating whether the
subpath is closed or not.
<p>A <dfn id="path">path</dfn> has a list of zero or more subpaths. Each
subpath consists of a list of one or more points, connected by straight or
curved lines, and a flag indicating whether the subpath is closed or not.
A closed subpath is one where the last point of the subpath is connected
to the first point of the subpath by a straight line. Subpaths with fewer
than two points are ignored when painting the path.

<p>The <dfn id="beginpath"><code>beginPath()</code></dfn> method resets the
list of subpaths to an empty list, and calls <code><a
href="#movetox">moveTo()</a></code> with the point (0,0). When the context
is created, a call to <code><a href="#beginpath">beginPath()</a></code> is
implied.
<p>Initially, the context's path must have zero subpaths.

<p>The <dfn id="movetox" title="moveTo"><code>moveTo(x, y)</code></dfn>
method sets the current position to the given coordinate and creates a new
subpath with that point as its first (and only) point. If there was a
previous subpath, and it consists of just one point, then that subpath is
removed from the path.
<p>The <dfn id="beginpath"><code>beginPath()</code></dfn> method must empty
the list of subpaths so that the context once again has zero subpaths.

<p>The <dfn id="closepath"><code>closePath()</code></dfn> method adds a
straight line from the current position to the first point in the last
subpath and marks the subpath as closed, if the last subpath isn't closed,
and if it has more than one point in its list of points. If the last
subpath is not open or has only one point, it does nothing.
<p>The <dfn id="movetox" title="moveTo"><code>moveTo(x, y)</code></dfn>
method must create a new subpath with the specified point as its first
(and only) point.

<p>The <dfn id="closepath"><code>closePath()</code></dfn> method must do
nothing if the context has no subpaths. Otherwise, it must mark the last
subpath as closed, create a new subpath whose first point is the same as
the previous subpath's first point, and finally add this new subpath to
the path. (If the last subpath had more than one point in its list of
points, then this is equivalent to adding a straight line connecting the
last point back to the first point, thus "closing" the shape, and then
repeating the last <code><a href="#movetox">moveTo()</a></code> call.)

<p>New points and the lines connecting them are added to subpaths using the
methods described below. In all cases, the methods only modify the last
subpath in the context's paths.

<p>The <dfn id="linetox" title="lineTo"><code>lineTo(x, y)</code></dfn>
method adds the given coordinate (<var title="">x</var>, <var
title="">y</var>) to the list of points of the subpath, and connects the
current position to that point with a straight line. It then sets the
current position to the given coordinate (<var title="">x</var>, <var
title="">y</var>).
method must do nothing if the context has no subpaths. Otherwise, it must
connect the last point in the subpath to the given point (<var
title="">x</var>, <var title="">y</var>) using a straight line, and must
then add the given point (<var title="">x</var>, <var title="">y</var>) to
the subpath.

<p>The <dfn id="quadraticcurvetocpx"
title="quadraticCurveTo"><code>quadraticCurveTo(cpx, cpy, x,
y)</code></dfn> method adds the given coordinate (<var title="">x</var>,
<var title="">y</var>) to the list of points of the subpath, and connects
the current position to that point with a quadratic curve with control
point (<var title="">cpx</var>, <var title="">cpy</var>). It then sets the
current position to the given coordinate (<var title="">x</var>, <var
title="">y</var>).
y)</code></dfn> method must do nothing if the context has no subpaths.
Otherwise it must connect the last point in the subpath to the given point
(<var title="">x</var>, <var title="">y</var>) by a quadratic curve with
control point (<var title="">cpx</var>, <var title="">cpy</var>), and must
then add the given point (<var title="">x</var>, <var title="">y</var>) to
the subpath.

<p>The <dfn id="beziercurvetocp1x"
title="bezierCurveTo"><code>bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x,
y)</code></dfn> method adds the given coordinate (<var title="">x</var>,
<var title="">y</var>) to the list of points of the subpath, and connects
the two points with a bezier curve with control points (<var
title="">cp1x</var>, <var title="">cp1y</var>) and (<var
title="">cp2x</var>, <var title="">cp2y</var>). It then sets the current
position to the given coordinate (<var title="">x</var>, <var
title="">y</var>).
y)</code></dfn> method must do nothing if the context has no subpaths.
Otherwise, it must connect the last point in the subpath to the given
point (<var title="">x</var>, <var title="">y</var>) using a bezier curve
with control points (<var title="">cp1x</var>, <var title="">cp1y</var>)
and (<var title="">cp2x</var>, <var title="">cp2y</var>). Then, it must
add the point (<var title="">x</var>, <var title="">y</var>) to the
subpath.

<p>The <dfn id="arctox1" title="arcTo"><code>arcTo(x1, y1, x2, y2,
radius)</code></dfn> method adds an arc to the current path. The arc is
given by the circle that has one point tangent to the line from the
current position to point (<var title="">x1</var>, <var
title="">y1</var>), one point tangent to the line from from the point
(<var title="">x1</var>, <var title="">y1</var>) to the point (<var
title="">x2</var>, <var title="">y2</var>), and that has radius <var
title="">radius</var>. The points at which this circle touches these two
lines are called the start and end tangent points respectively.
radius)</code></dfn> method must do nothing if the context has no
subpaths. If the context <em>does</em> have a subpath, then the behaviour
depends on the arguments and the last point in the subpath.

<p>Let the point (<var title="">x0</var>, <var title="">y0</var>) be the
last point in the subpath. Let <var title="">The Arc</var> be the shortest
arc given by circumference of the circle that has one point tangent to the
line defined by the points (<var title="">x0</var>, <var
title="">y0</var>) and (<var title="">x1</var>, <var title="">y1</var>),
another point tangent to the line defined by the points (<var
title="">x1</var>, <var title="">y1</var>) and (<var title="">x2</var>,
<var title="">y2</var>), and that has radius <var title="">radius</var>.
The points at which this circle touches these two lines are called the
start and end tangent points respectively.

<p>If the point (<var title="">x2</var>, <var title="">y2</var>) is on the
line from the current position to point (<var title="">x1</var>, <var
title="">y1</var>) then this method does nothing. Otherwise, the arc is
the shortest path along the circle's circumference between those two
points. If the first tangent point is not equal to the current position
then the first tangent point is added to the list of points of the subpath
and the current position is joined to that point by a straight line. Then,
the second tangent point is added to the list of points and the two
tangent points are joined by the arc described above. Finally, the current
position is set to the second tangent point.
line defined by the points (<var title="">x0</var>, <var
title="">y0</var>) and (<var title="">x1</var>, <var title="">y1</var>)
then the method must do nothing, as no arc would satisfy the above
constraints.

<p>Otherwise, the method must connect the point (<var title="">x0</var>,
<var title="">y0</var>) to the start tangent point by a straight line,
then connect the start tangent point to the end tangent point by <var
title="">The Arc</var>, and finally add the start and end tangent points
to the subpath.

<p>Negative or zero values for <var title="">radius</var> must cause the
implementation to raise an <code>INDEX_SIZE_ERR</code> exception.

<p>The <dfn id="arcx-y" title="arc"><code>arc(x, y, radius, startAngle,
endAngle, anticlockwise)</code></dfn> method adds an arc to the current
path. The arc is given by the circle that has its origin at (<var
title="">x</var>, <var title="">y</var>) and that has radius <var
title="">radius</var>. The points at <var title="">startAngle</var> and
<var title="">endAngle</var> along the circle, measured in radians
clockwise from the positive x-axis, are the start and end points. The arc
is the path along the circumference of the circle from the start point to
the end point going anti-clockwise if the <var
title="">anticlockwise</var> argument is true, and clockwise otherwise.

<p>The start point is added to the list of points of the subpath and the
current position is joined to that point by a straight line. Then, the end
point is added to the list of points and these last two points are joined
by the arc described above. Finally, the current position is set to the
end point.
endAngle, anticlockwise)</code></dfn> method draws an arc. If the context
has any subpaths, then the method must add a straight line from the last
point in the subpath to the start point of the arc. In any case, it must
draw the arc between the start point of the arc and the end point of the
arc, and add the start and end points of the arc to the subpath. The arc
and its start and end points are defined as follows:

<p>Consider a circle that has its origin at (<var title="">x</var>, <var
title="">y</var>) and that has radius <var title="">radius</var>. The
points at <var title="">startAngle</var> and <var title="">endAngle</var>
along the circle's circumference, measured in radians clockwise from the
positive x-axis, are the start and end points respectively. The arc is the
path along the circumference of this circle from the start point to the
end point, going anti-clockwise if the <var title="">anticlockwise</var>
argument is true, and clockwise otherwise.

<p>Negative or zero values for <var title="">radius</var> must cause the
implementation to raise an <code>INDEX_SIZE_ERR</code> exception.

<p>The <dfn id="rectx" title="rect"><code>rect(x, y, w, h)</code></dfn>
method creates a new subpath containing just the rectangle with top left
coordinate (<var title="">x</var>, <var title="">y</var>), width <var
title="">w</var> and height <var title="">h</var>, and marks it as closed.
It then calls <code><a href="#movetox">moveTo</a></code> with the point
(0,0).
method must create a new subpath containing just the four points (<var
title="">x</var>, <var title="">y</var>), (<var title="">x</var>+<var
title="">w</var>, <var title="">y</var>), (<var title="">x</var>+<var
title="">w</var>, <var title="">y</var>+<var title="">h</var>), (<var
title="">x</var>, <var title="">y</var>+<var title="">h</var>), with those
four points connected by straight lines, and must then mark the subpath as
closed. It must then create a new subpath with the point (<var
title="">x</var>, <var title="">y</var>) as the only point in the subpath.

<p>Negative values for <var title="">w</var> and <var title="">h</var> must
cause the implementation to raise an <code>INDEX_SIZE_ERR</code>
exception.

<p>The <dfn id="fill"><code>fill()</code></dfn> method fills each subpath
of the current path in turn, using <code><a
<p>The <dfn id="fill"><code>fill()</code></dfn> method must fill each
subpath of the current path in turn, using <code><a
href="#fillstyle">fillStyle</a></code>, and using the non-zero winding
number rule. Open subpaths are implicitly closed when being filled
number rule. Open subpaths must be implicitly closed when being filled
(without affecting the actual subpaths).

<p>The <dfn id="stroke"><code>stroke()</code></dfn> method strokes each
<p>The <dfn id="stroke"><code>stroke()</code></dfn> method must stroke each
subpath of the current path in turn, using the <code><a
href="#strokestyle">strokeStyle</a></code>, <code><a
href="#linewidth">lineWidth</a></code>, <code><a
Expand All @@ -16272,8 +16310,8 @@ interface <dfn id="imagedata">ImageData</dfn> {
<p>The <dfn id="clip"><code>clip()</code></dfn> method creates a new <dfn
id="clipping">clipping path</dfn> by calculating the intersection of the
current clipping path and the area described by the current path, using
the non-zero winding number rule. Open subpaths are implicitly closed
without affecting the actual subpaths).
the non-zero winding number rule. Open subpaths must be implicitly closed
when computing the clipping path, without affecting the actual subpaths.

<p>When the context is created, the initial clipping path is the rectangle
with the top left corner at (0,0) and the width and height of the
Expand Down
Loading

0 comments on commit 36dafaf

Please sign in to comment.