| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyEle
ment, SVGAnimatedPointList>(this, pointsPropertyInfo()); | 50 SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SVGPolyEle
ment, SVGAnimatedPointList>(this, pointsPropertyInfo()); |
| 51 if (wrapper && wrapper->isAnimating()) { | 51 if (wrapper && wrapper->isAnimating()) { |
| 52 if (SVGListPropertyTearOff<SVGPointList>* ap = animatedPoints()) | 52 if (SVGListPropertyTearOff<SVGPointList>* ap = animatedPoints()) |
| 53 return ap->values(); | 53 return ap->values(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 return m_points.value; | 56 return m_points.value; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Animated property definitions | 59 // Animated property definitions |
| 60 DEFINE_ANIMATED_BOOLEAN(SVGPolyElement, SVGNames::externalResourcesRequiredAttr,
ExternalResourcesRequired, externalResourcesRequired) | |
| 61 | 60 |
| 62 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) | 61 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) |
| 63 REGISTER_LOCAL_ANIMATED_PROPERTY(points) | 62 REGISTER_LOCAL_ANIMATED_PROPERTY(points) |
| 64 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
| 65 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 63 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
| 66 END_REGISTER_ANIMATED_PROPERTIES | 64 END_REGISTER_ANIMATED_PROPERTIES |
| 67 | 65 |
| 68 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) | 66 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) |
| 69 : SVGGeometryElement(tagName, document) | 67 : SVGGeometryElement(tagName, document) |
| 70 { | 68 { |
| 71 registerAnimatedPropertiesForSVGPolyElement(); | 69 registerAnimatedPropertiesForSVGPolyElement(); |
| 72 } | 70 } |
| 73 | 71 |
| 74 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) | 72 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) |
| 75 { | 73 { |
| 76 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 74 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
| 77 if (supportedAttributes.isEmpty()) { | 75 if (supportedAttributes.isEmpty()) { |
| 78 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
| 79 supportedAttributes.add(SVGNames::pointsAttr); | 76 supportedAttributes.add(SVGNames::pointsAttr); |
| 80 } | 77 } |
| 81 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 78 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
| 82 } | 79 } |
| 83 | 80 |
| 84 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 81 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
| 85 { | 82 { |
| 86 if (!isSupportedAttribute(name)) { | 83 if (!isSupportedAttribute(name)) { |
| 87 SVGGeometryElement::parseAttribute(name, value); | 84 SVGGeometryElement::parseAttribute(name, value); |
| 88 return; | 85 return; |
| 89 } | 86 } |
| 90 | 87 |
| 91 if (name == SVGNames::pointsAttr) { | 88 if (name == SVGNames::pointsAttr) { |
| 92 SVGPointList newList; | 89 SVGPointList newList; |
| 93 if (!pointsListFromSVGData(newList, value)) | 90 if (!pointsListFromSVGData(newList, value)) |
| 94 document().accessSVGExtensions()->reportError("Problem parsing point
s=\"" + value + "\""); | 91 document().accessSVGExtensions()->reportError("Problem parsing point
s=\"" + value + "\""); |
| 95 | 92 |
| 96 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV
GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) | 93 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV
GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) |
| 97 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL
ist.size()); | 94 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL
ist.size()); |
| 98 | 95 |
| 99 m_points.value = newList; | 96 m_points.value = newList; |
| 100 return; | 97 return; |
| 101 } | 98 } |
| 102 | 99 |
| 103 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
| 104 return; | |
| 105 | |
| 106 ASSERT_NOT_REACHED(); | 100 ASSERT_NOT_REACHED(); |
| 107 } | 101 } |
| 108 | 102 |
| 109 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) | 103 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) |
| 110 { | 104 { |
| 111 if (!isSupportedAttribute(attrName)) { | 105 if (!isSupportedAttribute(attrName)) { |
| 112 SVGGeometryElement::svgAttributeChanged(attrName); | 106 SVGGeometryElement::svgAttributeChanged(attrName); |
| 113 return; | 107 return; |
| 114 } | 108 } |
| 115 | 109 |
| 116 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 110 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
| 117 | 111 |
| 118 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 112 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
| 119 if (!renderer) | 113 if (!renderer) |
| 120 return; | 114 return; |
| 121 | 115 |
| 122 if (attrName == SVGNames::pointsAttr) { | 116 if (attrName == SVGNames::pointsAttr) { |
| 123 renderer->setNeedsShapeUpdate(); | 117 renderer->setNeedsShapeUpdate(); |
| 124 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 118 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
| 125 return; | 119 return; |
| 126 } | 120 } |
| 127 | 121 |
| 128 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { | |
| 129 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | |
| 130 return; | |
| 131 } | |
| 132 | |
| 133 ASSERT_NOT_REACHED(); | 122 ASSERT_NOT_REACHED(); |
| 134 } | 123 } |
| 135 | 124 |
| 136 void SVGPolyElement::synchronizePoints(SVGElement* contextElement) | 125 void SVGPolyElement::synchronizePoints(SVGElement* contextElement) |
| 137 { | 126 { |
| 138 ASSERT(contextElement); | 127 ASSERT(contextElement); |
| 139 SVGPolyElement* ownerType = toSVGPolyElement(contextElement); | 128 SVGPolyElement* ownerType = toSVGPolyElement(contextElement); |
| 140 if (!ownerType->m_points.shouldSynchronize) | 129 if (!ownerType->m_points.shouldSynchronize) |
| 141 return; | 130 return; |
| 142 ownerType->m_points.synchronize(ownerType, pointsPropertyInfo()->attributeNa
me, AtomicString(ownerType->m_points.value.valueAsString())); | 131 ownerType->m_points.synchronize(ownerType, pointsPropertyInfo()->attributeNa
me, AtomicString(ownerType->m_points.value.valueAsString())); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 156 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); | 145 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); |
| 157 } | 146 } |
| 158 | 147 |
| 159 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() | 148 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() |
| 160 { | 149 { |
| 161 m_points.shouldSynchronize = true; | 150 m_points.shouldSynchronize = true; |
| 162 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); | 151 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); |
| 163 } | 152 } |
| 164 | 153 |
| 165 } | 154 } |
| OLD | NEW |