Changeset 58381 in webkit
- Timestamp:
- Apr 27, 2010 10:42:51 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r58375 r58381 1 2010-04-27 Daniel Bates <dbates@rim.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=37686 6 7 Tests that strokeRect does not paint any artifacts when the 8 specified rectangle has height, width = 0 and lineWidth > 1. 9 10 Also tests that clearRect, fillRect, and rect are ignored when 11 height, width = 0. 12 13 * fast/canvas/canvas-clearRect-expected.txt: Added. 14 * fast/canvas/canvas-clearRect.html: Added. 15 * fast/canvas/canvas-fillRect-expected.txt: Added. 16 * fast/canvas/canvas-fillRect.html: Added. 17 * fast/canvas/canvas-modify-emptyPath-expected.txt: 18 * fast/canvas/canvas-strokeRect-expected.txt: Updated results. 19 * fast/canvas/script-tests/canvas-clearRect.js: Added. 20 * fast/canvas/script-tests/canvas-fillRect.js: Added. 21 * fast/canvas/script-tests/canvas-modify-emptyPath.js: Added test case. 22 * fast/canvas/script-tests/canvas-strokeRect.js: Ditto. Also, added 23 debug statements so as to distinguish the results for each test. 24 1 25 2010-04-27 Simon Fraser <simon.fraser@apple.com> 2 26 -
trunk/LayoutTests/fast/canvas/canvas-modify-emptyPath-expected.txt
r45973 r58381 6 6 Test lineTo 7 7 PASS getColor(40,40) is [0,128,0,255] 8 Test canvas.rect() with width = height = 0. 9 PASS getColor(1,1) is [0,0,0,0] 8 10 Test lineTo sequence 9 11 PASS getColor(0,0) is [255,0,0,255] -
trunk/LayoutTests/fast/canvas/canvas-strokeRect-expected.txt
r39080 r58381 4 4 5 5 6 Test canvas.strokeRect() with solid green. 6 7 PASS imgdata[4] is 0 7 8 PASS imgdata[5] is 128 8 9 PASS imgdata[6] is 0 10 Test canvas.strokeRect() with a pattern. 9 11 PASS imgdata[4] is 0 10 12 PASS imgdata[5] is 128 11 13 PASS imgdata[6] is 0 14 Test canvas.strokeRect() with a gradient. 12 15 PASS imgdata[4] is 0 13 16 PASS imgdata[5] is 128 14 17 PASS imgdata[6] is 0 18 Test canvas.strokeRect() with height = width = 0 and lineWidth = 2. 19 PASS imgdata[0] is 0 20 PASS imgdata[1] is 0 21 PASS imgdata[2] is 0 22 Test canvas.strokeRect() with height = width = 0, lineWidth = 2, and shadow. 23 PASS imgdata[0] is 0 24 PASS imgdata[1] is 0 25 PASS imgdata[2] is 0 15 26 PASS successfullyParsed is true 16 27 -
trunk/LayoutTests/fast/canvas/script-tests/canvas-modify-emptyPath.js
r48550 r58381 22 22 ctx.stroke(); 23 23 shouldBe("getColor(40,40)", "[0,128,0,255]"); 24 ctx.clearRect(0, 0, 300, 300); 25 26 // Test when create rectangle path using a rectangle with width = height = 0. 27 debug("Test canvas.rect() with width = height = 0."); 28 ctx.strokeStyle = 'red'; 29 ctx.lineWidth = 10; 30 ctx.beginPath(); 31 ctx.rect(0, 0, 0, 0); 32 ctx.stroke(); 33 shouldBe("getColor(1,1)", "[0,0,0,0]"); 24 34 ctx.clearRect(0, 0, 300, 300); 25 35 -
trunk/LayoutTests/fast/canvas/script-tests/canvas-strokeRect.js
r48550 r58381 3 3 4 4 // stroke rect with solid green 5 debug("Test canvas.strokeRect() with solid green."); 5 6 ctx.beginPath(); 6 7 ctx.strokeStyle = 'green'; … … 16 17 17 18 // stroke rect with a pattern 19 debug("Test canvas.strokeRect() with a pattern."); 18 20 var canvas2 = document.createElement('canvas'); 19 21 canvas2.width = 100; … … 35 37 36 38 // stroke rect with gradient 39 debug("Test canvas.strokeRect() with a gradient."); 37 40 var gradient = ctx.createLinearGradient(0, 0, 0, 100); 38 41 gradient.addColorStop(0, "green"); … … 47 50 shouldBe("imgdata[6]", "0"); 48 51 52 ctx.clearRect(0, 0, 100, 100); 53 54 // stroke rect with height = width = 0 and lineWidth = 2. 55 debug("Test canvas.strokeRect() with height = width = 0 and lineWidth = 2."); 56 ctx.strokeStyle = 'red'; 57 ctx.lineWidth = 2; 58 ctx.strokeRect(0, 0, 0, 0); 59 imageData = ctx.getImageData(0, 0, 1, 1); 60 imgdata = imageData.data; 61 shouldBe("imgdata[0]", "0"); 62 shouldBe("imgdata[1]", "0"); 63 shouldBe("imgdata[2]", "0"); 64 65 // stroke rect with height = width = 0, lineWidth = 2, and shadow. 66 debug("Test canvas.strokeRect() with height = width = 0, lineWidth = 2, and shadow."); 67 ctx.shadowOffsetX = 5; 68 ctx.shadowOffsetY = 5; 69 ctx.shadowColor = 'blue'; 70 ctx.strokeStyle = 'red'; 71 ctx.lineWidth = 2; 72 ctx.strokeRect(0, 0, 0, 0); 73 imageData = ctx.getImageData(0, 0, 1, 1); 74 imgdata = imageData.data; 75 shouldBe("imgdata[0]", "0"); 76 shouldBe("imgdata[1]", "0"); 77 shouldBe("imgdata[2]", "0"); 78 49 79 var successfullyParsed = true; -
trunk/WebCore/ChangeLog
r58379 r58381 1 2010-04-27 Daniel Bates <dbates@rim.com> 2 3 Reviewed by Oliver Hunt. 4 5 https://bugs.webkit.org/show_bug.cgi?id=37686 6 7 Fixes an issue where the canvas method strokeRect will stroke a 8 rectangle whose dimensions are 0 when lineWidth > 1. 9 10 As per the definition of strokeRect in the HTML Canvas 2D Context 11 spec. <http://www.w3.org/TR/2dcontext/#dom-context-2d-strokerect>, 12 this method should have no effect when both the height and width 13 are zero. 14 15 Tests: fast/canvas/canvas-clearRect.html 16 fast/canvas/canvas-fillRect.html 17 18 * html/canvas/CanvasRenderingContext2D.cpp: 19 (WebCore::validateRectForCanvas): Return false if height, width == 0. 20 1 21 2010-04-27 Adam Barth <abarth@webkit.org> 2 22 -
trunk/WebCore/html/canvas/CanvasRenderingContext2D.cpp
r57889 r58381 616 616 if (!isfinite(x) | !isfinite(y) | !isfinite(width) | !isfinite(height)) 617 617 return false; 618 618 619 if (!width && !height) 620 return false; 621 619 622 if (width < 0) { 620 623 width = -width;
Note: See TracChangeset
for help on using the changeset viewer.