<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre, #msg p { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[31162] trunk</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/31162">31162</a></dd>
<dt>Author</dt> <dd>oliver@apple.com</dd>
<dt>Date</dt> <dd>2008-03-19 15:28:07 -0700 (Wed, 19 Mar 2008)</dd>
</dl>

<h3>Log Message</h3>
<pre>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 &gt;= instead of &gt; when validating the radius.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastcanvascanvaswithincorrectargsexpectedtxt">trunk/LayoutTests/fast/canvas/canvas-with-incorrect-args-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcanvascanvaswithincorrectargshtml">trunk/LayoutTests/fast/canvas/canvas-with-incorrect-args.html</a></li>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorehtmlCanvasRenderingContext2Dcpp">trunk/WebCore/html/CanvasRenderingContext2D.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (31161 => 31162)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2008-03-19 21:57:10 UTC (rev 31161)
+++ trunk/LayoutTests/ChangeLog        2008-03-19 22:28:07 UTC (rev 31162)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2008-03-19  Oliver Hunt  &lt;oliver@apple.com&gt;
+
+        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:
+
</ins><span class="cx"> 2008-03-19  Justin Garcia  &lt;justin.garcia@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Oliver.
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvascanvaswithincorrectargsexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/canvas-with-incorrect-args-expected.txt (31161 => 31162)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/canvas-with-incorrect-args-expected.txt        2008-03-19 21:57:10 UTC (rev 31161)
+++ trunk/LayoutTests/fast/canvas/canvas-with-incorrect-args-expected.txt        2008-03-19 22:28:07 UTC (rev 31162)
</span><span class="lines">@@ -14,7 +14,7 @@
</span><span class="cx"> UNDEFINED called rect with inf*inf rect without throwing an exception.
</span><span class="cx"> UNDEFINED threw exception code 1 on nan*nan rect.
</span><span class="cx"> PASS called fill with an empty path without throwing an exception.
</span><del>-PASS threw exception code 1 on arc with zero-length radius
</del><ins>+PASS did not throw exception on arc with zero-length radius
</ins><span class="cx"> PASS threw exception code 1 on arc with negative-length radius
</span><span class="cx"> UNDEFINED did not throw exception on arc with infinite radius
</span><span class="cx"> UNDEFINED threw exception code 1 on arc with nan-length radius
</span></span></pre></div>
<a id="trunkLayoutTestsfastcanvascanvaswithincorrectargshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/canvas/canvas-with-incorrect-args.html (31161 => 31162)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/canvas/canvas-with-incorrect-args.html        2008-03-19 21:57:10 UTC (rev 31161)
+++ trunk/LayoutTests/fast/canvas/canvas-with-incorrect-args.html        2008-03-19 22:28:07 UTC (rev 31162)
</span><span class="lines">@@ -94,9 +94,9 @@
</span><span class="cx">     }
</span><span class="cx">     try {
</span><span class="cx">         context.arc(2, 2, 0, 0, 90, true);
</span><del>-        fail(&quot;did not throw exception on arc with zero-length radius&quot;);
</del><ins>+        pass(&quot;did not throw exception on arc with zero-length radius&quot;);
</ins><span class="cx">     } catch (e) {
</span><del>-        pass(&quot;threw exception code &quot; + e.code + &quot; on arc with zero-length radius&quot;);    
</del><ins>+        fail(&quot;threw exception code &quot; + e.code + &quot; on arc with zero-length radius&quot;);    
</ins><span class="cx">     }
</span><span class="cx">     try {
</span><span class="cx">         context.arc(2, 2, -10, 0, 90, true);
</span></span></pre></div>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (31161 => 31162)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2008-03-19 21:57:10 UTC (rev 31161)
+++ trunk/WebCore/ChangeLog        2008-03-19 22:28:07 UTC (rev 31162)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2008-03-19  Oliver Hunt  &lt;oliver@apple.com&gt;
+
+        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 &gt;= instead of &gt; when validating the radius.
+
+        * html/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::arc):
+
</ins><span class="cx"> 2008-03-19  Justin Garcia  &lt;justin.garcia@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reviewed by Oliver.
</span></span></pre></div>
<a id="trunkWebCorehtmlCanvasRenderingContext2Dcpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/html/CanvasRenderingContext2D.cpp (31161 => 31162)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/html/CanvasRenderingContext2D.cpp        2008-03-19 21:57:10 UTC (rev 31161)
+++ trunk/WebCore/html/CanvasRenderingContext2D.cpp        2008-03-19 22:28:07 UTC (rev 31162)
</span><span class="lines">@@ -468,7 +468,7 @@
</span><span class="cx"> void CanvasRenderingContext2D::arc(float x, float y, float r, float sa, float ea, bool anticlockwise, ExceptionCode&amp; ec)
</span><span class="cx"> {
</span><span class="cx">     ec = 0;
</span><del>-    if (!(r &gt; 0)) {
</del><ins>+    if (!(r &gt;= 0)) {
</ins><span class="cx">         ec = INDEX_SIZE_ERR;
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>