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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) | 68 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) |
69 : SVGGeometryElement(tagName, document) | 69 : SVGGeometryElement(tagName, document) |
70 { | 70 { |
71 registerAnimatedPropertiesForSVGPolyElement(); | 71 registerAnimatedPropertiesForSVGPolyElement(); |
72 } | 72 } |
73 | 73 |
74 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) | 74 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) |
75 { | 75 { |
76 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 76 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
77 if (supportedAttributes.isEmpty()) { | 77 if (supportedAttributes.isEmpty()) { |
78 SVGLangSpace::addSupportedAttributes(supportedAttributes); | |
79 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 78 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
80 supportedAttributes.add(SVGNames::pointsAttr); | 79 supportedAttributes.add(SVGNames::pointsAttr); |
81 } | 80 } |
82 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 81 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
83 } | 82 } |
84 | 83 |
85 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 84 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
86 { | 85 { |
87 if (!isSupportedAttribute(name)) { | 86 if (!isSupportedAttribute(name)) { |
88 SVGGeometryElement::parseAttribute(name, value); | 87 SVGGeometryElement::parseAttribute(name, value); |
89 return; | 88 return; |
90 } | 89 } |
91 | 90 |
92 if (name == SVGNames::pointsAttr) { | 91 if (name == SVGNames::pointsAttr) { |
93 SVGPointList newList; | 92 SVGPointList newList; |
94 if (!pointsListFromSVGData(newList, value)) | 93 if (!pointsListFromSVGData(newList, value)) |
95 document().accessSVGExtensions()->reportError("Problem parsing point
s=\"" + value + "\""); | 94 document().accessSVGExtensions()->reportError("Problem parsing point
s=\"" + value + "\""); |
96 | 95 |
97 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV
GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) | 96 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV
GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) |
98 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL
ist.size()); | 97 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL
ist.size()); |
99 | 98 |
100 m_points.value = newList; | 99 m_points.value = newList; |
101 return; | 100 return; |
102 } | 101 } |
103 | 102 |
104 if (SVGLangSpace::parseAttribute(name, value)) | |
105 return; | |
106 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | 103 if (SVGExternalResourcesRequired::parseAttribute(name, value)) |
107 return; | 104 return; |
108 | 105 |
109 ASSERT_NOT_REACHED(); | 106 ASSERT_NOT_REACHED(); |
110 } | 107 } |
111 | 108 |
112 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) | 109 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) |
113 { | 110 { |
114 if (!isSupportedAttribute(attrName)) { | 111 if (!isSupportedAttribute(attrName)) { |
115 SVGGeometryElement::svgAttributeChanged(attrName); | 112 SVGGeometryElement::svgAttributeChanged(attrName); |
116 return; | 113 return; |
117 } | 114 } |
118 | 115 |
119 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 116 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
120 | 117 |
121 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 118 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
122 if (!renderer) | 119 if (!renderer) |
123 return; | 120 return; |
124 | 121 |
125 if (attrName == SVGNames::pointsAttr) { | 122 if (attrName == SVGNames::pointsAttr) { |
126 renderer->setNeedsShapeUpdate(); | 123 renderer->setNeedsShapeUpdate(); |
127 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 124 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
128 return; | 125 return; |
129 } | 126 } |
130 | 127 |
131 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired
::isKnownAttribute(attrName)) { | 128 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) { |
132 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 129 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
133 return; | 130 return; |
134 } | 131 } |
135 | 132 |
136 ASSERT_NOT_REACHED(); | 133 ASSERT_NOT_REACHED(); |
137 } | 134 } |
138 | 135 |
139 void SVGPolyElement::synchronizePoints(SVGElement* contextElement) | 136 void SVGPolyElement::synchronizePoints(SVGElement* contextElement) |
140 { | 137 { |
141 ASSERT(contextElement); | 138 ASSERT(contextElement); |
(...skipping 17 matching lines...) Expand all Loading... |
159 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); | 156 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); |
160 } | 157 } |
161 | 158 |
162 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() | 159 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() |
163 { | 160 { |
164 m_points.shouldSynchronize = true; | 161 m_points.shouldSynchronize = true; |
165 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); | 162 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); |
166 } | 163 } |
167 | 164 |
168 } | 165 } |
OLD | NEW |