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, 2008, 2009 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 4 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.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 22 matching lines...) Expand all Loading... | |
33 | 33 |
34 namespace WebCore { | 34 namespace WebCore { |
35 | 35 |
36 // Animated property definitions | 36 // Animated property definitions |
37 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::xAttr, X, x) | 37 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::xAttr, X, x) |
38 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::yAttr, Y, y) | 38 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::yAttr, Y, y) |
39 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::widthAttr, Width, width) | 39 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::widthAttr, Width, width) |
40 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::heightAttr, Height, height) | 40 DEFINE_ANIMATED_LENGTH(SVGImageElement, SVGNames::heightAttr, Height, height) |
41 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGImageElement, SVGNames::preserveAspectRat ioAttr, PreserveAspectRatio, preserveAspectRatio) | 41 DEFINE_ANIMATED_PRESERVEASPECTRATIO(SVGImageElement, SVGNames::preserveAspectRat ioAttr, PreserveAspectRatio, preserveAspectRatio) |
42 DEFINE_ANIMATED_STRING(SVGImageElement, XLinkNames::hrefAttr, Href, href) | 42 DEFINE_ANIMATED_STRING(SVGImageElement, XLinkNames::hrefAttr, Href, href) |
43 DEFINE_ANIMATED_BOOLEAN(SVGImageElement, SVGNames::externalResourcesRequiredAttr , ExternalResourcesRequired, externalResourcesRequired) | |
44 | 43 |
45 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGImageElement) | 44 BEGIN_REGISTER_ANIMATED_PROPERTIES(SVGImageElement) |
46 REGISTER_LOCAL_ANIMATED_PROPERTY(x) | 45 REGISTER_LOCAL_ANIMATED_PROPERTY(x) |
47 REGISTER_LOCAL_ANIMATED_PROPERTY(y) | 46 REGISTER_LOCAL_ANIMATED_PROPERTY(y) |
48 REGISTER_LOCAL_ANIMATED_PROPERTY(width) | 47 REGISTER_LOCAL_ANIMATED_PROPERTY(width) |
49 REGISTER_LOCAL_ANIMATED_PROPERTY(height) | 48 REGISTER_LOCAL_ANIMATED_PROPERTY(height) |
50 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) | 49 REGISTER_LOCAL_ANIMATED_PROPERTY(preserveAspectRatio) |
51 REGISTER_LOCAL_ANIMATED_PROPERTY(href) | 50 REGISTER_LOCAL_ANIMATED_PROPERTY(href) |
52 REGISTER_LOCAL_ANIMATED_PROPERTY(externalResourcesRequired) | |
53 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) | 51 REGISTER_PARENT_ANIMATED_PROPERTIES(SVGGraphicsElement) |
54 END_REGISTER_ANIMATED_PROPERTIES | 52 END_REGISTER_ANIMATED_PROPERTIES |
55 | 53 |
56 inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document& document) | 54 inline SVGImageElement::SVGImageElement(const QualifiedName& tagName, Document& document) |
57 : SVGGraphicsElement(tagName, document) | 55 : SVGGraphicsElement(tagName, document) |
58 , m_x(LengthModeWidth) | 56 , m_x(LengthModeWidth) |
59 , m_y(LengthModeHeight) | 57 , m_y(LengthModeHeight) |
60 , m_width(LengthModeWidth) | 58 , m_width(LengthModeWidth) |
61 , m_height(LengthModeHeight) | 59 , m_height(LengthModeHeight) |
62 , m_imageLoader(this) | 60 , m_imageLoader(this) |
(...skipping 18 matching lines...) Expand all Loading... | |
81 } | 79 } |
82 | 80 |
83 return true; | 81 return true; |
84 } | 82 } |
85 | 83 |
86 bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName) | 84 bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName) |
87 { | 85 { |
88 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 86 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
89 if (supportedAttributes.isEmpty()) { | 87 if (supportedAttributes.isEmpty()) { |
90 SVGLangSpace::addSupportedAttributes(supportedAttributes); | 88 SVGLangSpace::addSupportedAttributes(supportedAttributes); |
91 SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes ); | |
92 SVGURIReference::addSupportedAttributes(supportedAttributes); | 89 SVGURIReference::addSupportedAttributes(supportedAttributes); |
93 supportedAttributes.add(SVGNames::xAttr); | 90 supportedAttributes.add(SVGNames::xAttr); |
94 supportedAttributes.add(SVGNames::yAttr); | 91 supportedAttributes.add(SVGNames::yAttr); |
95 supportedAttributes.add(SVGNames::widthAttr); | 92 supportedAttributes.add(SVGNames::widthAttr); |
96 supportedAttributes.add(SVGNames::heightAttr); | 93 supportedAttributes.add(SVGNames::heightAttr); |
97 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); | 94 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); |
98 } | 95 } |
99 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 96 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
100 } | 97 } |
101 | 98 |
(...skipping 26 matching lines...) Expand all Loading... | |
128 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ; | 125 setYBaseValue(SVGLength::construct(LengthModeHeight, value, parseError)) ; |
129 else if (name == SVGNames::preserveAspectRatioAttr) { | 126 else if (name == SVGNames::preserveAspectRatioAttr) { |
130 SVGPreserveAspectRatio preserveAspectRatio; | 127 SVGPreserveAspectRatio preserveAspectRatio; |
131 preserveAspectRatio.parse(value); | 128 preserveAspectRatio.parse(value); |
132 setPreserveAspectRatioBaseValue(preserveAspectRatio); | 129 setPreserveAspectRatioBaseValue(preserveAspectRatio); |
133 } else if (name == SVGNames::widthAttr) | 130 } else if (name == SVGNames::widthAttr) |
134 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths)); | 131 setWidthBaseValue(SVGLength::construct(LengthModeWidth, value, parseErro r, ForbidNegativeLengths)); |
135 else if (name == SVGNames::heightAttr) | 132 else if (name == SVGNames::heightAttr) |
136 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths)); | 133 setHeightBaseValue(SVGLength::construct(LengthModeHeight, value, parseEr ror, ForbidNegativeLengths)); |
137 else if (SVGLangSpace::parseAttribute(name, value) | 134 else if (SVGLangSpace::parseAttribute(name, value) |
138 || SVGExternalResourcesRequired::parseAttribute(name, value) | |
139 || SVGURIReference::parseAttribute(name, value)) { | 135 || SVGURIReference::parseAttribute(name, value)) { |
140 } else | 136 } else |
141 ASSERT_NOT_REACHED(); | 137 ASSERT_NOT_REACHED(); |
142 | 138 |
143 reportAttributeParsingError(parseError, name, value); | 139 reportAttributeParsingError(parseError, name, value); |
144 } | 140 } |
145 | 141 |
146 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) | 142 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) |
147 { | 143 { |
148 if (!isSupportedAttribute(attrName)) { | 144 if (!isSupportedAttribute(attrName)) { |
(...skipping 20 matching lines...) Expand all Loading... | |
169 if (!renderer) | 165 if (!renderer) |
170 return; | 166 return; |
171 | 167 |
172 if (isLengthAttribute) { | 168 if (isLengthAttribute) { |
173 if (toRenderSVGImage(renderer)->updateImageViewport()) | 169 if (toRenderSVGImage(renderer)->updateImageViewport()) |
174 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render er); | 170 RenderSVGResource::markForLayoutAndParentResourceInvalidation(render er); |
175 return; | 171 return; |
176 } | 172 } |
177 | 173 |
178 if (attrName == SVGNames::preserveAspectRatioAttr | 174 if (attrName == SVGNames::preserveAspectRatioAttr |
179 || SVGLangSpace::isKnownAttribute(attrName) | 175 || SVGLangSpace::isKnownAttribute(attrName)) { |
180 || SVGExternalResourcesRequired::isKnownAttribute(attrName)) { | |
181 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 176 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); |
182 return; | 177 return; |
183 } | 178 } |
184 | 179 |
185 ASSERT_NOT_REACHED(); | 180 ASSERT_NOT_REACHED(); |
186 } | 181 } |
187 | 182 |
188 bool SVGImageElement::selfHasRelativeLengths() const | 183 bool SVGImageElement::selfHasRelativeLengths() const |
189 { | 184 { |
190 return xCurrentValue().isRelative() | 185 return xCurrentValue().isRelative() |
191 || yCurrentValue().isRelative() | 186 || yCurrentValue().isRelative() |
192 || widthCurrentValue().isRelative() | 187 || widthCurrentValue().isRelative() |
193 || heightCurrentValue().isRelative(); | 188 || heightCurrentValue().isRelative(); |
194 } | 189 } |
195 | 190 |
196 RenderObject* SVGImageElement::createRenderer(RenderStyle*) | 191 RenderObject* SVGImageElement::createRenderer(RenderStyle*) |
197 { | 192 { |
198 return new RenderSVGImage(this); | 193 return new RenderSVGImage(this); |
199 } | 194 } |
200 | 195 |
201 bool SVGImageElement::haveLoadedRequiredResources() | 196 bool SVGImageElement::haveLoadedRequiredResources() |
Stephen Chennney
2013/11/06 16:45:43
Does this method even need to exist any longer? It
Erik Dahlström (inactive)
2013/11/07 09:38:04
This method gets called from SVGElement::sendSVGLo
| |
202 { | 197 { |
203 return !externalResourcesRequiredBaseValue() || !m_imageLoader.hasPendingAct ivity(); | 198 return true; |
204 } | 199 } |
205 | 200 |
206 void SVGImageElement::attach(const AttachContext& context) | 201 void SVGImageElement::attach(const AttachContext& context) |
207 { | 202 { |
208 SVGGraphicsElement::attach(context); | 203 SVGGraphicsElement::attach(context); |
209 | 204 |
210 if (RenderSVGImage* imageObj = toRenderSVGImage(renderer())) { | 205 if (RenderSVGImage* imageObj = toRenderSVGImage(renderer())) { |
211 if (imageObj->imageResource()->hasImage()) | 206 if (imageObj->imageResource()->hasImage()) |
212 return; | 207 return; |
213 | 208 |
(...skipping 24 matching lines...) Expand all Loading... | |
238 addSubresourceURL(urls, document().completeURL(hrefCurrentValue())); | 233 addSubresourceURL(urls, document().completeURL(hrefCurrentValue())); |
239 } | 234 } |
240 | 235 |
241 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) | 236 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) |
242 { | 237 { |
243 m_imageLoader.elementDidMoveToNewDocument(); | 238 m_imageLoader.elementDidMoveToNewDocument(); |
244 SVGGraphicsElement::didMoveToNewDocument(oldDocument); | 239 SVGGraphicsElement::didMoveToNewDocument(oldDocument); |
245 } | 240 } |
246 | 241 |
247 } | 242 } |
OLD | NEW |