| 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 SVGTests::addSupportedAttributes(supportedAttributes); | |
| 209 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 208 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
| 210 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 209 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
| 211 supportedAttributes.add(SVGNames::dAttr); | 210 supportedAttributes.add(SVGNames::dAttr); |
| 212 supportedAttributes.add(SVGNames::pathLengthAttr); | 211 supportedAttributes.add(SVGNames::pathLengthAttr); |
| 213 } | 212 } |
| 214 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 213 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 215 } | 214 } |
| 216 | 215 |
| 217 void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 216 void SVGPathElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
| 218 { | 217 { |
| 219 if (!isSupportedAttribute(name)) { | 218 if (!isSupportedAttribute(name)) { |
| 220 SVGGraphicsElement::parseAttribute(name, value); | 219 SVGGraphicsElement::parseAttribute(name, value); |
| 221 return; | 220 return; |
| 222 } | 221 } |
| 223 | 222 |
| 224 if (name == SVGNames::dAttr) { | 223 if (name == SVGNames::dAttr) { |
| 225 if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), Una
lteredParsing)) | 224 if (!buildSVGPathByteStreamFromString(value, m_pathByteStream.get(), Una
lteredParsing)) |
| 226 document()->accessSVGExtensions()->reportError("Problem parsing d=\"
" + value + "\""); | 225 document()->accessSVGExtensions()->reportError("Problem parsing d=\"
" + value + "\""); |
| 227 return; | 226 return; |
| 228 } | 227 } |
| 229 | 228 |
| 230 if (name == SVGNames::pathLengthAttr) { | 229 if (name == SVGNames::pathLengthAttr) { |
| 231 setPathLengthBaseValue(value.toFloat()); | 230 setPathLengthBaseValue(value.toFloat()); |
| 232 if (pathLengthBaseValue() < 0) | 231 if (pathLengthBaseValue() < 0) |
| 233 document()->accessSVGExtensions()->reportError("A negative value for
path attribute <pathLength> is not allowed"); | 232 document()->accessSVGExtensions()->reportError("A negative value for
path attribute <pathLength> is not allowed"); |
| 234 return; | 233 return; |
| 235 } | 234 } |
| 236 | 235 |
| 237 if (SVGTests::parseAttribute(name, value)) | |
| 238 return; | |
| 239 if (SVGLangSpace::parseAttribute(name, value)) | 236 if (SVGLangSpace::parseAttribute(name, value)) |
| 240 return; | 237 return; |
| 241 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | 238 if (SVGExternalResourcesRequired::parseAttribute(name, value)) |
| 242 return; | 239 return; |
| 243 | 240 |
| 244 ASSERT_NOT_REACHED(); | 241 ASSERT_NOT_REACHED(); |
| 245 } | 242 } |
| 246 | 243 |
| 247 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) | 244 void SVGPathElement::svgAttributeChanged(const QualifiedName& attrName) |
| 248 { | 245 { |
| 249 if (!isSupportedAttribute(attrName)) { | 246 if (!isSupportedAttribute(attrName)) { |
| 250 SVGGraphicsElement::svgAttributeChanged(attrName); | 247 SVGGraphicsElement::svgAttributeChanged(attrName); |
| 251 return; | 248 return; |
| 252 } | 249 } |
| 253 | 250 |
| 254 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 251 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 255 | |
| 256 if (SVGTests::handleAttributeChange(this, attrName)) | |
| 257 return; | |
| 258 | 252 |
| 259 RenderSVGPath* renderer = toRenderSVGPath(this->renderer()); | 253 RenderSVGPath* renderer = toRenderSVGPath(this->renderer()); |
| 260 | 254 |
| 261 if (attrName == SVGNames::dAttr) { | 255 if (attrName == SVGNames::dAttr) { |
| 262 if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapp
er<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo())
->isAnimating()) { | 256 if (m_pathSegList.shouldSynchronize && !SVGAnimatedProperty::lookupWrapp
er<SVGPathElement, SVGAnimatedPathSegListPropertyTearOff>(this, dPropertyInfo())
->isAnimating()) { |
| 263 SVGPathSegList newList(PathSegUnalteredRole); | 257 SVGPathSegList newList(PathSegUnalteredRole); |
| 264 buildSVGPathSegListFromByteStream(m_pathByteStream.get(), this, newL
ist, UnalteredParsing); | 258 buildSVGPathSegListFromByteStream(m_pathByteStream.get(), this, newL
ist, UnalteredParsing); |
| 265 m_pathSegList.value = newList; | 259 m_pathSegList.value = newList; |
| 266 } | 260 } |
| 267 | 261 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 return renderer->path().boundingRect(); | 394 return renderer->path().boundingRect(); |
| 401 } | 395 } |
| 402 | 396 |
| 403 RenderObject* SVGPathElement::createRenderer(RenderStyle*) | 397 RenderObject* SVGPathElement::createRenderer(RenderStyle*) |
| 404 { | 398 { |
| 405 // By default, any subclass is expected to do path-based drawing | 399 // By default, any subclass is expected to do path-based drawing |
| 406 return new (document()->renderArena()) RenderSVGPath(this); | 400 return new (document()->renderArena()) RenderSVGPath(this); |
| 407 } | 401 } |
| 408 | 402 |
| 409 } | 403 } |
| OLD | NEW |