Skip to content
Permalink
Browse files
Bug 17954: Canvas arc() with radius of 0 throws exception
http://bugs.webkit.org/show_bug.cgi?id=17954

Reviewed by Antti

Simple fix -- use >= instead of > when validating the radius.


Canonical link: https://commits.webkit.org/24841@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@31162 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
ojhunt committed Mar 19, 2008
1 parent e9e34b2 commit f3ea7c34499f7608a5495ee681e2eb485a27e734
Showing 5 changed files with 26 additions and 4 deletions.
@@ -1,3 +1,13 @@
2008-03-19 Oliver Hunt <oliver@apple.com>

Reviewed by Antti.

Test case for Canvas.arc with zero-length radius needed to
be updated for current html5 spec.

* fast/canvas/canvas-with-incorrect-args-expected.txt:
* fast/canvas/canvas-with-incorrect-args.html:

2008-03-19 Justin Garcia <justin.garcia@apple.com>

Reviewed by Oliver.
@@ -14,7 +14,7 @@ PASS called rect 0*0 rect without throwing an exception.
UNDEFINED called rect with inf*inf rect without throwing an exception.
UNDEFINED threw exception code 1 on nan*nan rect.
PASS called fill with an empty path without throwing an exception.
PASS threw exception code 1 on arc with zero-length radius
PASS did not throw exception on arc with zero-length radius
PASS threw exception code 1 on arc with negative-length radius
UNDEFINED did not throw exception on arc with infinite radius
UNDEFINED threw exception code 1 on arc with nan-length radius
@@ -94,9 +94,9 @@
}
try {
context.arc(2, 2, 0, 0, 90, true);
fail("did not throw exception on arc with zero-length radius");
pass("did not throw exception on arc with zero-length radius");
} catch (e) {
pass("threw exception code " + e.code + " on arc with zero-length radius");
fail("threw exception code " + e.code + " on arc with zero-length radius");
}
try {
context.arc(2, 2, -10, 0, 90, true);
@@ -1,3 +1,15 @@
2008-03-19 Oliver Hunt <oliver@apple.com>

Reviewed by Antti.

Bug 17954: Canvas arc() with radius of 0 throws exception
http://bugs.webkit.org/show_bug.cgi?id=17954

Simple fix -- use >= instead of > when validating the radius.

* html/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::arc):

2008-03-19 Justin Garcia <justin.garcia@apple.com>

Reviewed by Oliver.
@@ -468,7 +468,7 @@ void CanvasRenderingContext2D::arcTo(float x0, float y0, float x1, float y1, flo
void CanvasRenderingContext2D::arc(float x, float y, float r, float sa, float ea, bool anticlockwise, ExceptionCode& ec)
{
ec = 0;
if (!(r > 0)) {
if (!(r >= 0)) {
ec = INDEX_SIZE_ERR;
return;
}

0 comments on commit f3ea7c3

Please sign in to comment.