OLD | NEW |
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, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 SVGNames::dAttr, | 60 SVGNames::dAttr, |
61 SVGNames::dAttr.localName(), | 61 SVGNames::dAttr.localName(), |
62 &SVGPathElement::synchronizeD, | 62 &SVGPathElement::synchronizeD, |
63 &SVGPathElement::lookupOrCreateDWra
pper); | 63 &SVGPathElement::lookupOrCreateDWra
pper); |
64 } | 64 } |
65 return s_propertyInfo; | 65 return s_propertyInfo; |
66 } | 66 } |
67 | 67 |
68 // Animated property definitions | 68 // Animated property definitions |
69 DEFINE_ANIMATED_NUMBER(SVGPathElement, SVGNames::pathLengthAttr, PathLength, pat
hLength) | 69 DEFINE_ANIMATED_NUMBER(SVGPathElement, SVGNames::pathLengthAttr, PathLength, pat
hLength) |
70 DEFINE_ANIMATED_BOOLEAN(SVGPathElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) | |
71 | 70 |
72 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPathElement) | 71 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPathElement) |
73 REGISTER_LOCAL_ANIMATED_PROPERTY(d) | 72 REGISTER_LOCAL_ANIMATED_PROPERTY(d) |
74 REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength) | 73 REGISTER_LOCAL_ANIMATED_PROPERTY(pathLength) |
75 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
76 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 74 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
77 END_REGISTER_ANIMATED_PROPERTIES | 75 END_REGISTER_ANIMATED_PROPERTIES |
78 | 76 |
79 inline SVGPathElement::SVGPathElement(Document& document) | 77 inline SVGPathElement::SVGPathElement(Document& document) |
80 : SVGGeometryElement(SVGNames::pathTag, document) | 78 : SVGGeometryElement(SVGNames::pathTag, document) |
81 , m_pathByteStream(SVGPathByteStream::create()) | 79 , m_pathByteStream(SVGPathByteStream::create()) |
82 , m_pathSegList(PathSegUnalteredRole) | 80 , m_pathSegList(PathSegUnalteredRole) |
83 , m_isAnimValObserved(false) | 81 , m_isAnimValObserved(false) |
84 { | 82 { |
85 ScriptWrappable::init(this); | 83 ScriptWrappable::init(this); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 202 |
205 PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::createSVGPathSeg
CurvetoQuadraticSmoothRel(float x, float y, SVGPathSegRole role) | 203 PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::createSVGPathSeg
CurvetoQuadraticSmoothRel(float x, float y, SVGPathSegRole role) |
206 { | 204 { |
207 return SVGPathSegCurvetoQuadraticSmoothRel::create(this, role, x, y); | 205 return SVGPathSegCurvetoQuadraticSmoothRel::create(this, role, x, y); |
208 } | 206 } |
209 | 207 |
210 bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName) | 208 bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName) |
211 { | 209 { |
212 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 210 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
213 if (supportedAttributes.isEmpty()) { | 211 if (supportedAttributes.isEmpty()) { |
214 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
215 supportedAttributes.add(SVGNames::dAttr); | 212 supportedAttributes.add(SVGNames::dAttr); |
216 supportedAttributes.add(SVGNames::pathLengthAttr); | 213 supportedAttributes.add(SVGNames::pathLengthAttr); |
217 } | 214 } |
218 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 215 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
219 } | 216 } |
220 | 217 |
221 void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 218 void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
222 { | 219 { |
223 if (!isSupportedAttribute(name)) { | 220 if (!isSupportedAttribute(name)) { |
224 SVGGeometryElement::parseAttribute(name, value); | 221 SVGGeometryElement::parseAttribute(name, value); |
225 return; | 222 return; |
226 } | 223 } |
227 | 224 |
228 if (name == SVGNames::dAttr) { | 225 if (name == SVGNames::dAttr) { |
229 if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), Una
lteredParsing)) | 226 if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), Una
lteredParsing)) |
230 document().accessSVGExtensions()->reportError("Problem parsing d=\""
+ value + "\""); | 227 document().accessSVGExtensions()->reportError("Problem parsing d=\""
+ value + "\""); |
231 return; | 228 return; |
232 } | 229 } |
233 | 230 |
234 if (name == SVGNames::pathLengthAttr) { | 231 if (name == SVGNames::pathLengthAttr) { |
235 setPathLengthBaseValue(value.toFloat()); | 232 setPathLengthBaseValue(value.toFloat()); |
236 if (pathLengthBaseValue() < 0) | 233 if (pathLengthBaseValue() < 0) |
237 document().accessSVGExtensions()->reportError("A negative value for
path attribute <pathLength> is not allowed"); | 234 document().accessSVGExtensions()->reportError("A negative value for
path attribute <pathLength> is not allowed"); |
238 return; | 235 return; |
239 } | 236 } |
240 | 237 |
241 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
242 return; | |
243 | |
244 ASSERT_NOT_REACHED(); | 238 ASSERT_NOT_REACHED(); |
245 } | 239 } |
246 | 240 |
247 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) | 241 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) |
248 { | 242 { |
249 if (!isSupportedAttribute(attrName)) { | 243 if (!isSupportedAttribute(attrName)) { |
250 SVGGeometryElement::svgAttributeChanged(attrName); | 244 SVGGeometryElement::svgAttributeChanged(attrName); |
251 return; | 245 return; |
252 } | 246 } |
253 | 247 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 return renderer->path().boundingRect(); | 391 return renderer->path().boundingRect(); |
398 } | 392 } |
399 | 393 |
400 RenderObject* SVGPathElement::createRenderer(RenderStyle*) | 394 RenderObject* SVGPathElement::createRenderer(RenderStyle*) |
401 { | 395 { |
402 // By default, any subclass is expected to do path-based drawing | 396 // By default, any subclass is expected to do path-based drawing |
403 return new RenderSVGPath(this); | 397 return new RenderSVGPath(this); |
404 } | 398 } |
405 | 399 |
406 } | 400 } |
OLD | NEW |