Diff
Modified: trunk/LayoutTests/ChangeLog (141611 => 141612)
--- trunk/LayoutTests/ChangeLog 2013-02-01 19:00:13 UTC (rev 141611)
+++ trunk/LayoutTests/ChangeLog 2013-02-01 19:04:43 UTC (rev 141612)
@@ -1,3 +1,33 @@
+2013-02-01 Rashmi Shyamasundar <rashmi...@samsung.com>
+
+ Zero size gradient should paint nothing on canvas
+ https://bugs.webkit.org/show_bug.cgi?id=102654
+
+ Reviewed by Dirk Schulze.
+
+ The functions fill(), fillText(), stroke(), strokeRect() and strokeText()
+ should paint nothing on canvas when the canvas fillStyle/strokeStyle
+ is set to a zero size gradient.
+
+ * fast/canvas/canvas-fill-zeroSizeGradient-expected.txt: Added.
+ * fast/canvas/canvas-fill-zeroSizeGradient.html: Added.
+ * fast/canvas/canvas-fillRect-zeroSizeGradient-expected.txt: Added.
+ * fast/canvas/canvas-fillRect-zeroSizeGradient.html: Added.
+ * fast/canvas/canvas-fillText-zeroSizeGradient-expected.txt: Added.
+ * fast/canvas/canvas-fillText-zeroSizeGradient.html: Added.
+ * fast/canvas/canvas-stroke-zeroSizeGradient-expected.txt: Added.
+ * fast/canvas/canvas-stroke-zeroSizeGradient.html: Added.
+ * fast/canvas/canvas-strokeRect-zeroSizeGradient-expected.txt: Added.
+ * fast/canvas/canvas-strokeRect-zeroSizeGradient.html: Added.
+ * fast/canvas/canvas-strokeText-zeroSizeGradient-expected.txt: Added.
+ * fast/canvas/canvas-strokeText-zeroSizeGradient.html: Added.
+ * fast/canvas/script-tests/canvas-fill-zeroSizeGradient.js: Added.
+ * fast/canvas/script-tests/canvas-fillRect-zeroSizeGradient.js: Added.
+ * fast/canvas/script-tests/canvas-fillText-zeroSizeGradient.js: Added.
+ * fast/canvas/script-tests/canvas-stroke-zeroSizeGradient.js: Added.
+ * fast/canvas/script-tests/canvas-strokeRect-zeroSizeGradient.js: Added.
+ * fast/canvas/script-tests/canvas-strokeText-zeroSizeGradient.js: Added.
+
2013-02-01 Rouslan Solomakhin <rous...@chromium.org>
[Chromium] Expect spellcheck to ignore whitespace
Added: trunk/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient-expected.txt (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient-expected.txt 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,12 @@
+Series of tests to ensure that fill() paints nothing on canvas when the fillStyle is set to a zero-size gradient.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imgdata[0] is 0
+PASS imgdata[1] is 255
+PASS imgdata[2] is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient.html (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient.html 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/canvas/canvas-fill-zeroSizeGradient.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient-expected.txt (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient-expected.txt 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,12 @@
+Series of tests to ensure that fillRect() paints nothing on canvas when the fillStyle is set to a zero-size gradient.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imgdata[0] is 0
+PASS imgdata[1] is 255
+PASS imgdata[2] is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient.html (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient.html 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/canvas/canvas-fillRect-zeroSizeGradient.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient-expected.txt (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient-expected.txt 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,12 @@
+Series of tests to ensure that fillText() paints nothing on canvas when the fillStyle is set to a zero-size gradient.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imgdata[0] is 0
+PASS imgdata[1] is 255
+PASS imgdata[2] is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient.html (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient.html 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/canvas/canvas-fillText-zeroSizeGradient.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/canvas/canvas-stroke-zeroSizeGradient-expected.txt (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-stroke-zeroSizeGradient-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-stroke-zeroSizeGradient-expected.txt 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,12 @@
+Series of tests to ensure that stroke() paints nothing on canvas when the strokeStyle is set to a zero-size gradient.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imgdata[0] is 0
+PASS imgdata[1] is 255
+PASS imgdata[2] is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/canvas-stroke-zeroSizeGradient.html (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-stroke-zeroSizeGradient.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-stroke-zeroSizeGradient.html 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/canvas/canvas-stroke-zeroSizeGradient.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/canvas/canvas-strokeRect-zeroSizeGradient-expected.txt (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-strokeRect-zeroSizeGradient-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-strokeRect-zeroSizeGradient-expected.txt 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,12 @@
+Series of tests to ensure that strokeRect() paints nothing on canvas when the strokeStyle is set to a zero-size gradient.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imgdata[0] is 0
+PASS imgdata[1] is 255
+PASS imgdata[2] is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/canvas-strokeRect-zeroSizeGradient.html (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-strokeRect-zeroSizeGradient.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-strokeRect-zeroSizeGradient.html 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/canvas/canvas-strokeRect-zeroSizeGradient.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/canvas/canvas-strokeText-zeroSizeGradient-expected.txt (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-strokeText-zeroSizeGradient-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-strokeText-zeroSizeGradient-expected.txt 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,12 @@
+Series of tests to ensure that strokeText() paints nothing on canvas when the strokeStyle is set to a zero-size gradient.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS imgdata[0] is 0
+PASS imgdata[1] is 255
+PASS imgdata[2] is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/canvas-strokeText-zeroSizeGradient.html (0 => 141612)
--- trunk/LayoutTests/fast/canvas/canvas-strokeText-zeroSizeGradient.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-strokeText-zeroSizeGradient.html 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/canvas/canvas-strokeText-zeroSizeGradient.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/canvas/script-tests/canvas-fill-zeroSizeGradient.js (0 => 141612)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-fill-zeroSizeGradient.js (rev 0)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-fill-zeroSizeGradient.js 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,18 @@
+description("Series of tests to ensure that fill() paints nothing on canvas when the fillStyle is set to a zero-size gradient.");
+var ctx = document.createElement('canvas').getContext('2d');
+
+ctx.fillStyle = '#0f0';
+ctx.fillRect(0, 0, 1, 1);
+
+var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction);
+g.addColorStop(0, '#f00');
+g.addColorStop(1, '#f00');
+ctx.fillStyle = g;
+ctx.rect(0, 0, 1 ,1);
+ctx.fill();
+
+var imageData = ctx.getImageData(0, 0, 1, 1);
+var imgdata = imageData.data;
+shouldBe("imgdata[0]", "0");
+shouldBe("imgdata[1]", "255");
+shouldBe("imgdata[2]", "0");
Added: trunk/LayoutTests/fast/canvas/script-tests/canvas-fillRect-zeroSizeGradient.js (0 => 141612)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-fillRect-zeroSizeGradient.js (rev 0)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-fillRect-zeroSizeGradient.js 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,17 @@
+description("Series of tests to ensure that fillRect() paints nothing on canvas when the fillStyle is set to a zero-size gradient.");
+var ctx = document.createElement('canvas').getContext('2d');
+
+ctx.fillStyle = '#0f0';
+ctx.fillRect(0, 0, 1, 1);
+
+var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction);
+g.addColorStop(0, '#f00');
+g.addColorStop(1, '#f00');
+ctx.fillStyle = g;
+ctx.fillRect(0, 0, 1 ,1);
+
+var imageData = ctx.getImageData(0, 0, 1, 1);
+var imgdata = imageData.data;
+shouldBe("imgdata[0]", "0");
+shouldBe("imgdata[1]", "255");
+shouldBe("imgdata[2]", "0");
Added: trunk/LayoutTests/fast/canvas/script-tests/canvas-fillText-zeroSizeGradient.js (0 => 141612)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-fillText-zeroSizeGradient.js (rev 0)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-fillText-zeroSizeGradient.js 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,19 @@
+description("Series of tests to ensure that fillText() paints nothing on canvas when the fillStyle is set to a zero-size gradient.");
+var ctx = document.createElement('canvas').getContext('2d');
+
+ctx.fillStyle = '#0f0';
+ctx.fillRect(0, 0, 1, 1);
+
+var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction);
+g.addColorStop(0, '#f00');
+g.addColorStop(1, '#f00');
+ctx.fillStyle = g;
+ctx.font = '1px sans-serif';
+ctx.fillText("AA", 0, 1);
+
+var imageData = ctx.getImageData(0, 0, 1, 1);
+var imgdata = imageData.data;
+shouldBe("imgdata[0]", "0");
+shouldBe("imgdata[1]", "255");
+shouldBe("imgdata[2]", "0");
+
Added: trunk/LayoutTests/fast/canvas/script-tests/canvas-stroke-zeroSizeGradient.js (0 => 141612)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-stroke-zeroSizeGradient.js (rev 0)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-stroke-zeroSizeGradient.js 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,18 @@
+description("Series of tests to ensure that stroke() paints nothing on canvas when the strokeStyle is set to a zero-size gradient.");
+var ctx = document.createElement('canvas').getContext('2d');
+
+ctx.fillStyle = '#0f0';
+ctx.fillRect(0, 0, 1, 1);
+
+var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction);
+g.addColorStop(0, '#f00');
+g.addColorStop(1, '#f00');
+ctx.strokeStyle = g;
+ctx.rect(0, 0, 1 ,1);
+ctx.stroke();
+
+var imageData = ctx.getImageData(0, 0, 1, 1);
+var imgdata = imageData.data;
+shouldBe("imgdata[0]", "0");
+shouldBe("imgdata[1]", "255");
+shouldBe("imgdata[2]", "0");
Added: trunk/LayoutTests/fast/canvas/script-tests/canvas-strokeRect-zeroSizeGradient.js (0 => 141612)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-strokeRect-zeroSizeGradient.js (rev 0)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-strokeRect-zeroSizeGradient.js 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,17 @@
+description("Series of tests to ensure that strokeRect() paints nothing on canvas when the strokeStyle is set to a zero-size gradient.");
+var ctx = document.createElement('canvas').getContext('2d');
+
+ctx.fillStyle = '#0f0';
+ctx.fillRect(0, 0, 1, 1);
+
+var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction);
+g.addColorStop(0, '#f00');
+g.addColorStop(1, '#f00');
+ctx.strokeStyle = g;
+ctx.strokeRect(0, 0, 1 ,1);
+
+var imageData = ctx.getImageData(0, 0, 1, 1);
+var imgdata = imageData.data;
+shouldBe("imgdata[0]", "0");
+shouldBe("imgdata[1]", "255");
+shouldBe("imgdata[2]", "0");
Added: trunk/LayoutTests/fast/canvas/script-tests/canvas-strokeText-zeroSizeGradient.js (0 => 141612)
--- trunk/LayoutTests/fast/canvas/script-tests/canvas-strokeText-zeroSizeGradient.js (rev 0)
+++ trunk/LayoutTests/fast/canvas/script-tests/canvas-strokeText-zeroSizeGradient.js 2013-02-01 19:04:43 UTC (rev 141612)
@@ -0,0 +1,19 @@
+description("Series of tests to ensure that strokeText() paints nothing on canvas when the strokeStyle is set to a zero-size gradient.");
+var ctx = document.createElement('canvas').getContext('2d');
+
+ctx.fillStyle = '#0f0';
+ctx.fillRect(0, 0, 1, 1);
+
+var g = ctx.createLinearGradient(0, 0, 0, 0); // zero-length line (undefined direction);
+g.addColorStop(0, '#f00');
+g.addColorStop(1, '#f00');
+ctx.strokeStyle = g;
+ctx.font = '1px sans-serif';
+ctx.strokeText("AA", 0, 1);
+
+var imageData = ctx.getImageData(0, 0, 1, 1);
+var imgdata = imageData.data;
+shouldBe("imgdata[0]", "0");
+shouldBe("imgdata[1]", "255");
+shouldBe("imgdata[2]", "0");
+
Modified: trunk/Source/WebCore/ChangeLog (141611 => 141612)
--- trunk/Source/WebCore/ChangeLog 2013-02-01 19:00:13 UTC (rev 141611)
+++ trunk/Source/WebCore/ChangeLog 2013-02-01 19:04:43 UTC (rev 141612)
@@ -1,3 +1,27 @@
+2013-02-01 Rashmi Shyamasundar <rashmi...@samsung.com>
+
+ Zero size gradient should paint nothing on canvas
+ https://bugs.webkit.org/show_bug.cgi?id=102654
+
+ Reviewed by Dirk Schulze.
+
+ The functions fill(), fillText(), stroke(), strokeRect() and strokeText()
+ should paint nothing on canvas when the canvas fillStyle/strokeStyle
+ is set to a zero size gradient.
+
+ Tests: fast/canvas/canvas-fill-zeroSizeGradient.html
+ fast/canvas/canvas-fillRect-zeroSizeGradient.html
+ fast/canvas/canvas-fillText-zeroSizeGradient.html
+ fast/canvas/canvas-stroke-zeroSizeGradient.html
+ fast/canvas/canvas-strokeRect-zeroSizeGradient.html
+ fast/canvas/canvas-strokeText-zeroSizeGradient.html
+
+ * html/canvas/CanvasRenderingContext2D.cpp:
+ (WebCore::CanvasRenderingContext2D::fill):
+ (WebCore::CanvasRenderingContext2D::stroke):
+ (WebCore::CanvasRenderingContext2D::strokeRect):
+ (WebCore::CanvasRenderingContext2D::drawTextInternal):
+
2013-02-01 Jesus Sanchez-Palencia <jesus.palen...@openbossa.org>
HRTFElevation segfault if a null AudioBus is returned by loadPlatformResource
Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (141611 => 141612)
--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2013-02-01 19:00:13 UTC (rev 141611)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp 2013-02-01 19:04:43 UTC (rev 141612)
@@ -928,6 +928,11 @@
if (!state().m_invertibleCTM)
return;
+ // If gradient size is zero, then paint nothing.
+ Gradient* gradient = c->fillGradient();
+ if (gradient && gradient->isZeroSize())
+ return;
+
if (!m_path.isEmpty()) {
WindRule windRule = c->fillRule();
WindRule newWindRule = RULE_NONZERO;
@@ -963,6 +968,11 @@
if (!state().m_invertibleCTM)
return;
+ // If gradient size is zero, then paint nothing.
+ Gradient* gradient = c->strokeGradient();
+ if (gradient && gradient->isZeroSize())
+ return;
+
if (!m_path.isEmpty()) {
FloatRect dirtyRect = m_path.fastBoundingRect();
inflateStrokeRect(dirtyRect);
@@ -1130,6 +1140,11 @@
if (!state().m_invertibleCTM)
return;
+ // If gradient size is zero, then paint nothing.
+ Gradient* gradient = c->strokeGradient();
+ if (gradient && gradient->isZeroSize())
+ return;
+
FloatRect rect(x, y, width, height);
FloatRect boundingRect = rect;
@@ -2161,6 +2176,15 @@
if (useMaxWidth && !isfinite(maxWidth))
return;
+ // If gradient size is zero, then paint nothing.
+ Gradient* gradient = c->strokeGradient();
+ if (!fill && gradient && gradient->isZeroSize())
+ return;
+
+ gradient = c->fillGradient();
+ if (fill && gradient && gradient->isZeroSize())
+ return;
+
FontCachePurgePreventer fontCachePurgePreventer;
const Font& font = accessFont();