Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGPathElement.cpp

Issue 1416273002: Remove SVGPathElement.pathSegList and related interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2008 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details. 13 * Library General Public License for more details.
14 * 14 *
15 * You should have received a copy of the GNU Library General Public License 15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to 16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA. 18 * Boston, MA 02110-1301, USA.
19 */ 19 */
20 20
21 #include "config.h" 21 #include "config.h"
22 #include "core/svg/SVGPathElement.h" 22 #include "core/svg/SVGPathElement.h"
23 23
24 #include "core/layout/svg/LayoutSVGPath.h" 24 #include "core/layout/svg/LayoutSVGPath.h"
25 #include "core/svg/SVGDocumentExtensions.h" 25 #include "core/svg/SVGDocumentExtensions.h"
26 #include "core/svg/SVGMPathElement.h" 26 #include "core/svg/SVGMPathElement.h"
27 #include "core/svg/SVGPathSegArcAbs.h"
28 #include "core/svg/SVGPathSegArcRel.h"
29 #include "core/svg/SVGPathSegClosePath.h"
30 #include "core/svg/SVGPathSegCurvetoCubicAbs.h"
31 #include "core/svg/SVGPathSegCurvetoCubicRel.h"
32 #include "core/svg/SVGPathSegCurvetoCubicSmoothAbs.h"
33 #include "core/svg/SVGPathSegCurvetoCubicSmoothRel.h"
34 #include "core/svg/SVGPathSegCurvetoQuadraticAbs.h"
35 #include "core/svg/SVGPathSegCurvetoQuadraticRel.h"
36 #include "core/svg/SVGPathSegCurvetoQuadraticSmoothAbs.h"
37 #include "core/svg/SVGPathSegCurvetoQuadraticSmoothRel.h"
38 #include "core/svg/SVGPathSegLinetoAbs.h"
39 #include "core/svg/SVGPathSegLinetoHorizontalAbs.h"
40 #include "core/svg/SVGPathSegLinetoHorizontalRel.h"
41 #include "core/svg/SVGPathSegLinetoRel.h"
42 #include "core/svg/SVGPathSegLinetoVerticalAbs.h"
43 #include "core/svg/SVGPathSegLinetoVerticalRel.h"
44 #include "core/svg/SVGPathSegMovetoAbs.h"
45 #include "core/svg/SVGPathSegMovetoRel.h"
46 #include "core/svg/SVGPathUtilities.h" 27 #include "core/svg/SVGPathUtilities.h"
47 #include "core/svg/SVGPointTearOff.h" 28 #include "core/svg/SVGPointTearOff.h"
48 29
49 namespace blink { 30 namespace blink {
50 31
51 class SVGAnimatedPathLength final : public SVGAnimatedNumber { 32 class SVGAnimatedPathLength final : public SVGAnimatedNumber {
52 public: 33 public:
53 static PassRefPtrWillBeRawPtr<SVGAnimatedPathLength> create(SVGPathElement* contextElement) 34 static PassRefPtrWillBeRawPtr<SVGAnimatedPathLength> create(SVGPathElement* contextElement)
54 { 35 {
55 return adoptRefWillBeNoop(new SVGAnimatedPathLength(contextElement)); 36 return adoptRefWillBeNoop(new SVGAnimatedPathLength(contextElement));
(...skipping 11 matching lines...) Expand all
67 private: 48 private:
68 explicit SVGAnimatedPathLength(SVGPathElement* contextElement) 49 explicit SVGAnimatedPathLength(SVGPathElement* contextElement)
69 : SVGAnimatedNumber(contextElement, SVGNames::pathLengthAttr, SVGNumber: :create()) 50 : SVGAnimatedNumber(contextElement, SVGNames::pathLengthAttr, SVGNumber: :create())
70 { 51 {
71 } 52 }
72 }; 53 };
73 54
74 inline SVGPathElement::SVGPathElement(Document& document) 55 inline SVGPathElement::SVGPathElement(Document& document)
75 : SVGGeometryElement(SVGNames::pathTag, document) 56 : SVGGeometryElement(SVGNames::pathTag, document)
76 , m_pathLength(SVGAnimatedPathLength::create(this)) 57 , m_pathLength(SVGAnimatedPathLength::create(this))
77 , m_pathSegList(SVGAnimatedPath::create(this, SVGNames::dAttr)) 58 , m_path(SVGAnimatedPath::create(this, SVGNames::dAttr))
78 { 59 {
79 addToPropertyMap(m_pathLength); 60 addToPropertyMap(m_pathLength);
80 addToPropertyMap(m_pathSegList); 61 addToPropertyMap(m_path);
81 } 62 }
82 63
83 DEFINE_TRACE(SVGPathElement) 64 DEFINE_TRACE(SVGPathElement)
84 { 65 {
85 visitor->trace(m_pathLength); 66 visitor->trace(m_pathLength);
86 visitor->trace(m_pathSegList); 67 visitor->trace(m_path);
87 SVGGeometryElement::trace(visitor); 68 SVGGeometryElement::trace(visitor);
88 } 69 }
89 70
90 DEFINE_NODE_FACTORY(SVGPathElement) 71 DEFINE_NODE_FACTORY(SVGPathElement)
91 72
92 Path SVGPathElement::asPath() const 73 Path SVGPathElement::asPath() const
93 { 74 {
94 Path path; 75 Path path;
95 buildPathFromByteStream(pathByteStream(), path); 76 buildPathFromByteStream(pathByteStream(), path);
96 return path; 77 return path;
97 } 78 }
98 79
99 float SVGPathElement::getTotalLength() 80 float SVGPathElement::getTotalLength()
100 { 81 {
101 return getTotalLengthOfSVGPathByteStream(pathByteStream()); 82 return getTotalLengthOfSVGPathByteStream(pathByteStream());
102 } 83 }
103 84
104 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGPathElement::getPointAtLength(float l ength) 85 PassRefPtrWillBeRawPtr<SVGPointTearOff> SVGPathElement::getPointAtLength(float l ength)
105 { 86 {
106 FloatPoint point = getPointAtLengthOfSVGPathByteStream(pathByteStream(), len gth); 87 FloatPoint point = getPointAtLengthOfSVGPathByteStream(pathByteStream(), len gth);
107 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim Val); 88 return SVGPointTearOff::create(SVGPoint::create(point), 0, PropertyIsNotAnim Val);
108 } 89 }
109 90
110 unsigned SVGPathElement::getPathSegAtLength(float length) 91 unsigned SVGPathElement::getPathSegAtLength(float length)
111 { 92 {
112 return getSVGPathSegAtLengthFromSVGPathByteStream(pathByteStream(), length); 93 return getSVGPathSegAtLengthFromSVGPathByteStream(pathByteStream(), length);
113 } 94 }
114 95
115 PassRefPtrWillBeRawPtr<SVGPathSegClosePath> SVGPathElement::createSVGPathSegClos ePath()
116 {
117 return SVGPathSegClosePath::create(0);
118 }
119
120 PassRefPtrWillBeRawPtr<SVGPathSegMovetoAbs> SVGPathElement::createSVGPathSegMove toAbs(float x, float y)
121 {
122 return SVGPathSegMovetoAbs::create(0, x, y);
123 }
124
125 PassRefPtrWillBeRawPtr<SVGPathSegMovetoRel> SVGPathElement::createSVGPathSegMove toRel(float x, float y)
126 {
127 return SVGPathSegMovetoRel::create(0, x, y);
128 }
129
130 PassRefPtrWillBeRawPtr<SVGPathSegLinetoAbs> SVGPathElement::createSVGPathSegLine toAbs(float x, float y)
131 {
132 return SVGPathSegLinetoAbs::create(0, x, y);
133 }
134
135 PassRefPtrWillBeRawPtr<SVGPathSegLinetoRel> SVGPathElement::createSVGPathSegLine toRel(float x, float y)
136 {
137 return SVGPathSegLinetoRel::create(0, x, y);
138 }
139
140 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicAbs> SVGPathElement::createSVGPathS egCurvetoCubicAbs(float x, float y, float x1, float y1, float x2, float y2)
141 {
142 return SVGPathSegCurvetoCubicAbs::create(0, x, y, x1, y1, x2, y2);
143 }
144
145 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicRel> SVGPathElement::createSVGPathS egCurvetoCubicRel(float x, float y, float x1, float y1, float x2, float y2)
146 {
147 return SVGPathSegCurvetoCubicRel::create(0, x, y, x1, y1, x2, y2);
148 }
149
150 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticAbs> SVGPathElement::createSVGP athSegCurvetoQuadraticAbs(float x, float y, float x1, float y1)
151 {
152 return SVGPathSegCurvetoQuadraticAbs::create(0, x, y, x1, y1);
153 }
154
155 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticRel> SVGPathElement::createSVGP athSegCurvetoQuadraticRel(float x, float y, float x1, float y1)
156 {
157 return SVGPathSegCurvetoQuadraticRel::create(0, x, y, x1, y1);
158 }
159
160 PassRefPtrWillBeRawPtr<SVGPathSegArcAbs> SVGPathElement::createSVGPathSegArcAbs( float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweep Flag)
161 {
162 return SVGPathSegArcAbs::create(0, x, y, r1, r2, angle, largeArcFlag, sweepF lag);
163 }
164
165 PassRefPtrWillBeRawPtr<SVGPathSegArcRel> SVGPathElement::createSVGPathSegArcRel( float x, float y, float r1, float r2, float angle, bool largeArcFlag, bool sweep Flag)
166 {
167 return SVGPathSegArcRel::create(0, x, y, r1, r2, angle, largeArcFlag, sweepF lag);
168 }
169
170 PassRefPtrWillBeRawPtr<SVGPathSegLinetoHorizontalAbs> SVGPathElement::createSVGP athSegLinetoHorizontalAbs(float x)
171 {
172 return SVGPathSegLinetoHorizontalAbs::create(0, x);
173 }
174
175 PassRefPtrWillBeRawPtr<SVGPathSegLinetoHorizontalRel> SVGPathElement::createSVGP athSegLinetoHorizontalRel(float x)
176 {
177 return SVGPathSegLinetoHorizontalRel::create(0, x);
178 }
179
180 PassRefPtrWillBeRawPtr<SVGPathSegLinetoVerticalAbs> SVGPathElement::createSVGPat hSegLinetoVerticalAbs(float y)
181 {
182 return SVGPathSegLinetoVerticalAbs::create(0, y);
183 }
184
185 PassRefPtrWillBeRawPtr<SVGPathSegLinetoVerticalRel> SVGPathElement::createSVGPat hSegLinetoVerticalRel(float y)
186 {
187 return SVGPathSegLinetoVerticalRel::create(0, y);
188 }
189
190 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicSmoothAbs> SVGPathElement::createSV GPathSegCurvetoCubicSmoothAbs(float x, float y, float x2, float y2)
191 {
192 return SVGPathSegCurvetoCubicSmoothAbs::create(0, x, y, x2, y2);
193 }
194
195 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoCubicSmoothRel> SVGPathElement::createSV GPathSegCurvetoCubicSmoothRel(float x, float y, float x2, float y2)
196 {
197 return SVGPathSegCurvetoCubicSmoothRel::create(0, x, y, x2, y2);
198 }
199
200 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticSmoothAbs> SVGPathElement::crea teSVGPathSegCurvetoQuadraticSmoothAbs(float x, float y)
201 {
202 return SVGPathSegCurvetoQuadraticSmoothAbs::create(0, x, y);
203 }
204
205 PassRefPtrWillBeRawPtr<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::crea teSVGPathSegCurvetoQuadraticSmoothRel(float x, float y)
206 {
207 return SVGPathSegCurvetoQuadraticSmoothRel::create(0, x, y);
208 }
209
210 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) 96 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName)
211 { 97 {
212 if (attrName == SVGNames::dAttr || attrName == SVGNames::pathLengthAttr) { 98 if (attrName == SVGNames::dAttr || attrName == SVGNames::pathLengthAttr) {
213 SVGElement::InvalidationGuard invalidationGuard(this); 99 SVGElement::InvalidationGuard invalidationGuard(this);
214 100
215 LayoutSVGShape* layoutObject = toLayoutSVGShape(this->layoutObject()); 101 LayoutSVGShape* layoutObject = toLayoutSVGShape(this->layoutObject());
216 102
217 if (attrName == SVGNames::dAttr) { 103 if (attrName == SVGNames::dAttr) {
218 if (layoutObject) 104 if (layoutObject)
219 layoutObject->setNeedsShapeUpdate(); 105 layoutObject->setNeedsShapeUpdate();
(...skipping 28 matching lines...) Expand all
248 invalidateMPathDependencies(); 134 invalidateMPathDependencies();
249 return InsertionDone; 135 return InsertionDone;
250 } 136 }
251 137
252 void SVGPathElement::removedFrom(ContainerNode* rootParent) 138 void SVGPathElement::removedFrom(ContainerNode* rootParent)
253 { 139 {
254 SVGGeometryElement::removedFrom(rootParent); 140 SVGGeometryElement::removedFrom(rootParent);
255 invalidateMPathDependencies(); 141 invalidateMPathDependencies();
256 } 142 }
257 143
258 void SVGPathElement::pathSegListChanged(ListModification listModification)
259 {
260 m_pathSegList->baseValue()->clearByteStream();
261
262 invalidateSVGAttributes();
263
264 SVGElement::InvalidationGuard invalidationGuard(this);
265 LayoutSVGShape* layoutObject = toLayoutSVGShape(this->layoutObject());
266 if (!layoutObject)
267 return;
268
269 layoutObject->setNeedsShapeUpdate();
270 markForLayoutAndParentResourceInvalidation(layoutObject);
271 }
272
273 } // namespace blink 144 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGPathElement.h ('k') | third_party/WebKit/Source/core/svg/SVGPathElement.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698