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 29 matching lines...) Loading... |
40 PropertyIsReadWrite, | 40 PropertyIsReadWrite, |
41 SVGNames::pointsAttr, | 41 SVGNames::pointsAttr, |
42 SVGNames::pointsAttr.localName(), | 42 SVGNames::pointsAttr.localName(), |
43 &SVGPolyElement::synchronizePoints, | 43 &SVGPolyElement::synchronizePoints, |
44 &SVGPolyElement::lookupOrCreatePoin
tsWrapper); | 44 &SVGPolyElement::lookupOrCreatePoin
tsWrapper); |
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) | |
51 | 50 |
52 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) | 51 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGPolyElement) |
53 REGISTER_LOCAL_ANIMATED_PROPERTY(points) | 52 REGISTER_LOCAL_ANIMATED_PROPERTY(points) |
54 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
55 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 53 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
56 END_REGISTER_ANIMATED_PROPERTIES | 54 END_REGISTER_ANIMATED_PROPERTIES |
57 | 55 |
58 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) | 56 SVGPolyElement::SVGPolyElement(const QualifiedName& tagName, Document& document) |
59 : SVGGraphicsElement(tagName, document) | 57 : SVGGraphicsElement(tagName, document) |
60 { | 58 { |
61 registerAnimatedPropertiesForSVGPolyElement(); | 59 registerAnimatedPropertiesForSVGPolyElement(); |
62 } | 60 } |
63 | 61 |
64 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) | 62 bool SVGPolyElement::isSupportedAttribute(const QualifiedName& attrName) |
65 { | 63 { |
66 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 64 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
67 if (supportedAttributes.isEmpty()) { | 65 if (supportedAttributes.isEmpty()) { |
68 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 66 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
69 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
70 supportedAttributes.add(SVGNames::pointsAttr); | 67 supportedAttributes.add(SVGNames::pointsAttr); |
71 } | 68 } |
72 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 69 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
73 } | 70 } |
74 | 71 |
75 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) | 72 void SVGPolyElement::parseAttribute(const QualifiedName& name, const AtomicStrin
g& value) |
76 { | 73 { |
77 if (!isSupportedAttribute(name)) { | 74 if (!isSupportedAttribute(name)) { |
78 SVGGraphicsElement::parseAttribute(name, value); | 75 SVGGraphicsElement::parseAttribute(name, value); |
79 return; | 76 return; |
80 } | 77 } |
81 | 78 |
82 if (name == SVGNames::pointsAttr) { | 79 if (name == SVGNames::pointsAttr) { |
83 SVGPointList newList; | 80 SVGPointList newList; |
84 if (!pointsListFromSVGData(newList, value)) | 81 if (!pointsListFromSVGData(newList, value)) |
85 document().accessSVGExtensions()->reportError("Problem parsing point
s=\"" + value + "\""); | 82 document().accessSVGExtensions()->reportError("Problem parsing point
s=\"" + value + "\""); |
86 | 83 |
87 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV
GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) | 84 if (SVGAnimatedProperty* wrapper = SVGAnimatedProperty::lookupWrapper<SV
GPolyElement, SVGAnimatedPointList>(this, pointsPropertyInfo())) |
88 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL
ist.size()); | 85 static_cast<SVGAnimatedPointList*>(wrapper)->detachListWrappers(newL
ist.size()); |
89 | 86 |
90 m_points.value = newList; | 87 m_points.value = newList; |
91 return; | 88 return; |
92 } | 89 } |
93 | 90 |
94 if (SVGLangSpace::parseAttribute(name, value)) | 91 if (SVGLangSpace::parseAttribute(name, value)) |
95 return; | 92 return; |
96 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
97 return; | |
98 | 93 |
99 ASSERT_NOT_REACHED(); | 94 ASSERT_NOT_REACHED(); |
100 } | 95 } |
101 | 96 |
102 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) | 97 void SVGPolyElement::svgAttributeChanged(const QualifiedName& attrName) |
103 { | 98 { |
104 if (!isSupportedAttribute(attrName)) { | 99 if (!isSupportedAttribute(attrName)) { |
105 SVGGraphicsElement::svgAttributeChanged(attrName); | 100 SVGGraphicsElement::svgAttributeChanged(attrName); |
106 return; | 101 return; |
107 } | 102 } |
108 | 103 |
109 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 104 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
110 | 105 |
111 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 106 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
112 if (!renderer) | 107 if (!renderer) |
113 return; | 108 return; |
114 | 109 |
115 if (attrName == SVGNames::pointsAttr) { | 110 if (attrName == SVGNames::pointsAttr) { |
116 renderer->setNeedsShapeUpdate(); | 111 renderer->setNeedsShapeUpdate(); |
117 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 112 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
118 return; | 113 return; |
119 } | 114 } |
120 | 115 |
121 if (SVGLangSpace::isKnownAttribute(attrName) || SVGExternalResourcesRequired
::isKnownAttribute(attrName)) { | 116 if (SVGLangSpace::isKnownAttribute(attrName)) { |
122 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 117 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
123 return; | 118 return; |
124 } | 119 } |
125 | 120 |
126 ASSERT_NOT_REACHED(); | 121 ASSERT_NOT_REACHED(); |
127 } | 122 } |
128 | 123 |
129 void SVGPolyElement::synchronizePoints(SVGElement* contextElement) | 124 void SVGPolyElement::synchronizePoints(SVGElement* contextElement) |
130 { | 125 { |
131 ASSERT(contextElement); | 126 ASSERT(contextElement); |
(...skipping 17 matching lines...) Loading... |
149 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); | 144 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->baseVal()); |
150 } | 145 } |
151 | 146 |
152 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() | 147 SVGListPropertyTearOff<SVGPointList>* SVGPolyElement::animatedPoints() |
153 { | 148 { |
154 m_points.shouldSynchronize = true; | 149 m_points.shouldSynchronize = true; |
155 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); | 150 return static_cast<SVGListPropertyTearOff<SVGPointList>*>(static_pointer_cas
t<SVGAnimatedPointList>(lookupOrCreatePointsWrapper(this))->animVal()); |
156 } | 151 } |
157 | 152 |
158 } | 153 } |
OLD | NEW |