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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document* document) | 58 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document* document) |
59 : SVGGraphicsElement(tagName, document) | 59 : SVGGraphicsElement(tagName, document) |
60 { | 60 { |
61 registerAnimatedPropertiesForSVGPolyElement(); | 61 registerAnimatedPropertiesForSVGPolyElement(); |
62 } | 62 } |
63 | 63 |
64 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) | 64 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) |
65 { | 65 { |
66 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 66 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
67 if (supportedAttributes.isEmpty()) { | 67 if (supportedAttributes.isEmpty()) { |
68 SVGTests::addSupportedAttributes(supportedAttributes); | |
69 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 68 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
70 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | 69 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); |
71 supportedAttributes.add(SVGNames::pointsAttr); | 70 supportedAttributes.add(SVGNames::pointsAttr); |
72 } | 71 } |
73 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 72 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
74 } | 73 } |
75 | 74 |
76 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 75 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
77 { | 76 { |
78 if (!isSupportedAttribute(name)) { | 77 if (!isSupportedAttribute(name)) { |
79 SVGGraphicsElement::parseAttribute(name, value); | 78 SVGGraphicsElement::parseAttribute(name, value); |
80 return; | 79 return; |
81 } | 80 } |
82 | 81 |
83 if (name == SVGNames::pointsAttr) { | 82 if (name == SVGNames::pointsAttr) { |
84 SVGPointList newList; | 83 SVGPointList newList; |
85 if (!pointsListFromSVGData(newList, value)) | 84 if (!pointsListFromSVGData(newList, value)) |
86 document()->accessSVGExtensions()->reportError("Problem parsing poin
ts=\"" + value + "\""); | 85 document()->accessSVGExtensions()->reportError("Problem parsing poin
ts=\"" + value + "\""); |
87 | 86 |
88 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV
GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) | 87 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV
GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) |
89 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL
ist.size()); | 88 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL
ist.size()); |
90 | 89 |
91 m_points.value = newList; | 90 m_points.value = newList; |
92 return; | 91 return; |
93 } | 92 } |
94 | 93 |
95 if (SVGTests::parseAttribute(name, value)) | |
96 return; | |
97 if (SVGLangSpace::parseAttribute(name, value)) | 94 if (SVGLangSpace::parseAttribute(name, value)) |
98 return; | 95 return; |
99 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | 96 if (SVGExternalResourcesRequired::parseAttribute(name, value)) |
100 return; | 97 return; |
101 | 98 |
102 ASSERT_NOT_REACHED(); | 99 ASSERT_NOT_REACHED(); |
103 } | 100 } |
104 | 101 |
105 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) | 102 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) |
106 { | 103 { |
107 if (!isSupportedAttribute(attrName)) { | 104 if (!isSupportedAttribute(attrName)) { |
108 SVGGraphicsElement::svgAttributeChanged(attrName); | 105 SVGGraphicsElement::svgAttributeChanged(attrName); |
109 return; | 106 return; |
110 } | 107 } |
111 | 108 |
112 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 109 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
113 | |
114 if (SVGTests::handleAttributeChange(this, attrName)) | |
115 return; | |
116 | 110 |
117 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 111 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
118 if (!renderer) | 112 if (!renderer) |
119 return; | 113 return; |
120 | 114 |
121 if (attrName == SVGNames::pointsAttr) { | 115 if (attrName == SVGNames::pointsAttr) { |
122 renderer->setNeedsShapeUpdate(); | 116 renderer->setNeedsShapeUpdate(); |
123 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 117 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
124 return; | 118 return; |
125 } | 119 } |
(...skipping 29 matching lines...) Expand all Loading... |
155 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); | 149 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); |
156 } | 150 } |
157 | 151 |
158 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() | 152 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() |
159 { | 153 { |
160 m_points.shouldSynchronize = true; | 154 m_points.shouldSynchronize = true; |
161 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); | 155 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); |
162 } | 156 } |
163 | 157 |
164 } | 158 } |
OLD | NEW |