Changeset 194964 in webkit
- Timestamp:
- Jan 13, 2016 9:04:36 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 30 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r194963 r194964 1 2016-01-13 Said Abou-Hallawa <sabouhallawa@apple.com> 2 3 Reference cycle between SVGPathElement and SVGPathSegWithContext leaks Document 4 https://bugs.webkit.org/show_bug.cgi?id=151810 5 6 Reviewed by Darin Adler. 7 8 Break the reference cycle between SVGPathElement and SVGPathSegWithContext 9 by changing the back-pointer to be a WeakPtr pointer instead of having it 10 RefPtr. Make sure the SVGPathSegWithContext derived classes handle correctly 11 the case when the SVGPathElement back-pointer is deleted. 12 13 Also change the SVGPathElement argument to the SVGPathSeg creation functions 14 and constructors to be a const reference instead of having it as a pointer 15 since SVGPathElement is the class factory for all these classes. 16 17 * svg/SVGPathElement.cpp: 18 (WebCore::SVGPathElement::SVGPathElement): 19 (WebCore::SVGPathElement::createSVGPathSegClosePath): 20 (WebCore::SVGPathElement::createSVGPathSegMovetoAbs): 21 (WebCore::SVGPathElement::createSVGPathSegMovetoRel): 22 (WebCore::SVGPathElement::createSVGPathSegLinetoAbs): 23 (WebCore::SVGPathElement::createSVGPathSegLinetoRel): 24 (WebCore::SVGPathElement::createSVGPathSegCurvetoCubicAbs): 25 (WebCore::SVGPathElement::createSVGPathSegCurvetoCubicRel): 26 (WebCore::SVGPathElement::createSVGPathSegCurvetoQuadraticAbs): 27 (WebCore::SVGPathElement::createSVGPathSegCurvetoQuadraticRel): 28 (WebCore::SVGPathElement::createSVGPathSegArcAbs): 29 (WebCore::SVGPathElement::createSVGPathSegArcRel): 30 (WebCore::SVGPathElement::createSVGPathSegLinetoHorizontalAbs): 31 (WebCore::SVGPathElement::createSVGPathSegLinetoHorizontalRel): 32 (WebCore::SVGPathElement::createSVGPathSegLinetoVerticalAbs): 33 (WebCore::SVGPathElement::createSVGPathSegLinetoVerticalRel): 34 (WebCore::SVGPathElement::createSVGPathSegCurvetoCubicSmoothAbs): 35 (WebCore::SVGPathElement::createSVGPathSegCurvetoCubicSmoothRel): 36 (WebCore::SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothAbs): 37 (WebCore::SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothRel): 38 (WebCore::SVGPathElement::isSupportedAttribute): 39 * svg/SVGPathElement.h: 40 * svg/SVGPathSegArc.h: 41 (WebCore::SVGPathSegArc::SVGPathSegArc): 42 * svg/SVGPathSegArcAbs.h: 43 (WebCore::SVGPathSegArcAbs::create): 44 (WebCore::SVGPathSegArcAbs::SVGPathSegArcAbs): 45 * svg/SVGPathSegArcRel.h: 46 (WebCore::SVGPathSegArcRel::create): 47 (WebCore::SVGPathSegArcRel::SVGPathSegArcRel): 48 * svg/SVGPathSegClosePath.h: 49 (WebCore::SVGPathSegClosePath::create): 50 (WebCore::SVGPathSegClosePath::SVGPathSegClosePath): 51 * svg/SVGPathSegCurvetoCubic.h: 52 (WebCore::SVGPathSegCurvetoCubic::SVGPathSegCurvetoCubic): 53 * svg/SVGPathSegCurvetoCubicAbs.h: 54 (WebCore::SVGPathSegCurvetoCubicAbs::create): 55 (WebCore::SVGPathSegCurvetoCubicAbs::SVGPathSegCurvetoCubicAbs): 56 * svg/SVGPathSegCurvetoCubicRel.h: 57 (WebCore::SVGPathSegCurvetoCubicRel::create): 58 (WebCore::SVGPathSegCurvetoCubicRel::SVGPathSegCurvetoCubicRel): 59 * svg/SVGPathSegCurvetoCubicSmooth.h: 60 (WebCore::SVGPathSegCurvetoCubicSmooth::SVGPathSegCurvetoCubicSmooth): 61 * svg/SVGPathSegCurvetoCubicSmoothAbs.h: 62 (WebCore::SVGPathSegCurvetoCubicSmoothAbs::create): 63 (WebCore::SVGPathSegCurvetoCubicSmoothAbs::SVGPathSegCurvetoCubicSmoothAbs): 64 * svg/SVGPathSegCurvetoCubicSmoothRel.h: 65 (WebCore::SVGPathSegCurvetoCubicSmoothRel::create): 66 (WebCore::SVGPathSegCurvetoCubicSmoothRel::SVGPathSegCurvetoCubicSmoothRel): 67 * svg/SVGPathSegCurvetoQuadratic.h: 68 (WebCore::SVGPathSegCurvetoQuadratic::SVGPathSegCurvetoQuadratic): 69 * svg/SVGPathSegCurvetoQuadraticAbs.h: 70 (WebCore::SVGPathSegCurvetoQuadraticAbs::create): 71 (WebCore::SVGPathSegCurvetoQuadraticAbs::SVGPathSegCurvetoQuadraticAbs): 72 * svg/SVGPathSegCurvetoQuadraticRel.h: 73 (WebCore::SVGPathSegCurvetoQuadraticRel::create): 74 (WebCore::SVGPathSegCurvetoQuadraticRel::SVGPathSegCurvetoQuadraticRel): 75 * svg/SVGPathSegCurvetoQuadraticSmoothAbs.h: 76 (WebCore::SVGPathSegCurvetoQuadraticSmoothAbs::create): 77 (WebCore::SVGPathSegCurvetoQuadraticSmoothAbs::SVGPathSegCurvetoQuadraticSmoothAbs): 78 * svg/SVGPathSegCurvetoQuadraticSmoothRel.h: 79 (WebCore::SVGPathSegCurvetoQuadraticSmoothRel::create): 80 (WebCore::SVGPathSegCurvetoQuadraticSmoothRel::SVGPathSegCurvetoQuadraticSmoothRel): 81 * svg/SVGPathSegLinetoAbs.h: 82 (WebCore::SVGPathSegLinetoAbs::create): 83 (WebCore::SVGPathSegLinetoAbs::SVGPathSegLinetoAbs): 84 * svg/SVGPathSegLinetoHorizontal.h: 85 (WebCore::SVGPathSegLinetoHorizontal::SVGPathSegLinetoHorizontal): 86 * svg/SVGPathSegLinetoHorizontalAbs.h: 87 (WebCore::SVGPathSegLinetoHorizontalAbs::create): 88 (WebCore::SVGPathSegLinetoHorizontalAbs::SVGPathSegLinetoHorizontalAbs): 89 * svg/SVGPathSegLinetoHorizontalRel.h: 90 (WebCore::SVGPathSegLinetoHorizontalRel::create): 91 (WebCore::SVGPathSegLinetoHorizontalRel::SVGPathSegLinetoHorizontalRel): 92 * svg/SVGPathSegLinetoRel.h: 93 (WebCore::SVGPathSegLinetoRel::create): 94 (WebCore::SVGPathSegLinetoRel::SVGPathSegLinetoRel): 95 * svg/SVGPathSegLinetoVertical.h: 96 (WebCore::SVGPathSegLinetoVertical::SVGPathSegLinetoVertical): 97 * svg/SVGPathSegLinetoVerticalAbs.h: 98 (WebCore::SVGPathSegLinetoVerticalAbs::create): 99 (WebCore::SVGPathSegLinetoVerticalAbs::SVGPathSegLinetoVerticalAbs): 100 * svg/SVGPathSegLinetoVerticalRel.h: 101 (WebCore::SVGPathSegLinetoVerticalRel::create): 102 (WebCore::SVGPathSegLinetoVerticalRel::SVGPathSegLinetoVerticalRel): 103 * svg/SVGPathSegMovetoAbs.h: 104 (WebCore::SVGPathSegMovetoAbs::create): 105 (WebCore::SVGPathSegMovetoAbs::SVGPathSegMovetoAbs): 106 * svg/SVGPathSegMovetoRel.h: 107 (WebCore::SVGPathSegMovetoRel::create): 108 (WebCore::SVGPathSegMovetoRel::SVGPathSegMovetoRel): 109 * svg/SVGPathSegWithContext.h: 110 (WebCore::SVGPathSegWithContext::SVGPathSegWithContext): 111 (WebCore::SVGPathSegWithContext::animatedProperty): 112 (WebCore::SVGPathSegWithContext::contextElement): 113 (WebCore::SVGPathSegWithContext::setContextAndRole): 114 (WebCore::SVGPathSegWithContext::commitChange): 115 (WebCore::SVGPathSegSingleCoordinate::setY): 116 (WebCore::SVGPathSegSingleCoordinate::SVGPathSegSingleCoordinate): 117 * svg/properties/SVGPathSegListPropertyTearOff.cpp: 118 (WebCore::SVGPathSegListPropertyTearOff::clearContextAndRoles): 119 (WebCore::SVGPathSegListPropertyTearOff::replaceItem): 120 (WebCore::SVGPathSegListPropertyTearOff::removeItem): 121 1 122 2016-01-13 Andreas Kling <akling@apple.com> 2 123 -
trunk/Source/WebCore/svg/SVGPathElement.cpp
r194496 r194964 81 81 : SVGGraphicsElement(tagName, document) 82 82 , m_pathSegList(PathSegUnalteredRole) 83 , m_weakPtrFactory(this) 83 84 , m_isAnimValObserved(false) 84 85 { … … 115 116 Ref<SVGPathSegClosePath> SVGPathElement::createSVGPathSegClosePath(SVGPathSegRole role) 116 117 { 117 return SVGPathSegClosePath::create( this, role);118 return SVGPathSegClosePath::create(*this, role); 118 119 } 119 120 120 121 Ref<SVGPathSegMovetoAbs> SVGPathElement::createSVGPathSegMovetoAbs(float x, float y, SVGPathSegRole role) 121 122 { 122 return SVGPathSegMovetoAbs::create( this, role, x, y);123 return SVGPathSegMovetoAbs::create(*this, role, x, y); 123 124 } 124 125 125 126 Ref<SVGPathSegMovetoRel> SVGPathElement::createSVGPathSegMovetoRel(float x, float y, SVGPathSegRole role) 126 127 { 127 return SVGPathSegMovetoRel::create( this, role, x, y);128 return SVGPathSegMovetoRel::create(*this, role, x, y); 128 129 } 129 130 130 131 Ref<SVGPathSegLinetoAbs> SVGPathElement::createSVGPathSegLinetoAbs(float x, float y, SVGPathSegRole role) 131 132 { 132 return SVGPathSegLinetoAbs::create( this, role, x, y);133 return SVGPathSegLinetoAbs::create(*this, role, x, y); 133 134 } 134 135 135 136 Ref<SVGPathSegLinetoRel> SVGPathElement::createSVGPathSegLinetoRel(float x, float y, SVGPathSegRole role) 136 137 { 137 return SVGPathSegLinetoRel::create( this, role, x, y);138 return SVGPathSegLinetoRel::create(*this, role, x, y); 138 139 } 139 140 140 141 Ref<SVGPathSegCurvetoCubicAbs> SVGPathElement::createSVGPathSegCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2, SVGPathSegRole role) 141 142 { 142 return SVGPathSegCurvetoCubicAbs::create( this, role, x, y, x1, y1, x2, y2);143 return SVGPathSegCurvetoCubicAbs::create(*this, role, x, y, x1, y1, x2, y2); 143 144 } 144 145 145 146 Ref<SVGPathSegCurvetoCubicRel> SVGPathElement::createSVGPathSegCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2, SVGPathSegRole role) 146 147 { 147 return SVGPathSegCurvetoCubicRel::create( this, role, x, y, x1, y1, x2, y2);148 return SVGPathSegCurvetoCubicRel::create(*this, role, x, y, x1, y1, x2, y2); 148 149 } 149 150 150 151 Ref<SVGPathSegCurvetoQuadraticAbs> SVGPathElement::createSVGPathSegCurvetoQuadraticAbs(float x, float y, float x1, float y1, SVGPathSegRole role) 151 152 { 152 return SVGPathSegCurvetoQuadraticAbs::create( this, role, x, y, x1, y1);153 return SVGPathSegCurvetoQuadraticAbs::create(*this, role, x, y, x1, y1); 153 154 } 154 155 155 156 Ref<SVGPathSegCurvetoQuadraticRel> SVGPathElement::createSVGPathSegCurvetoQuadraticRel(float x, float y, float x1, float y1, SVGPathSegRole role) 156 157 { 157 return SVGPathSegCurvetoQuadraticRel::create( this, role, x, y, x1, y1);158 return SVGPathSegCurvetoQuadraticRel::create(*this, role, x, y, x1, y1); 158 159 } 159 160 160 161 Ref<SVGPathSegArcAbs> SVGPathElement::createSVGPathSegArcAbs(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, SVGPathSegRole role) 161 162 { 162 return SVGPathSegArcAbs::create( this, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag);163 return SVGPathSegArcAbs::create(*this, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag); 163 164 } 164 165 165 166 Ref<SVGPathSegArcRel> SVGPathElement::createSVGPathSegArcRel(float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag, SVGPathSegRole role) 166 167 { 167 return SVGPathSegArcRel::create( this, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag);168 return SVGPathSegArcRel::create(*this, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag); 168 169 } 169 170 170 171 Ref<SVGPathSegLinetoHorizontalAbs> SVGPathElement::createSVGPathSegLinetoHorizontalAbs(float x, SVGPathSegRole role) 171 172 { 172 return SVGPathSegLinetoHorizontalAbs::create( this, role, x);173 return SVGPathSegLinetoHorizontalAbs::create(*this, role, x); 173 174 } 174 175 175 176 Ref<SVGPathSegLinetoHorizontalRel> SVGPathElement::createSVGPathSegLinetoHorizontalRel(float x, SVGPathSegRole role) 176 177 { 177 return SVGPathSegLinetoHorizontalRel::create( this, role, x);178 return SVGPathSegLinetoHorizontalRel::create(*this, role, x); 178 179 } 179 180 180 181 Ref<SVGPathSegLinetoVerticalAbs> SVGPathElement::createSVGPathSegLinetoVerticalAbs(float y, SVGPathSegRole role) 181 182 { 182 return SVGPathSegLinetoVerticalAbs::create( this, role, y);183 return SVGPathSegLinetoVerticalAbs::create(*this, role, y); 183 184 } 184 185 185 186 Ref<SVGPathSegLinetoVerticalRel> SVGPathElement::createSVGPathSegLinetoVerticalRel(float y, SVGPathSegRole role) 186 187 { 187 return SVGPathSegLinetoVerticalRel::create( this, role, y);188 return SVGPathSegLinetoVerticalRel::create(*this, role, y); 188 189 } 189 190 190 191 Ref<SVGPathSegCurvetoCubicSmoothAbs> SVGPathElement::createSVGPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2, SVGPathSegRole role) 191 192 { 192 return SVGPathSegCurvetoCubicSmoothAbs::create( this, role, x, y, x2, y2);193 return SVGPathSegCurvetoCubicSmoothAbs::create(*this, role, x, y, x2, y2); 193 194 } 194 195 195 196 Ref<SVGPathSegCurvetoCubicSmoothRel> SVGPathElement::createSVGPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2, SVGPathSegRole role) 196 197 { 197 return SVGPathSegCurvetoCubicSmoothRel::create( this, role, x, y, x2, y2);198 return SVGPathSegCurvetoCubicSmoothRel::create(*this, role, x, y, x2, y2); 198 199 } 199 200 200 201 Ref<SVGPathSegCurvetoQuadraticSmoothAbs> SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y, SVGPathSegRole role) 201 202 { 202 return SVGPathSegCurvetoQuadraticSmoothAbs::create( this, role, x, y);203 return SVGPathSegCurvetoQuadraticSmoothAbs::create(*this, role, x, y); 203 204 } 204 205 205 206 Ref<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y, SVGPathSegRole role) 206 207 { 207 return SVGPathSegCurvetoQuadraticSmoothRel::create( this, role, x, y);208 return SVGPathSegCurvetoQuadraticSmoothRel::create(*this, role, x, y); 208 209 } 209 210 -
trunk/Source/WebCore/svg/SVGPathElement.h
r190844 r194964 98 98 bool isAnimValObserved() const { return m_isAnimValObserved; } 99 99 100 WeakPtr<SVGPathElement> createWeakPtr() const { return m_weakPtrFactory.createWeakPtr(); } 101 100 102 private: 101 103 SVGPathElement(const QualifiedName&, Document&); … … 127 129 SVGPathByteStream m_pathByteStream; 128 130 mutable SVGSynchronizableAnimatedProperty<SVGPathSegList> m_pathSegList; 131 WeakPtrFactory<SVGPathElement> m_weakPtrFactory; 129 132 bool m_isAnimValObserved; 130 133 }; -
trunk/Source/WebCore/svg/SVGPathSegArc.h
r163440 r194964 28 28 class SVGPathSegArc : public SVGPathSegWithContext { 29 29 public: 30 SVGPathSegArc( SVGPathElement*element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)30 SVGPathSegArc(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) 31 31 : SVGPathSegWithContext(element, role) 32 32 , m_x(x) -
trunk/Source/WebCore/svg/SVGPathSegArcAbs.h
r183536 r194964 29 29 class SVGPathSegArcAbs : public SVGPathSegArc { 30 30 public: 31 static Ref<SVGPathSegArcAbs> create( SVGPathElement*element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)31 static Ref<SVGPathSegArcAbs> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) 32 32 { 33 33 return adoptRef(*new SVGPathSegArcAbs(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag)); … … 35 35 36 36 private: 37 SVGPathSegArcAbs( SVGPathElement*element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)37 SVGPathSegArcAbs(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) 38 38 : SVGPathSegArc(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegArcRel.h
r183536 r194964 29 29 class SVGPathSegArcRel : public SVGPathSegArc { 30 30 public: 31 static Ref<SVGPathSegArcRel> create( SVGPathElement*element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)31 static Ref<SVGPathSegArcRel> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) 32 32 { 33 33 return adoptRef(*new SVGPathSegArcRel(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag)); … … 35 35 36 36 private: 37 SVGPathSegArcRel( SVGPathElement*element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag)37 SVGPathSegArcRel(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweepFlag) 38 38 : SVGPathSegArc(element, role, x, y, r1, r2, angle, largeArcFlag, sweepFlag) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegClosePath.h
r183536 r194964 28 28 class SVGPathSegClosePath : public SVGPathSegWithContext { 29 29 public: 30 static Ref<SVGPathSegClosePath> create( SVGPathElement*element, SVGPathSegRole role)30 static Ref<SVGPathSegClosePath> create(const SVGPathElement& element, SVGPathSegRole role) 31 31 { 32 32 return adoptRef(*new SVGPathSegClosePath(element, role)); … … 34 34 35 35 private: 36 SVGPathSegClosePath( SVGPathElement*element, SVGPathSegRole role)36 SVGPathSegClosePath(const SVGPathElement& element, SVGPathSegRole role) 37 37 : SVGPathSegWithContext(element, role) 38 38 { -
trunk/Source/WebCore/svg/SVGPathSegCurvetoCubic.h
r163440 r194964 28 28 class SVGPathSegCurvetoCubic : public SVGPathSegWithContext { 29 29 public: 30 SVGPathSegCurvetoCubic( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)30 SVGPathSegCurvetoCubic(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2) 31 31 : SVGPathSegWithContext(element, role) 32 32 , m_x(x) -
trunk/Source/WebCore/svg/SVGPathSegCurvetoCubicAbs.h
r183536 r194964 29 29 class SVGPathSegCurvetoCubicAbs : public SVGPathSegCurvetoCubic { 30 30 public: 31 static Ref<SVGPathSegCurvetoCubicAbs> create( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)31 static Ref<SVGPathSegCurvetoCubicAbs> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2) 32 32 { 33 33 return adoptRef(*new SVGPathSegCurvetoCubicAbs(element, role, x, y, x1, y1, x2, y2)); … … 35 35 36 36 private: 37 SVGPathSegCurvetoCubicAbs( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)37 SVGPathSegCurvetoCubicAbs(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2) 38 38 : SVGPathSegCurvetoCubic(element, role, x, y, x1, y1, x2, y2) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegCurvetoCubicRel.h
r183536 r194964 29 29 class SVGPathSegCurvetoCubicRel : public SVGPathSegCurvetoCubic { 30 30 public: 31 static Ref<SVGPathSegCurvetoCubicRel> create( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)31 static Ref<SVGPathSegCurvetoCubicRel> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2) 32 32 { 33 33 return adoptRef(*new SVGPathSegCurvetoCubicRel(element, role, x, y, x1, y1, x2, y2)); … … 35 35 36 36 private: 37 SVGPathSegCurvetoCubicRel( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2)37 SVGPathSegCurvetoCubicRel(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x1, float y1, float x2, float y2) 38 38 : SVGPathSegCurvetoCubic(element, role, x, y, x1, y1, x2, y2) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegCurvetoCubicSmooth.h
r163440 r194964 28 28 class SVGPathSegCurvetoCubicSmooth : public SVGPathSegWithContext { 29 29 public: 30 SVGPathSegCurvetoCubicSmooth( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x2, float y2)30 SVGPathSegCurvetoCubicSmooth(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x2, float y2) 31 31 : SVGPathSegWithContext(element, role) 32 32 , m_x(x) -
trunk/Source/WebCore/svg/SVGPathSegCurvetoCubicSmoothAbs.h
r183536 r194964 29 29 class SVGPathSegCurvetoCubicSmoothAbs : public SVGPathSegCurvetoCubicSmooth { 30 30 public: 31 static Ref<SVGPathSegCurvetoCubicSmoothAbs> create( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x2, float y2)31 static Ref<SVGPathSegCurvetoCubicSmoothAbs> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x2, float y2) 32 32 { 33 33 return adoptRef(*new SVGPathSegCurvetoCubicSmoothAbs(element, role, x, y, x2, y2)); … … 35 35 36 36 private: 37 SVGPathSegCurvetoCubicSmoothAbs( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x2, float y2)37 SVGPathSegCurvetoCubicSmoothAbs(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x2, float y2) 38 38 : SVGPathSegCurvetoCubicSmooth(element, role, x, y, x2, y2) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegCurvetoCubicSmoothRel.h
r183536 r194964 29 29 class SVGPathSegCurvetoCubicSmoothRel : public SVGPathSegCurvetoCubicSmooth { 30 30 public: 31 static Ref<SVGPathSegCurvetoCubicSmoothRel> create( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x2, float y2)31 static Ref<SVGPathSegCurvetoCubicSmoothRel> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x2, float y2) 32 32 { 33 33 return adoptRef(*new SVGPathSegCurvetoCubicSmoothRel(element, role, x, y, x2, y2)); … … 35 35 36 36 private: 37 SVGPathSegCurvetoCubicSmoothRel( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x2, float y2)37 SVGPathSegCurvetoCubicSmoothRel(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x2, float y2) 38 38 : SVGPathSegCurvetoCubicSmooth(element, role, x, y, x2, y2) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegCurvetoQuadratic.h
r163440 r194964 28 28 class SVGPathSegCurvetoQuadratic : public SVGPathSegWithContext { 29 29 public: 30 SVGPathSegCurvetoQuadratic( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x1, float y1)30 SVGPathSegCurvetoQuadratic(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x1, float y1) 31 31 : SVGPathSegWithContext(element, role) 32 32 , m_x(x) -
trunk/Source/WebCore/svg/SVGPathSegCurvetoQuadraticAbs.h
r183536 r194964 29 29 class SVGPathSegCurvetoQuadraticAbs : public SVGPathSegCurvetoQuadratic { 30 30 public: 31 static Ref<SVGPathSegCurvetoQuadraticAbs> create( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x1, float y1)31 static Ref<SVGPathSegCurvetoQuadraticAbs> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x1, float y1) 32 32 { 33 33 return adoptRef(*new SVGPathSegCurvetoQuadraticAbs(element, role, x, y, x1, y1)); … … 35 35 36 36 private: 37 SVGPathSegCurvetoQuadraticAbs( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x1, float y1)37 SVGPathSegCurvetoQuadraticAbs(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x1, float y1) 38 38 : SVGPathSegCurvetoQuadratic(element, role, x, y, x1, y1) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegCurvetoQuadraticRel.h
r183536 r194964 29 29 class SVGPathSegCurvetoQuadraticRel : public SVGPathSegCurvetoQuadratic { 30 30 public: 31 static Ref<SVGPathSegCurvetoQuadraticRel> create( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x1, float y1)31 static Ref<SVGPathSegCurvetoQuadraticRel> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x1, float y1) 32 32 { 33 33 return adoptRef(*new SVGPathSegCurvetoQuadraticRel(element, role, x, y, x1, y1)); … … 35 35 36 36 private: 37 SVGPathSegCurvetoQuadraticRel( SVGPathElement*element, SVGPathSegRole role, float x, float y, float x1, float y1)37 SVGPathSegCurvetoQuadraticRel(const SVGPathElement& element, SVGPathSegRole role, float x, float y, float x1, float y1) 38 38 : SVGPathSegCurvetoQuadratic(element, role, x, y, x1, y1) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothAbs.h
r183536 r194964 29 29 class SVGPathSegCurvetoQuadraticSmoothAbs : public SVGPathSegSingleCoordinate { 30 30 public: 31 static Ref<SVGPathSegCurvetoQuadraticSmoothAbs> create( SVGPathElement*element, SVGPathSegRole role, float x, float y)31 static Ref<SVGPathSegCurvetoQuadraticSmoothAbs> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 32 32 { 33 33 return adoptRef(*new SVGPathSegCurvetoQuadraticSmoothAbs(element, role, x, y)); … … 35 35 36 36 private: 37 SVGPathSegCurvetoQuadraticSmoothAbs( SVGPathElement*element, SVGPathSegRole role, float x, float y)37 SVGPathSegCurvetoQuadraticSmoothAbs(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 38 38 : SVGPathSegSingleCoordinate(element, role, x, y) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegCurvetoQuadraticSmoothRel.h
r183536 r194964 29 29 class SVGPathSegCurvetoQuadraticSmoothRel : public SVGPathSegSingleCoordinate { 30 30 public: 31 static Ref<SVGPathSegCurvetoQuadraticSmoothRel> create( SVGPathElement*element, SVGPathSegRole role, float x, float y)31 static Ref<SVGPathSegCurvetoQuadraticSmoothRel> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 32 32 { 33 33 return adoptRef(*new SVGPathSegCurvetoQuadraticSmoothRel(element, role, x, y)); … … 35 35 36 36 private: 37 SVGPathSegCurvetoQuadraticSmoothRel( SVGPathElement*element, SVGPathSegRole role, float x, float y)37 SVGPathSegCurvetoQuadraticSmoothRel(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 38 38 : SVGPathSegSingleCoordinate(element, role, x, y) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegLinetoAbs.h
r183536 r194964 29 29 class SVGPathSegLinetoAbs : public SVGPathSegSingleCoordinate { 30 30 public: 31 static Ref<SVGPathSegLinetoAbs> create( SVGPathElement*element, SVGPathSegRole role, float x, float y)31 static Ref<SVGPathSegLinetoAbs> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 32 32 { 33 33 return adoptRef(*new SVGPathSegLinetoAbs(element, role, x, y)); … … 35 35 36 36 private: 37 SVGPathSegLinetoAbs( SVGPathElement*element, SVGPathSegRole role, float x, float y)37 SVGPathSegLinetoAbs(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 38 38 : SVGPathSegSingleCoordinate(element, role, x, y) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegLinetoHorizontal.h
r163440 r194964 28 28 class SVGPathSegLinetoHorizontal : public SVGPathSegWithContext { 29 29 public: 30 SVGPathSegLinetoHorizontal( SVGPathElement*element, SVGPathSegRole role, float x)30 SVGPathSegLinetoHorizontal(const SVGPathElement& element, SVGPathSegRole role, float x) 31 31 : SVGPathSegWithContext(element, role) 32 32 , m_x(x) -
trunk/Source/WebCore/svg/SVGPathSegLinetoHorizontalAbs.h
r183536 r194964 29 29 class SVGPathSegLinetoHorizontalAbs : public SVGPathSegLinetoHorizontal { 30 30 public: 31 static Ref<SVGPathSegLinetoHorizontalAbs> create( SVGPathElement*element, SVGPathSegRole role, float x)31 static Ref<SVGPathSegLinetoHorizontalAbs> create(const SVGPathElement& element, SVGPathSegRole role, float x) 32 32 { 33 33 return adoptRef(*new SVGPathSegLinetoHorizontalAbs(element, role, x)); … … 35 35 36 36 private: 37 SVGPathSegLinetoHorizontalAbs( SVGPathElement*element, SVGPathSegRole role, float x)37 SVGPathSegLinetoHorizontalAbs(const SVGPathElement& element, SVGPathSegRole role, float x) 38 38 : SVGPathSegLinetoHorizontal(element, role, x) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegLinetoHorizontalRel.h
r183536 r194964 29 29 class SVGPathSegLinetoHorizontalRel : public SVGPathSegLinetoHorizontal { 30 30 public: 31 static Ref<SVGPathSegLinetoHorizontalRel> create( SVGPathElement*element, SVGPathSegRole role, float x)31 static Ref<SVGPathSegLinetoHorizontalRel> create(const SVGPathElement& element, SVGPathSegRole role, float x) 32 32 { 33 33 return adoptRef(*new SVGPathSegLinetoHorizontalRel(element, role, x)); … … 35 35 36 36 private: 37 SVGPathSegLinetoHorizontalRel( SVGPathElement*element, SVGPathSegRole role, float x)37 SVGPathSegLinetoHorizontalRel(const SVGPathElement& element, SVGPathSegRole role, float x) 38 38 : SVGPathSegLinetoHorizontal(element, role, x) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegLinetoRel.h
r183536 r194964 29 29 class SVGPathSegLinetoRel : public SVGPathSegSingleCoordinate { 30 30 public: 31 static Ref<SVGPathSegLinetoRel> create( SVGPathElement*element, SVGPathSegRole role, float x, float y)31 static Ref<SVGPathSegLinetoRel> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 32 32 { 33 33 return adoptRef(*new SVGPathSegLinetoRel(element, role, x, y)); … … 35 35 36 36 private: 37 SVGPathSegLinetoRel( SVGPathElement*element, SVGPathSegRole role, float x, float y)37 SVGPathSegLinetoRel(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 38 38 : SVGPathSegSingleCoordinate(element, role, x, y) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegLinetoVertical.h
r163440 r194964 28 28 class SVGPathSegLinetoVertical : public SVGPathSegWithContext { 29 29 public: 30 SVGPathSegLinetoVertical( SVGPathElement*element, SVGPathSegRole role, float y)30 SVGPathSegLinetoVertical(const SVGPathElement& element, SVGPathSegRole role, float y) 31 31 : SVGPathSegWithContext(element, role) 32 32 , m_y(y) -
trunk/Source/WebCore/svg/SVGPathSegLinetoVerticalAbs.h
r183536 r194964 29 29 class SVGPathSegLinetoVerticalAbs : public SVGPathSegLinetoVertical { 30 30 public: 31 static Ref<SVGPathSegLinetoVerticalAbs> create( SVGPathElement*element, SVGPathSegRole role, float y)31 static Ref<SVGPathSegLinetoVerticalAbs> create(const SVGPathElement& element, SVGPathSegRole role, float y) 32 32 { 33 33 return adoptRef(*new SVGPathSegLinetoVerticalAbs(element, role, y)); … … 35 35 36 36 private: 37 SVGPathSegLinetoVerticalAbs( SVGPathElement*element, SVGPathSegRole role, float y)37 SVGPathSegLinetoVerticalAbs(const SVGPathElement& element, SVGPathSegRole role, float y) 38 38 : SVGPathSegLinetoVertical(element, role, y) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegLinetoVerticalRel.h
r183536 r194964 29 29 class SVGPathSegLinetoVerticalRel : public SVGPathSegLinetoVertical { 30 30 public: 31 static Ref<SVGPathSegLinetoVerticalRel> create( SVGPathElement*element, SVGPathSegRole role, float y)31 static Ref<SVGPathSegLinetoVerticalRel> create(const SVGPathElement& element, SVGPathSegRole role, float y) 32 32 { 33 33 return adoptRef(*new SVGPathSegLinetoVerticalRel(element, role, y)); … … 35 35 36 36 private: 37 SVGPathSegLinetoVerticalRel( SVGPathElement*element, SVGPathSegRole role, float y)37 SVGPathSegLinetoVerticalRel(const SVGPathElement& element, SVGPathSegRole role, float y) 38 38 : SVGPathSegLinetoVertical(element, role, y) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegMovetoAbs.h
r183536 r194964 29 29 class SVGPathSegMovetoAbs : public SVGPathSegSingleCoordinate { 30 30 public: 31 static Ref<SVGPathSegMovetoAbs> create( SVGPathElement*element, SVGPathSegRole role, float x, float y)31 static Ref<SVGPathSegMovetoAbs> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 32 32 { 33 33 return adoptRef(*new SVGPathSegMovetoAbs(element, role, x, y)); … … 35 35 36 36 private: 37 SVGPathSegMovetoAbs( SVGPathElement*element, SVGPathSegRole role, float x, float y)37 SVGPathSegMovetoAbs(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 38 38 : SVGPathSegSingleCoordinate(element, role, x, y) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegMovetoRel.h
r183536 r194964 29 29 class SVGPathSegMovetoRel : public SVGPathSegSingleCoordinate { 30 30 public: 31 static Ref<SVGPathSegMovetoRel> create( SVGPathElement*element, SVGPathSegRole role, float x, float y)31 static Ref<SVGPathSegMovetoRel> create(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 32 32 { 33 33 return adoptRef(*new SVGPathSegMovetoRel(element, role, x, y)); … … 35 35 36 36 private: 37 SVGPathSegMovetoRel( SVGPathElement*element, SVGPathSegRole role, float x, float y)37 SVGPathSegMovetoRel(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 38 38 : SVGPathSegSingleCoordinate(element, role, x, y) 39 39 { -
trunk/Source/WebCore/svg/SVGPathSegWithContext.h
r163440 r194964 27 27 class SVGPathSegWithContext : public SVGPathSeg { 28 28 public: 29 SVGPathSegWithContext( SVGPathElement*element, SVGPathSegRole role)29 SVGPathSegWithContext(const SVGPathElement& element, SVGPathSegRole role) 30 30 : m_role(role) 31 , m_element(element )31 , m_element(element.createWeakPtr()) 32 32 { 33 33 } … … 35 35 SVGAnimatedProperty* animatedProperty() const 36 36 { 37 if (!m_element) 38 return nullptr; 39 37 40 switch (m_role) { 38 41 case PathSegUndefinedRole: 39 return 0;42 return nullptr; 40 43 case PathSegUnalteredRole: 41 44 return SVGAnimatedProperty::lookupWrapper<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(m_element.get(), SVGPathElement::dPropertyInfo()); 42 45 case PathSegNormalizedRole: 43 46 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=15412 - Implement normalized path segment lists! 44 return 0;47 return nullptr; 45 48 }; 46 49 47 return 0;50 return nullptr; 48 51 } 49 52 … … 54 57 { 55 58 m_role = role; 56 m_element = element ;59 m_element = element ? element->createWeakPtr() : WeakPtr<SVGPathElement>(); 57 60 } 58 61 … … 60 63 void commitChange() 61 64 { 62 if (!m_element) { 63 ASSERT(m_role == PathSegUndefinedRole); 65 if (!m_element || m_role == PathSegUndefinedRole) 64 66 return; 65 }66 67 ASSERT(m_role != PathSegUndefinedRole);68 67 m_element->pathSegListChanged(m_role); 69 68 } … … 71 70 private: 72 71 SVGPathSegRole m_role; 73 RefPtr<SVGPathElement> m_element;72 WeakPtr<SVGPathElement> m_element; 74 73 }; 75 74 … … 91 90 92 91 protected: 93 SVGPathSegSingleCoordinate( SVGPathElement*element, SVGPathSegRole role, float x, float y)92 SVGPathSegSingleCoordinate(const SVGPathElement& element, SVGPathSegRole role, float x, float y) 94 93 : SVGPathSegWithContext(element, role) 95 94 , m_x(x) -
trunk/Source/WebCore/svg/properties/SVGPathSegListPropertyTearOff.cpp
r184844 r194964 32 32 ASSERT(m_values); 33 33 for (auto& item : *m_values) { 34 static_cast<SVGPathSegWithContext*>(item.get())->setContextAndRole( 0, PathSegUndefinedRole);34 static_cast<SVGPathSegWithContext*>(item.get())->setContextAndRole(nullptr, PathSegUndefinedRole); 35 35 } 36 36 } … … 67 67 ListItemType replacedItem = m_values->at(index); 68 68 ASSERT(replacedItem); 69 static_cast<SVGPathSegWithContext*>(replacedItem.get())->setContextAndRole( 0, PathSegUndefinedRole);69 static_cast<SVGPathSegWithContext*>(replacedItem.get())->setContextAndRole(nullptr, PathSegUndefinedRole); 70 70 } 71 71 … … 77 77 SVGPathSegListPropertyTearOff::ListItemType removedItem = SVGPathSegListPropertyTearOff::Base::removeItemValues(index, ec); 78 78 if (removedItem) 79 static_cast<SVGPathSegWithContext*>(removedItem.get())->setContextAndRole( 0, PathSegUndefinedRole);79 static_cast<SVGPathSegWithContext*>(removedItem.get())->setContextAndRole(nullptr, PathSegUndefinedRole); 80 80 return removedItem; 81 81 }
Note: See TracChangeset
for help on using the changeset viewer.