Bug 663190 - Calling strokeRect with zero width or height should do nothing; r=smaug
authorMs2ger <ms2ger@gmail.com>
Sat, 11 Jun 2011 09:57:47 +0200
changeset 71417 68ea3c29fb0fe342b55c245e3f0bd87b3ced46f5
parent 71416 8b3315430b6d608ce0e3dca08490e48caeeb1243
child 71424 1af47b6ff5a5eab13ec09487ea6a622425030165
push id159
push usereakhgari@mozilla.com
push dateTue, 16 Aug 2011 17:53:11 +0000
treeherdermozilla-beta@8786e3e49240 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs663190
milestone7.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 663190 - Calling strokeRect with zero width or height should do nothing; r=smaug
content/canvas/src/nsCanvasRenderingContext2D.cpp
content/canvas/test/test_canvas.html
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -2023,16 +2023,19 @@ NS_IMETHODIMP
 nsCanvasRenderingContext2D::FillRect(float x, float y, float w, float h)
 {
     return DrawRect(gfxRect(x, y, w, h), STYLE_FILL);
 }
 
 NS_IMETHODIMP
 nsCanvasRenderingContext2D::StrokeRect(float x, float y, float w, float h)
 {
+    if (w == 0.f && h == 0.f) {
+        return NS_OK;
+    }
     return DrawRect(gfxRect(x, y, w, h), STYLE_STROKE);
 }
 
 //
 // path bits
 //
 
 NS_IMETHODIMP
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -18390,17 +18390,17 @@ function test_2d_strokeRect_zero_2() {
 var canvas = document.getElementById('c581');
 var ctx = canvas.getContext('2d');
 
 ctx.strokeStyle = '#f00';
 ctx.lineWidth = 250;
 ctx.lineCap = 'round';
 ctx.lineJoin = 'round';
 ctx.strokeRect(50, 25, 0, 0);
-todo_isPixel(ctx, 50,25, 0,0,0,0, 0);
+isPixel(ctx, 50,25, 0,0,0,0, 0);
 
 
 }
 </script>
 
 <!-- [[[ test_2d.strokeRect.zero.3.html ]]] -->
 
 <p>Canvas test: 2d.strokeRect.zero.3</p>