Changeset 218648 in webkit
- Timestamp:
- Jun 21, 2017, 2:13:58 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/svg/custom/path-getTotalLength-hang-expected.txt (added)
-
LayoutTests/svg/custom/path-getTotalLength-hang.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/platform/graphics/PathTraversalState.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r218636 r218648 1 2017-06-21 Simon Fraser <simon.fraser@apple.com> 2 3 svgPath.getTotalLength() freezes webkit 4 https://bugs.webkit.org/show_bug.cgi?id=173566 5 <rdar://problem/32866731> 6 7 Reviewed by Dean Jackson. 8 9 * svg/custom/path-getTotalLength-hang.html: Added. 10 1 11 2017-06-21 Claudio Saavedra <csaavedra@igalia.com> 2 12 -
trunk/Source/WebCore/ChangeLog
r218647 r218648 1 2017-06-20 Simon Fraser <simon.fraser@apple.com> 2 3 svgPath.getTotalLength() freezes webkit 4 https://bugs.webkit.org/show_bug.cgi?id=173566 5 <rdar://problem/32866731> 6 7 Reviewed by Dean Jackson. 8 9 Ensure that curveLength() progresses by making split() return a bool indicating 10 whether either of the resulting curves are the same as the original. This can happen 11 when midPoint() on two close points returns a point that is the same as one of the 12 arguments because of floating-point precision limitations. 13 14 Test: svg/custom/path-getTotalLength-hang.html 15 16 * platform/graphics/PathTraversalState.cpp: 17 (WebCore::QuadraticBezier::operator ==): 18 (WebCore::QuadraticBezier::split): 19 (WebCore::CubicBezier::operator ==): 20 (WebCore::CubicBezier::split): 21 (WebCore::curveLength): 22 1 23 2017-06-21 Youenn Fablet <youenn@apple.com> 2 24 -
trunk/Source/WebCore/platform/graphics/PathTraversalState.cpp
r182828 r218648 49 49 { 50 50 } 51 52 bool operator==(const QuadraticBezier& rhs) const 53 { 54 return start == rhs.start 55 && control == rhs.control 56 && end == rhs.end; 57 } 51 58 52 59 float approximateDistance() const … … 55 62 } 56 63 57 voidsplit(QuadraticBezier& left, QuadraticBezier& right) const64 bool split(QuadraticBezier& left, QuadraticBezier& right) const 58 65 { 59 66 left.control = midPoint(start, control); … … 66 73 left.start = start; 67 74 right.end = end; 75 76 return !(left == *this) && !(right == *this); 68 77 } 69 78 … … 82 91 { 83 92 } 84 93 94 bool operator==(const CubicBezier& rhs) const 95 { 96 return start == rhs.start 97 && control1 == rhs.control1 98 && control2 == rhs.control2 99 && end == rhs.end; 100 } 101 85 102 float approximateDistance() const 86 103 { … … 88 105 } 89 106 90 voidsplit(CubicBezier& left, CubicBezier& right) const107 bool split(CubicBezier& left, CubicBezier& right) const 91 108 { 92 109 FloatPoint startToControl1 = midPoint(control1, control2); … … 103 120 left.end = leftControl2ToRightControl1; 104 121 right.start = leftControl2ToRightControl1; 122 123 return !(left == *this) && !(right == *this); 105 124 } 106 125 … … 128 147 float length = curve.approximateDistance(); 129 148 130 if ((length - distanceLine(curve.start, curve.end)) > kPathSegmentLengthTolerance && curveStack.size() < curveStackDepthLimit) {131 CurveType leftCurve;132 CurveType rightCurve; 133 curve.split(leftCurve, rightCurve);149 CurveType leftCurve; 150 CurveType rightCurve; 151 152 if ((length - distanceLine(curve.start, curve.end)) > kPathSegmentLengthTolerance && curveStack.size() < curveStackDepthLimit && curve.split(leftCurve, rightCurve)) { 134 153 curve = leftCurve; 135 154 curveStack.append(rightCurve);
Note:
See TracChangeset
for help on using the changeset viewer.