whatwg/html

Editorial: define arc() and ellipse() in terms of shared steps

annevk committed Jan 12, 2018
1 parent 25c1eef commit af11308332a82f8bc548b3d52f701973575f205f
Showing with 19 additions and 12 deletions.
1. +19 −12 source
31 source
 @@ -61725,27 +61725,34 @@ try {

The arc(x, y, radius, startAngle, endAngle, anticlockwise) and ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) methods draw arcs.

The arc(x, y, radius, startAngle, endAngle, anticlockwise) method, when invoked, must run the ellipse method steps with this, x, y, radius, radius, 0, startAngle, endAngle, and anticlockwise.

The arc() method is equivalent to the ellipse() method in the case where the two radii are equal. When the arc() method is invoked, it must act as if the ellipse() method had been invoked with the radiusX and radiusY arguments set to the value of the radius argument, the rotation argument set to zero, and the other arguments set to the same values as their identically named arguments on the arc() method.

This makes it equivalent to ellipse() except that both radii are equal and rotation is 0.

The ellipse() method, when invoked, must run these steps:

The ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, anticlockwise) method, when invoked, must run the ellipse method steps with this, x, y, radiusX, radiusY, rotation, startAngle, endAngle, and anticlockwise.

The ellipse method steps, given canvasPath, x, y, radiusX, radiusY, rotation, startAngle, endAngle, and anticlockwise, are:

1. If any of the arguments are infinite or NaN, then return.

2. If either radiusX or radiusY are negative, then throw an "IndexSizeError" DOMException.

3. If the object's path has any subpaths, then add a straight line from the last point in the subpath to the start point of the arc.

4. If canvasPath's path has any subpaths, then add a straight line from the last point in the subpath to the start point of the arc.

5. Add the start and end points of the arc to the subpath, and connect them with an arc. The arc