Changeset 59213 in webkit
- Timestamp:
- May 12, 2010 1:19:18 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r59203 r59213 1 2010-05-12 Robin Qiu <robin.qiu@torchmobile.com.cn> 2 3 Reviewed by Dirk Schulze. 4 5 Fix a bug in SVGPathSegList::getPathSegAtLength(). 6 This bug is just a misktake: almost all of the code is OK, but the 7 parameter is not used at all, therefore, this function always returns 8 "1". 9 And make a modification to return the last path segment if the distance 10 exceeds the actual path length. 11 https://bugs.webkit.org/show_bug.cgi?id=37515 12 13 * svg/dom/svgpath-getPathSegAtLength-expected.txt: Added. 14 * svg/dom/svgpath-getPathSegAtLength.html: Added. 15 1 16 2010-05-11 Tony Chang <tony@chromium.org> 2 17 -
trunk/WebCore/ChangeLog
r59211 r59213 1 2010-05-12 Robin Qiu <robin.qiu@torchmobile.com.cn> 2 3 Reviewed by Dirk Schulze. 4 5 Fix a bug in SVGPathSegList::getPathSegAtLength(). 6 This bug is just a misktake: almost all of the code is OK, but the 7 parameter is not used at all, therefore, this function always returns 8 "1". 9 And make a modification to return the last path segment if the distance 10 exceeds the actual path length. 11 https://bugs.webkit.org/show_bug.cgi?id=37515 12 13 Test: svg/dom/svgpath-getPathSegAtLength.html 14 15 * svg/SVGPathSegList.cpp: 16 (WebCore::SVGPathSegList::getPathSegAtLength): 17 1 18 2010-05-11 David Hyatt <hyatt@apple.com> 2 19 -
trunk/WebCore/svg/SVGPathSegList.cpp
r56795 r59213 27 27 #include "SVGPathSegList.h" 28 28 29 #include "FloatConversion.h" 29 30 #include "FloatPoint.h" 30 31 #include "Path.h" … … 52 53 } 53 54 54 unsigned SVGPathSegList::getPathSegAtLength(double , ExceptionCode& ec)55 unsigned SVGPathSegList::getPathSegAtLength(double length, ExceptionCode& ec) 55 56 { 56 57 // FIXME : to be useful this will need to support non-normalized SVGPathSegLists … … 58 59 // FIXME: Eventually this will likely move to a "path applier"-like model, until then PathTraversalState is less useful as we could just use locals 59 60 PathTraversalState traversalState(PathTraversalState::TraversalSegmentAtLength); 61 traversalState.m_desiredLength = narrowPrecisionToFloat(length); 60 62 for (int i = 0; i < len; ++i) { 61 63 SVGPathSeg* segment = getItem(i, ec).get(); … … 93 95 traversalState.m_totalLength += segmentLength; 94 96 if ((traversalState.m_action == PathTraversalState::TraversalSegmentAtLength) 95 && (traversalState.m_totalLength > traversalState.m_desiredLength)) {97 && (traversalState.m_totalLength >= traversalState.m_desiredLength)) { 96 98 return traversalState.m_segmentIndex; 97 99 } 98 100 traversalState.m_segmentIndex++; 99 101 } 100 101 return 0; // The SVG spec is unclear as to what to return when the distance is not on the path 102 103 // The SVG spec is unclear as to what to return when the distance is not on the path. 104 // WebKit/Opera/FF all return the last path segment if the distance exceeds the actual path length: 105 return traversalState.m_segmentIndex ? traversalState.m_segmentIndex - 1 : 0; 102 106 } 103 107
Note: See TracChangeset
for help on using the changeset viewer.