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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::createSVGPathSeg
CurvetoQuadraticSmoothRel(float x, float y, SVGPathSegRole role) | 199 PassRefPtr<SVGPathSegCurvetoQuadraticSmoothRel> SVGPathElement::createSVGPathSeg
CurvetoQuadraticSmoothRel(float x, float y, SVGPathSegRole role) |
200 { | 200 { |
201 return SVGPathSegCurvetoQuadraticSmoothRel::create(this, role, x, y); | 201 return SVGPathSegCurvetoQuadraticSmoothRel::create(this, role, x, y); |
202 } | 202 } |
203 | 203 |
204 bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName) | 204 bool SVGPathElement::isSupportedAttribute(const QualifiedName& attrName) |
205 { | 205 { |
206 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 206 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
207 if (supportedAttributes.isEmpty()) { | 207 if (supportedAttributes.isEmpty()) { |
208 SVGLangSpace::addSupportedAttributes(supportedAttributes); | |
209 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 208 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
210 supportedAttributes.add(SVGNames::dAttr); | 209 supportedAttributes.add(SVGNames::dAttr); |
211 supportedAttributes.add(SVGNames::pathLengthAttr); | 210 supportedAttributes.add(SVGNames::pathLengthAttr); |
212 } | 211 } |
213 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 212 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
214 } | 213 } |
215 | 214 |
216 void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 215 void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
217 { | 216 { |
218 if (!isSupportedAttribute(name)) { | 217 if (!isSupportedAttribute(name)) { |
219 SVGGraphicsElement::parseAttribute(name, value); | 218 SVGGraphicsElement::parseAttribute(name, value); |
220 return; | 219 return; |
221 } | 220 } |
222 | 221 |
223 if (name == SVGNames::dAttr) { | 222 if (name == SVGNames::dAttr) { |
224 if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), Una
lteredParsing)) | 223 if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), Una
lteredParsing)) |
225 document()->accessSVGExtensions()->reportError("Problem parsing d=\"
" + value + "\""); | 224 document()->accessSVGExtensions()->reportError("Problem parsing d=\"
" + value + "\""); |
226 return; | 225 return; |
227 } | 226 } |
228 | 227 |
229 if (name == SVGNames::pathLengthAttr) { | 228 if (name == SVGNames::pathLengthAttr) { |
230 setPathLengthBaseValue(value.toFloat()); | 229 setPathLengthBaseValue(value.toFloat()); |
231 if (pathLengthBaseValue() < 0) | 230 if (pathLengthBaseValue() < 0) |
232 document()->accessSVGExtensions()->reportError("A negative value for
path attribute <pathLength> is not allowed"); | 231 document()->accessSVGExtensions()->reportError("A negative value for
path attribute <pathLength> is not allowed"); |
233 return; | 232 return; |
234 } | 233 } |
235 | 234 |
236 if (SVGLangSpace::parseAttribute(name, value)) | |
237 return; | |
238 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | 235 if (SVGExternalResourcesRequired::parseAttribute(name, value)) |
239 return; | 236 return; |
240 | 237 |
241 ASSERT_NOT_REACHED(); | 238 ASSERT_NOT_REACHED(); |
242 } | 239 } |
243 | 240 |
244 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) | 241 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) |
245 { | 242 { |
246 if (!isSupportedAttribute(attrName)) { | 243 if (!isSupportedAttribute(attrName)) { |
247 SVGGraphicsElement::svgAttributeChanged(attrName); | 244 SVGGraphicsElement::svgAttributeChanged(attrName); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 return renderer->path().boundingRect(); | 391 return renderer->path().boundingRect(); |
395 } | 392 } |
396 | 393 |
397 RenderObject* SVGPathElement::createRenderer(RenderStyle*) | 394 RenderObject* SVGPathElement::createRenderer(RenderStyle*) |
398 { | 395 { |
399 // By default, any subclass is expected to do path-based drawing | 396 // By default, any subclass is expected to do path-based drawing |
400 return new (document()->renderArena()) RenderSVGPath(this); | 397 return new (document()->renderArena()) RenderSVGPath(this); |
401 } | 398 } |
402 | 399 |
403 } | 400 } |
OLD | NEW |