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