Diff
Modified: trunk/LayoutTests/ChangeLog (141499 => 141500)
--- trunk/LayoutTests/ChangeLog 2013-01-31 23:49:26 UTC (rev 141499)
+++ trunk/LayoutTests/ChangeLog 2013-01-31 23:51:58 UTC (rev 141500)
@@ -1,3 +1,21 @@
+2013-01-31 Youenn Fablet <youe...@gmail.com>
+
+ Quadratic and bezier curves with coincident endpoints rendered incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=105650
+ Modified TestExpectations for Mac, efl and Qt platforms as quadratic curves
+ may not be rendered correctly
+ (see https://bugs.webkit.org/show_bug.cgi?id=107118)
+
+ Reviewed by Kenneth Russell.
+
+ * fast/canvas/canvas-bezier-same-endpoint-expected.txt: Added.
+ * fast/canvas/canvas-bezier-same-endpoint.html: Added.
+ * fast/canvas/canvas-quadratic-same-endpoint-expected.txt: Added.
+ * fast/canvas/canvas-quadratic-same-endpoint.html: Added.
+ * platform/efl/TestExpectations: Skipped quad test
+ * platform/mac/TestExpectations: Skipped quad test
+ * platform/qt/TestExpectations: Skipped quad test
+
2013-01-31 Uday Kiran <udayki...@motorola.com>
CSS3's vh attribute is not adjusting while browser resizes
Added: trunk/LayoutTests/fast/canvas/canvas-bezier-same-endpoint-expected.txt (0 => 141500)
--- trunk/LayoutTests/fast/canvas/canvas-bezier-same-endpoint-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-bezier-same-endpoint-expected.txt 2013-01-31 23:51:58 UTC (rev 141500)
@@ -0,0 +1,16 @@
+Bug 105650: Test correct rendering of quadratic and bezier curves with coincident endpoints
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS blue_value is 255
+PASS blue_value is 0
+PASS blue_value is 255
+PASS blue_value is 255
+PASS blue_value is 0
+PASS blue_value is 255
+PASS blue_value is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/canvas-bezier-same-endpoint.html (0 => 141500)
--- trunk/LayoutTests/fast/canvas/canvas-bezier-same-endpoint.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-bezier-same-endpoint.html 2013-01-31 23:51:58 UTC (rev 141500)
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<canvas id="canvas" width="100" height="100"></canvas>
+<script>
+description("Bug 105650: Test correct rendering of quadratic and bezier curves with coincident endpoints");
+var ctx = document.getElementById('canvas').getContext('2d');
+var data;
+
+function shouldBeYellow(x,y)
+{
+ blue_value = ctx.getImageData(x, y, 1, 1).data[2];
+ shouldBe("blue_value", "0");
+}
+
+function shouldBeBlue(x,y)
+{
+ blue_value = ctx.getImageData(x, y, 1, 1).data[2];
+ shouldBe("blue_value", "255");
+}
+
+ctx.fillStyle = '#00f';
+ctx.strokeStyle = '#ff0';
+ctx.lineWidth = 30;
+
+ctx.beginPath();
+ctx.fillRect(0,0,100,100);
+ctx.moveTo(0,0);
+
+// bezier curve with coincident endpoints, horizontal line
+ctx.bezierCurveTo(0,0,200,0,0,0);
+shouldBeBlue(50,0);
+ctx.stroke();
+shouldBeYellow(50,0);
+shouldBeBlue(0,50);
+shouldBeBlue(70,70);
+
+// bezier curve with coincident endpoints, vertical line
+ctx.bezierCurveTo(0,200,0,0,0,0);
+ctx.stroke();
+shouldBeYellow(50,0);
+shouldBeBlue(75,75);
+
+// bezier curve with coincident endpoints
+ctx.bezierCurveTo(200,0,0,200,0,0);
+ctx.stroke();
+shouldBeYellow(75,75);
+
+
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/canvas/canvas-quadratic-same-endpoint-expected.txt (0 => 141500)
--- trunk/LayoutTests/fast/canvas/canvas-quadratic-same-endpoint-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-quadratic-same-endpoint-expected.txt 2013-01-31 23:51:58 UTC (rev 141500)
@@ -0,0 +1,11 @@
+Bug 105650: Test correct rendering of quadratic and bezier curves with coincident endpoints
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS blue_value is 255
+PASS blue_value is 0
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/canvas/canvas-quadratic-same-endpoint.html (0 => 141500)
--- trunk/LayoutTests/fast/canvas/canvas-quadratic-same-endpoint.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-quadratic-same-endpoint.html 2013-01-31 23:51:58 UTC (rev 141500)
@@ -0,0 +1,45 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<canvas id="canvas" width="100" height="100"></canvas>
+<script>
+description("Bug 105650: Test correct rendering of quadratic and bezier curves with coincident endpoints");
+var ctx = document.getElementById('canvas').getContext('2d');
+var data;
+
+function shouldBeYellow(x,y)
+{
+ blue_value = ctx.getImageData(x, y, 1, 1).data[2];
+ shouldBe("blue_value", "0");
+}
+
+function shouldBeBlue(x,y)
+{
+ blue_value = ctx.getImageData(x, y, 1, 1).data[2];
+ shouldBe("blue_value", "255");
+}
+
+ctx.fillStyle = '#00f';
+ctx.strokeStyle = '#ff0';
+ctx.lineWidth = 30;
+
+ctx.beginPath();
+ctx.fillRect(0,0,100,100);
+
+// quadratic with coincident endpoint
+ctx.moveTo(20,20);
+
+//Next line should be close to ctx.bezierCurveTo(81,80,80,80,20,20);
+ctx.quadraticCurveTo(110,110,20,20);
+
+shouldBeBlue(70,70);
+ctx.stroke();
+shouldBeYellow(70,70);
+
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/LayoutTests/platform/efl/TestExpectations (141499 => 141500)
--- trunk/LayoutTests/platform/efl/TestExpectations 2013-01-31 23:49:26 UTC (rev 141499)
+++ trunk/LayoutTests/platform/efl/TestExpectations 2013-01-31 23:51:58 UTC (rev 141500)
@@ -212,6 +212,9 @@
# Flaky tests (text diff mismatch)
http/tests/navigation/document-location-mouseover.html
+# https://bugs.webkit.org/show_bug.cgi?id=107118
+fast/canvas/canvas-quadratic-same-endpoint.html
+
# ------------------------------------
# Tests for features under development
# ------------------------------------
Modified: trunk/LayoutTests/platform/mac/TestExpectations (141499 => 141500)
--- trunk/LayoutTests/platform/mac/TestExpectations 2013-01-31 23:49:26 UTC (rev 141499)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2013-01-31 23:51:58 UTC (rev 141500)
@@ -935,6 +935,9 @@
canvas/philip/tests/2d.line.miter.lineedge.html
canvas/philip/tests/2d.strokeRect.zero.4.html
+# https://bugs.webkit.org/show_bug.cgi?id=107118
+fast/canvas/canvas-quadratic-same-endpoint.html
+
# --- Compositing ----
css3/filters/composited-during-transition-layertree.html
Modified: trunk/LayoutTests/platform/qt/TestExpectations (141499 => 141500)
--- trunk/LayoutTests/platform/qt/TestExpectations 2013-01-31 23:49:26 UTC (rev 141499)
+++ trunk/LayoutTests/platform/qt/TestExpectations 2013-01-31 23:51:58 UTC (rev 141500)
@@ -1212,6 +1212,9 @@
fast/canvas/canvas-blend-image.html
fast/canvas/canvas-blend-solid.html
+# https://bugs.webkit.org/show_bug.cgi?id=107118
+fast/canvas/canvas-quadratic-same-endpoint.html
+
# ReferenceError: Can't find variable: MediaKeyError
# http://trac.webkit.org/changeset/114067
fast/events/constructors/media-key-event-constructor.html
Modified: trunk/Source/WebCore/ChangeLog (141499 => 141500)
--- trunk/Source/WebCore/ChangeLog 2013-01-31 23:49:26 UTC (rev 141499)
+++ trunk/Source/WebCore/ChangeLog 2013-01-31 23:51:58 UTC (rev 141500)
@@ -1,3 +1,17 @@
+2013-01-31 Youenn Fablet <youe...@gmail.com>
+
+ Quadratic and bezier curves with coincident endpoints rendered incorrectly
+ https://bugs.webkit.org/show_bug.cgi?id=105650
+
+ Reviewed by Kenneth Russell.
+
+ Tests: fast/canvas/canvas-bezier-same-endpoint.html
+ fast/canvas/canvas-quadratic-same-endpoint.html
+
+ * html/canvas/CanvasPathMethods.cpp:
+ (WebCore::CanvasPathMethods::quadraticCurveTo):
+ (WebCore::CanvasPathMethods::bezierCurveTo):
+
2013-01-31 Mark Lam <mark....@apple.com>
Abstraction for hiding enum class.
Modified: trunk/Source/WebCore/html/canvas/CanvasPathMethods.cpp (141499 => 141500)
--- trunk/Source/WebCore/html/canvas/CanvasPathMethods.cpp 2013-01-31 23:49:26 UTC (rev 141499)
+++ trunk/Source/WebCore/html/canvas/CanvasPathMethods.cpp 2013-01-31 23:51:58 UTC (rev 141500)
@@ -84,8 +84,9 @@
m_path.moveTo(FloatPoint(cpx, cpy));
FloatPoint p1 = FloatPoint(x, y);
- if (p1 != m_path.currentPoint())
- m_path.addQuadCurveTo(FloatPoint(cpx, cpy), p1);
+ FloatPoint cp = FloatPoint(cpx, cpy);
+ if (p1 != m_path.currentPoint() || p1 != cp)
+ m_path.addQuadCurveTo(cp, p1);
}
void CanvasPathMethods::bezierCurveTo(float cp1x, float cp1y, float cp2x, float cp2y, float x, float y)
@@ -98,8 +99,10 @@
m_path.moveTo(FloatPoint(cp1x, cp1y));
FloatPoint p1 = FloatPoint(x, y);
- if (p1 != m_path.currentPoint())
- m_path.addBezierCurveTo(FloatPoint(cp1x, cp1y), FloatPoint(cp2x, cp2y), p1);
+ FloatPoint cp1 = FloatPoint(cp1x, cp1y);
+ FloatPoint cp2 = FloatPoint(cp2x, cp2y);
+ if (p1 != m_path.currentPoint() || p1 != cp1 || p1 != cp2)
+ m_path.addBezierCurveTo(cp1, cp2, p1);
}
void CanvasPathMethods::arcTo(float x1, float y1, float x2, float y2, float r, ExceptionCode& ec)