| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 } | 45 } |
| 46 return s_propertyInfo; | 46 return s_propertyInfo; |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Animated property definitions | 49 // Animated property definitions |
| 50 DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) | 50 DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) |
| 51 | 51 |
| 52 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) | 52 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) |
| 53 REGISTER_LOCAL_ANIMATED_PROPERTY(points) | 53 REGISTER_LOCAL_ANIMATED_PROPERTY(points) |
| 54 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | 54 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) |
| 55 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGStyledTransformableElement) | 55 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
| 56 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGTests) | |
| 57 END_REGISTER_ANIMATED_PROPERTIES | 56 END_REGISTER_ANIMATED_PROPERTIES |
| 58 | 57 |
| 59 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document* document) | 58 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document* document) |
| 60 : SVGStyledTransformableElement(tagName, document) | 59 : SVGGraphicsElement(tagName, document) |
| 61 { | 60 { |
| 62 registerAnimatedPropertiesForSVGPolyElement(); | 61 registerAnimatedPropertiesForSVGPolyElement(); |
| 63 } | 62 } |
| 64 | 63 |
| 65 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) | 64 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) |
| 66 { | 65 { |
| 67 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 66 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 68 if (supportedAttributes.isEmpty()) { | 67 if (supportedAttributes.isEmpty()) { |
| 69 SVGTests::addSupportedAttributes(supportedAttributes); | 68 SVGTests::addSupportedAttributes(supportedAttributes); |
| 70 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 69 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
| 71 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 70 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
| 72 supportedAttributes.add(SVGNames::pointsAttr); | 71 supportedAttributes.add(SVGNames::pointsAttr); |
| 73 } | 72 } |
| 74 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 73 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 75 } | 74 } |
| 76 | 75 |
| 77 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 76 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
| 78 { | 77 { |
| 79 if (!isSupportedAttribute(name)) { | 78 if (!isSupportedAttribute(name)) { |
| 80 SVGStyledTransformableElement::parseAttribute(name, value); | 79 SVGGraphicsElement::parseAttribute(name, value); |
| 81 return; | 80 return; |
| 82 } | 81 } |
| 83 | 82 |
| 84 if (name == SVGNames::pointsAttr) { | 83 if (name == SVGNames::pointsAttr) { |
| 85 SVGPointList newList; | 84 SVGPointList newList; |
| 86 if (!pointsListFromSVGData(newList, value)) | 85 if (!pointsListFromSVGData(newList, value)) |
| 87 document()->accessSVGExtensions()->reportError("Problem parsing poin
ts=\"" + value + "\""); | 86 document()->accessSVGExtensions()->reportError("Problem parsing poin
ts=\"" + value + "\""); |
| 88 | 87 |
| 89 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV
GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) | 88 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV
GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) |
| 90 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL
ist.size()); | 89 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL
ist.size()); |
| 91 | 90 |
| 92 m_points.value = newList; | 91 m_points.value = newList; |
| 93 return; | 92 return; |
| 94 } | 93 } |
| 95 | 94 |
| 96 if (SVGTests::parseAttribute(name, value)) | 95 if (SVGTests::parseAttribute(name, value)) |
| 97 return; | 96 return; |
| 98 if (SVGLangSpace::parseAttribute(name, value)) | 97 if (SVGLangSpace::parseAttribute(name, value)) |
| 99 return; | 98 return; |
| 100 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | 99 if (SVGExternalResourcesRequired::parseAttribute(name, value)) |
| 101 return; | 100 return; |
| 102 | 101 |
| 103 ASSERT_NOT_REACHED(); | 102 ASSERT_NOT_REACHED(); |
| 104 } | 103 } |
| 105 | 104 |
| 106 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) | 105 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) |
| 107 { | 106 { |
| 108 if (!isSupportedAttribute(attrName)) { | 107 if (!isSupportedAttribute(attrName)) { |
| 109 SVGStyledTransformableElement::svgAttributeChanged(attrName); | 108 SVGGraphicsElement::svgAttributeChanged(attrName); |
| 110 return; | 109 return; |
| 111 } | 110 } |
| 112 | 111 |
| 113 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 112 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 114 | 113 |
| 115 if (SVGTests::handleAttributeChange(this, attrName)) | 114 if (SVGTests::handleAttributeChange(this, attrName)) |
| 116 return; | 115 return; |
| 117 | 116 |
| 118 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 117 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
| 119 if (!renderer) | 118 if (!renderer) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); | 155 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); |
| 157 } | 156 } |
| 158 | 157 |
| 159 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() | 158 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() |
| 160 { | 159 { |
| 161 m_points.shouldSynchronize = true; | 160 m_points.shouldSynchronize = true; |
| 162 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); | 161 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); |
| 163 } | 162 } |
| 164 | 163 |
| 165 } | 164 } |
| OLD | NEW |