OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2007 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> | 4 * Copyright (C) 2010 Dirk Schulze <krit@webkit.org> |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "core/platform/graphics/Image.h" | 32 #include "core/platform/graphics/Image.h" |
33 #include "core/rendering/svg/RenderSVGResource.h" | 33 #include "core/rendering/svg/RenderSVGResource.h" |
34 #include "core/svg/SVGElementInstance.h" | 34 #include "core/svg/SVGElementInstance.h" |
35 #include "core/svg/SVGPreserveAspectRatio.h" | 35 #include "core/svg/SVGPreserveAspectRatio.h" |
36 | 36 |
37 namespace WebCore { | 37 namespace WebCore { |
38 | 38 |
39 // Animated property definitions | 39 // Animated property definitions |
40 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGFEImageElement, SVGNames::preserveAspectR
atioAttr, PreserveAspectRatio, preserveAspectRatio) | 40 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGFEImageElement, SVGNames::preserveAspectR
atioAttr, PreserveAspectRatio, preserveAspectRatio) |
41 DEFINE_ANIMATED_STRING(SVGFEImageElement, XLinkNames::hrefAttr, Href, href) | 41 DEFINE_ANIMATED_STRING(SVGFEImageElement, XLinkNames::hrefAttr, Href, href) |
42 DEFINE_ANIMATED_BOOLEAN(SVGFEImageElement, SVGNames::externalResourcesRequiredAt
tr, ExternalResourcesRequired, externalResourcesRequired) | |
43 | 42 |
44 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEImageElement) | 43 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEImageElement) |
45 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) | 44 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) |
46 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 45 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
47 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
48 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) | 46 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) |
49 END_REGISTER_ANIMATED_PROPERTIES | 47 END_REGISTER_ANIMATED_PROPERTIES |
50 | 48 |
51 inline SVGFEImageElement::SVGFEImageElement(const QualifiedName& tagName, Docume
nt& document) | 49 inline SVGFEImageElement::SVGFEImageElement(const QualifiedName& tagName, Docume
nt& document) |
52 : SVGFilterPrimitiveStandardAttributes(tagName, document) | 50 : SVGFilterPrimitiveStandardAttributes(tagName, document) |
53 { | 51 { |
54 ASSERT(hasTagName(SVGNames::feImageTag)); | 52 ASSERT(hasTagName(SVGNames::feImageTag)); |
55 ScriptWrappable::init(this); | 53 ScriptWrappable::init(this); |
56 registerAnimatedPropertiesForSVGFEImageElement(); | 54 registerAnimatedPropertiesForSVGFEImageElement(); |
57 } | 55 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 113 } |
116 | 114 |
117 invalidate(); | 115 invalidate(); |
118 } | 116 } |
119 | 117 |
120 bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName) | 118 bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName) |
121 { | 119 { |
122 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 120 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
123 if (supportedAttributes.isEmpty()) { | 121 if (supportedAttributes.isEmpty()) { |
124 SVGURIReference::addSupportedAttributes(supportedAttributes); | 122 SVGURIReference::addSupportedAttributes(supportedAttributes); |
125 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
126 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); | 123 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); |
127 } | 124 } |
128 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 125 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
129 } | 126 } |
130 | 127 |
131 void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 128 void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
132 { | 129 { |
133 if (!isSupportedAttribute(name)) { | 130 if (!isSupportedAttribute(name)) { |
134 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); | 131 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); |
135 return; | 132 return; |
136 } | 133 } |
137 | 134 |
138 if (name == SVGNames::preserveAspectRatioAttr) { | 135 if (name == SVGNames::preserveAspectRatioAttr) { |
139 SVGPreserveAspectRatio preserveAspectRatio; | 136 SVGPreserveAspectRatio preserveAspectRatio; |
140 preserveAspectRatio.parse(value); | 137 preserveAspectRatio.parse(value); |
141 setPreserveAspectRatioBaseValue(preserveAspectRatio); | 138 setPreserveAspectRatioBaseValue(preserveAspectRatio); |
142 return; | 139 return; |
143 } | 140 } |
144 | 141 |
145 if (SVGURIReference::parseAttribute(name, value)) | 142 if (SVGURIReference::parseAttribute(name, value)) |
146 return; | 143 return; |
147 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
148 return; | |
149 | 144 |
150 ASSERT_NOT_REACHED(); | 145 ASSERT_NOT_REACHED(); |
151 } | 146 } |
152 | 147 |
153 void SVGFEImageElement::svgAttributeChanged(const QualifiedName& attrName) | 148 void SVGFEImageElement::svgAttributeChanged(const QualifiedName& attrName) |
154 { | 149 { |
155 if (!isSupportedAttribute(attrName)) { | 150 if (!isSupportedAttribute(attrName)) { |
156 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | 151 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
157 return; | 152 return; |
158 } | 153 } |
159 | 154 |
160 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 155 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
161 | 156 |
162 if (attrName == SVGNames::preserveAspectRatioAttr) { | 157 if (attrName == SVGNames::preserveAspectRatioAttr) { |
163 invalidate(); | 158 invalidate(); |
164 return; | 159 return; |
165 } | 160 } |
166 | 161 |
167 if (SVGURIReference::isKnownAttribute(attrName)) { | 162 if (SVGURIReference::isKnownAttribute(attrName)) { |
168 buildPendingResource(); | 163 buildPendingResource(); |
169 return; | 164 return; |
170 } | 165 } |
171 | 166 |
172 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) | |
173 return; | |
174 | |
175 ASSERT_NOT_REACHED(); | 167 ASSERT_NOT_REACHED(); |
176 } | 168 } |
177 | 169 |
178 Node::InsertionNotificationRequest SVGFEImageElement::insertedInto(ContainerNode
* rootParent) | 170 Node::InsertionNotificationRequest SVGFEImageElement::insertedInto(ContainerNode
* rootParent) |
179 { | 171 { |
180 SVGFilterPrimitiveStandardAttributes::insertedInto(rootParent); | 172 SVGFilterPrimitiveStandardAttributes::insertedInto(rootParent); |
181 buildPendingResource(); | 173 buildPendingResource(); |
182 return InsertionDone; | 174 return InsertionDone; |
183 } | 175 } |
184 | 176 |
(...skipping 27 matching lines...) Expand all Loading... |
212 } | 204 } |
213 | 205 |
214 void SVGFEImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) con
st | 206 void SVGFEImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) con
st |
215 { | 207 { |
216 SVGFilterPrimitiveStandardAttributes::addSubresourceAttributeURLs(urls); | 208 SVGFilterPrimitiveStandardAttributes::addSubresourceAttributeURLs(urls); |
217 | 209 |
218 addSubresourceURL(urls, document().completeURL(hrefCurrentValue())); | 210 addSubresourceURL(urls, document().completeURL(hrefCurrentValue())); |
219 } | 211 } |
220 | 212 |
221 } | 213 } |
OLD | NEW |