Changeset 65472 in webkit
- Timestamp:
- Aug 16, 2010 5:41:17 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r65470 r65472 1 2010-08-16 Andreas Kling <andreas.kling@nokia.com> 2 3 Reviewed by Ariya Hidayat. 4 5 [Qt] Path::closeSubpath() should only close the last subpath if it has >1 point 6 https://bugs.webkit.org/show_bug.cgi?id=44061 7 8 Add a test to verify behavior of closePath() when path has only 1 point. 9 10 * fast/canvas/canvas-closePath-single-point-expected.txt: Added. 11 * fast/canvas/canvas-closePath-single-point.html: Added. 12 * fast/canvas/script-tests/canvas-closePath-single-point.js: Added. 13 1 14 2010-08-16 Nate Chapin <japhet@chromium.org> 2 15 -
trunk/WebCore/ChangeLog
r65469 r65472 1 2010-08-16 Andreas Kling <andreas.kling@nokia.com> 2 3 Reviewed by Ariya Hidayat. 4 5 [Qt] Path::closeSubpath() should only close the last subpath if it has >1 point 6 https://bugs.webkit.org/show_bug.cgi?id=44061 7 8 Spec link: 9 http://www.whatwg.org/specs/web-apps/current-work/#dom-context-2d-closepath 10 11 Test: fast/canvas/canvas-closePath-single-point.html 12 13 * platform/graphics/Path.h: Add a Qt-only member to track the last subpath. 14 * platform/graphics/qt/PathQt.cpp: 15 (WebCore::Path::closeSubpath): Only close the last subpath if it 16 has more than 1 point. Otherwise behave as moveTo(first point in last subpath) 17 (WebCore::Path::Path): 18 (WebCore::Path::operator=): 19 (WebCore::Path::moveTo): 20 (WebCore::Path::transform): 21 1 22 2010-08-16 Nate Chapin <japhet@chromium.org> 2 23 -
trunk/WebCore/platform/graphics/Path.h
r65021 r65472 157 157 private: 158 158 PlatformPathPtr m_path; 159 160 #if PLATFORM(QT) 161 int m_lastMoveToIndex; 162 #endif 159 163 }; 160 164 -
trunk/WebCore/platform/graphics/qt/PathQt.cpp
r65376 r65472 52 52 53 53 Path::Path() 54 : m_lastMoveToIndex(0) 54 55 { 55 56 } … … 61 62 Path::Path(const Path& other) 62 63 : m_path(other.m_path) 64 , m_lastMoveToIndex(other.m_lastMoveToIndex) 63 65 { 64 66 } … … 67 69 { 68 70 m_path = other.m_path; 71 m_lastMoveToIndex = other.m_lastMoveToIndex; 69 72 return *this; 70 73 } … … 181 184 void Path::moveTo(const FloatPoint& point) 182 185 { 186 m_lastMoveToIndex = m_path.elementCount(); 183 187 m_path.moveTo(point); 184 188 } … … 261 265 void Path::closeSubpath() 262 266 { 263 m_path.closeSubpath(); 267 const int elementCount = m_path.elementCount(); 268 269 if (!elementCount) 270 return; 271 272 QPointF lastMoveToPoint = m_path.elementAt(m_lastMoveToIndex); 273 int elementsInLastSubpath = 0; 274 275 for (int i = m_lastMoveToIndex; i < elementCount; ++i) { 276 QPainterPath::Element element = m_path.elementAt(i); 277 if (element.isLineTo() || element.isCurveTo()) { 278 // All we need to know is if there are 1 or more elements in the last subpath. 279 if (++elementsInLastSubpath == 2) { 280 m_path.lineTo(lastMoveToPoint); 281 return; 282 } 283 } 284 } 285 286 moveTo(lastMoveToPoint); 264 287 } 265 288 … … 441 464 if (m_path.isEmpty() && m_path.elementCount()) { 442 465 QPointF point = qTransform.map(m_path.currentPosition()); 443 m _path.moveTo(point);466 moveTo(point); 444 467 } else 445 468 #endif
Note: See TracChangeset
for help on using the changeset viewer.