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 19 matching lines...) Expand all Loading... |
30 #include "core/rendering/svg/RenderSVGResource.h" | 30 #include "core/rendering/svg/RenderSVGResource.h" |
31 #include "core/svg/SVGElementInstance.h" | 31 #include "core/svg/SVGElementInstance.h" |
32 #include "core/svg/SVGPreserveAspectRatio.h" | 32 #include "core/svg/SVGPreserveAspectRatio.h" |
33 #include "platform/graphics/Image.h" | 33 #include "platform/graphics/Image.h" |
34 | 34 |
35 namespace WebCore { | 35 namespace WebCore { |
36 | 36 |
37 // Animated property definitions | 37 // Animated property definitions |
38 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGFEImageElement, SVGNames::preserveAspectR
atioAttr, PreserveAspectRatio, preserveAspectRatio) | 38 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGFEImageElement, SVGNames::preserveAspectR
atioAttr, PreserveAspectRatio, preserveAspectRatio) |
39 DEFINE_ANIMATED_STRING(SVGFEImageElement, XLinkNames::hrefAttr, Href, href) | 39 DEFINE_ANIMATED_STRING(SVGFEImageElement, XLinkNames::hrefAttr, Href, href) |
40 DEFINE_ANIMATED_BOOLEAN(SVGFEImageElement, SVGNames::externalResourcesRequiredAt
tr, ExternalResourcesRequired, externalResourcesRequired) | |
41 | 40 |
42 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEImageElement) | 41 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGFEImageElement) |
43 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) | 42 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) |
44 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 43 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
45 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
46 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) | 44 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGFilterPrimitiveStandardAttributes) |
47 END_REGISTER_ANIMATED_PROPERTIES | 45 END_REGISTER_ANIMATED_PROPERTIES |
48 | 46 |
49 inline SVGFEImageElement::SVGFEImageElement(Document& document) | 47 inline SVGFEImageElement::SVGFEImageElement(Document& document) |
50 : SVGFilterPrimitiveStandardAttributes(SVGNames::feImageTag, document) | 48 : SVGFilterPrimitiveStandardAttributes(SVGNames::feImageTag, document) |
51 { | 49 { |
52 ScriptWrappable::init(this); | 50 ScriptWrappable::init(this); |
53 registerAnimatedPropertiesForSVGFEImageElement(); | 51 registerAnimatedPropertiesForSVGFEImageElement(); |
54 } | 52 } |
55 | 53 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 110 } |
113 | 111 |
114 invalidate(); | 112 invalidate(); |
115 } | 113 } |
116 | 114 |
117 bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName) | 115 bool SVGFEImageElement::isSupportedAttribute(const QualifiedName& attrName) |
118 { | 116 { |
119 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 117 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
120 if (supportedAttributes.isEmpty()) { | 118 if (supportedAttributes.isEmpty()) { |
121 SVGURIReference::addSupportedAttributes(supportedAttributes); | 119 SVGURIReference::addSupportedAttributes(supportedAttributes); |
122 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes
); | |
123 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); | 120 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); |
124 } | 121 } |
125 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 122 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
126 } | 123 } |
127 | 124 |
128 void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) | 125 void SVGFEImageElement::parseAttribute(const QualifiedName& name, const AtomicSt
ring& value) |
129 { | 126 { |
130 if (!isSupportedAttribute(name)) { | 127 if (!isSupportedAttribute(name)) { |
131 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); | 128 SVGFilterPrimitiveStandardAttributes::parseAttribute(name, value); |
132 return; | 129 return; |
133 } | 130 } |
134 | 131 |
135 if (name == SVGNames::preserveAspectRatioAttr) { | 132 if (name == SVGNames::preserveAspectRatioAttr) { |
136 SVGPreserveAspectRatio preserveAspectRatio; | 133 SVGPreserveAspectRatio preserveAspectRatio; |
137 preserveAspectRatio.parse(value); | 134 preserveAspectRatio.parse(value); |
138 setPreserveAspectRatioBaseValue(preserveAspectRatio); | 135 setPreserveAspectRatioBaseValue(preserveAspectRatio); |
139 return; | 136 return; |
140 } | 137 } |
141 | 138 |
142 if (SVGURIReference::parseAttribute(name, value)) | 139 if (SVGURIReference::parseAttribute(name, value)) |
143 return; | 140 return; |
144 if (SVGExternalResourcesRequired::parseAttribute(name, value)) | |
145 return; | |
146 | 141 |
147 ASSERT_NOT_REACHED(); | 142 ASSERT_NOT_REACHED(); |
148 } | 143 } |
149 | 144 |
150 void SVGFEImageElement::svgAttributeChanged(const QualifiedName& attrName) | 145 void SVGFEImageElement::svgAttributeChanged(const QualifiedName& attrName) |
151 { | 146 { |
152 if (!isSupportedAttribute(attrName)) { | 147 if (!isSupportedAttribute(attrName)) { |
153 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); | 148 SVGFilterPrimitiveStandardAttributes::svgAttributeChanged(attrName); |
154 return; | 149 return; |
155 } | 150 } |
156 | 151 |
157 SVGElementInstance::InvalidationGuard invalidationGuard(this); | 152 SVGElementInstance::InvalidationGuard invalidationGuard(this); |
158 | 153 |
159 if (attrName == SVGNames::preserveAspectRatioAttr) { | 154 if (attrName == SVGNames::preserveAspectRatioAttr) { |
160 invalidate(); | 155 invalidate(); |
161 return; | 156 return; |
162 } | 157 } |
163 | 158 |
164 if (SVGURIReference::isKnownAttribute(attrName)) { | 159 if (SVGURIReference::isKnownAttribute(attrName)) { |
165 buildPendingResource(); | 160 buildPendingResource(); |
166 return; | 161 return; |
167 } | 162 } |
168 | 163 |
169 if (SVGExternalResourcesRequired::isKnownAttribute(attrName)) | |
170 return; | |
171 | |
172 ASSERT_NOT_REACHED(); | 164 ASSERT_NOT_REACHED(); |
173 } | 165 } |
174 | 166 |
175 Node::InsertionNotificationRequest SVGFEImageElement::insertedInto(ContainerNode
* rootParent) | 167 Node::InsertionNotificationRequest SVGFEImageElement::insertedInto(ContainerNode
* rootParent) |
176 { | 168 { |
177 SVGFilterPrimitiveStandardAttributes::insertedInto(rootParent); | 169 SVGFilterPrimitiveStandardAttributes::insertedInto(rootParent); |
178 buildPendingResource(); | 170 buildPendingResource(); |
179 return InsertionDone; | 171 return InsertionDone; |
180 } | 172 } |
181 | 173 |
(...skipping 20 matching lines...) Expand all Loading... |
202 } | 194 } |
203 | 195 |
204 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil
ter) | 196 PassRefPtr<FilterEffect> SVGFEImageElement::build(SVGFilterBuilder*, Filter* fil
ter) |
205 { | 197 { |
206 if (m_cachedImage) | 198 if (m_cachedImage) |
207 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(
renderer()), preserveAspectRatioCurrentValue()); | 199 return FEImage::createWithImage(filter, m_cachedImage->imageForRenderer(
renderer()), preserveAspectRatioCurrentValue()); |
208 return FEImage::createWithIRIReference(filter, document(), hrefCurrentValue(
), preserveAspectRatioCurrentValue()); | 200 return FEImage::createWithIRIReference(filter, document(), hrefCurrentValue(
), preserveAspectRatioCurrentValue()); |
209 } | 201 } |
210 | 202 |
211 } | 203 } |
OLD | NEW |