[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
andreas.kling at nokia.com
andreas.kling at nokia.com
Wed Dec 22 12:11:38 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit b20bc95ea1af11c50da5b6b7c37aaafb644f5f51
Author: andreas.kling at nokia.com <andreas.kling at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Aug 17 00:41:17 2010 +0000
2010-08-16 Andreas Kling <andreas.kling at nokia.com>
Reviewed by Ariya Hidayat.
[Qt] Path::closeSubpath() should only close the last subpath if it has >1 point
https://bugs.webkit.org/show_bug.cgi?id=44061
Spec link:
http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-closepath
Test: fast/canvas/canvas-closePath-single-point.html
* platform/graphics/Path.h: Add a Qt-only member to track the last subpath.
* platform/graphics/qt/PathQt.cpp:
(WebCore::Path::closeSubpath): Only close the last subpath if it
has more than 1 point. Otherwise behave as moveTo(first point in last subpath)
(WebCore::Path::Path):
(WebCore::Path::operator=):
(WebCore::Path::moveTo):
(WebCore::Path::transform):
2010-08-16 Andreas Kling <andreas.kling at nokia.com>
Reviewed by Ariya Hidayat.
[Qt] Path::closeSubpath() should only close the last subpath if it has >1 point
https://bugs.webkit.org/show_bug.cgi?id=44061
Add a test to verify behavior of closePath() when path has only 1 point.
* fast/canvas/canvas-closePath-single-point-expected.txt: Added.
* fast/canvas/canvas-closePath-single-point.html: Added.
* fast/canvas/script-tests/canvas-closePath-single-point.js: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65472 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f0437e2..16abf88 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2010-08-16 Andreas Kling <andreas.kling at nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Path::closeSubpath() should only close the last subpath if it has >1 point
+ https://bugs.webkit.org/show_bug.cgi?id=44061
+
+ Add a test to verify behavior of closePath() when path has only 1 point.
+
+ * fast/canvas/canvas-closePath-single-point-expected.txt: Added.
+ * fast/canvas/canvas-closePath-single-point.html: Added.
+ * fast/canvas/script-tests/canvas-closePath-single-point.js: Added.
+
2010-08-16 Nate Chapin <japhet at chromium.org>
Unreviewed, Chromium expectations update.
diff --git a/LayoutTests/fast/canvas/canvas-closePath-single-point-expected.txt b/LayoutTests/fast/canvas/canvas-closePath-single-point-expected.txt
new file mode 100644
index 0000000..7c90710
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-closePath-single-point-expected.txt
@@ -0,0 +1,13 @@
+Test the behavior of closePath on a path with a single point
+
+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 imgdata[3] is 255
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/canvas/canvas-closePath-single-point.html b/LayoutTests/fast/canvas/canvas-closePath-single-point.html
new file mode 100644
index 0000000..daa9cff
--- /dev/null
+++ b/LayoutTests/fast/canvas/canvas-closePath-single-point.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/canvas-closePath-single-point.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/canvas/script-tests/canvas-closePath-single-point.js b/LayoutTests/fast/canvas/script-tests/canvas-closePath-single-point.js
new file mode 100644
index 0000000..fe7b727
--- /dev/null
+++ b/LayoutTests/fast/canvas/script-tests/canvas-closePath-single-point.js
@@ -0,0 +1,25 @@
+description("Test the behavior of closePath on a path with a single point");
+var ctx = document.createElement('canvas').getContext('2d');
+
+document.body.appendChild(ctx.canvas);
+
+ctx.strokeStyle = '#f00';
+ctx.lineWidth = 20;
+
+ctx.fillStyle = '#0f0';
+ctx.fillRect(0, 0, ctx.canvas.width, ctx.canvas.height);
+
+ctx.beginPath();
+ctx.moveTo(10, 10);
+ctx.lineTo(100, 100);
+ctx.closePath();
+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");
+shouldBe("imgdata[3]", "255");
+
+var successfullyParsed = true;
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index eff8adc..11be676 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2010-08-16 Andreas Kling <andreas.kling at nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Path::closeSubpath() should only close the last subpath if it has >1 point
+ https://bugs.webkit.org/show_bug.cgi?id=44061
+
+ Spec link:
+ http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-closepath
+
+ Test: fast/canvas/canvas-closePath-single-point.html
+
+ * platform/graphics/Path.h: Add a Qt-only member to track the last subpath.
+ * platform/graphics/qt/PathQt.cpp:
+ (WebCore::Path::closeSubpath): Only close the last subpath if it
+ has more than 1 point. Otherwise behave as moveTo(first point in last subpath)
+ (WebCore::Path::Path):
+ (WebCore::Path::operator=):
+ (WebCore::Path::moveTo):
+ (WebCore::Path::transform):
+
2010-08-16 Nate Chapin <japhet at chromium.org>
Unreviewed, Chromium mac build fix (with help from jamesr).
diff --git a/WebCore/platform/graphics/Path.h b/WebCore/platform/graphics/Path.h
index 43ba889..61ea328 100644
--- a/WebCore/platform/graphics/Path.h
+++ b/WebCore/platform/graphics/Path.h
@@ -156,6 +156,10 @@ namespace WebCore {
private:
PlatformPathPtr m_path;
+
+#if PLATFORM(QT)
+ int m_lastMoveToIndex;
+#endif
};
}
diff --git a/WebCore/platform/graphics/qt/PathQt.cpp b/WebCore/platform/graphics/qt/PathQt.cpp
index de9de07..ce5da2e 100644
--- a/WebCore/platform/graphics/qt/PathQt.cpp
+++ b/WebCore/platform/graphics/qt/PathQt.cpp
@@ -51,6 +51,7 @@
namespace WebCore {
Path::Path()
+ : m_lastMoveToIndex(0)
{
}
@@ -60,12 +61,14 @@ Path::~Path()
Path::Path(const Path& other)
: m_path(other.m_path)
+ , m_lastMoveToIndex(other.m_lastMoveToIndex)
{
}
Path& Path::operator=(const Path& other)
{
m_path = other.m_path;
+ m_lastMoveToIndex = other.m_lastMoveToIndex;
return *this;
}
@@ -180,6 +183,7 @@ FloatRect Path::strokeBoundingRect(StrokeStyleApplier* applier)
void Path::moveTo(const FloatPoint& point)
{
+ m_lastMoveToIndex = m_path.elementCount();
m_path.moveTo(point);
}
@@ -260,7 +264,26 @@ void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
void Path::closeSubpath()
{
- m_path.closeSubpath();
+ const int elementCount = m_path.elementCount();
+
+ if (!elementCount)
+ return;
+
+ QPointF lastMoveToPoint = m_path.elementAt(m_lastMoveToIndex);
+ int elementsInLastSubpath = 0;
+
+ for (int i = m_lastMoveToIndex; i < elementCount; ++i) {
+ QPainterPath::Element element = m_path.elementAt(i);
+ if (element.isLineTo() || element.isCurveTo()) {
+ // All we need to know is if there are 1 or more elements in the last subpath.
+ if (++elementsInLastSubpath == 2) {
+ m_path.lineTo(lastMoveToPoint);
+ return;
+ }
+ }
+ }
+
+ moveTo(lastMoveToPoint);
}
#define DEGREES(t) ((t) * 180.0 / M_PI)
@@ -440,7 +463,7 @@ void Path::transform(const AffineTransform& transform)
// QTransform.map doesn't handle the MoveTo element because of the isEmpty issue
if (m_path.isEmpty() && m_path.elementCount()) {
QPointF point = qTransform.map(m_path.currentPosition());
- m_path.moveTo(point);
+ moveTo(point);
} else
#endif
m_path = qTransform.map(m_path);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list