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 15 matching lines...) Expand all Loading... |
26 #include "core/layout/LayoutImageResource.h" | 26 #include "core/layout/LayoutImageResource.h" |
27 #include "core/layout/svg/LayoutSVGImage.h" | 27 #include "core/layout/svg/LayoutSVGImage.h" |
28 | 28 |
29 namespace blink { | 29 namespace blink { |
30 | 30 |
31 inline SVGImageElement::SVGImageElement(Document& document) | 31 inline SVGImageElement::SVGImageElement(Document& document) |
32 : SVGGraphicsElement(SVGNames::imageTag, document), | 32 : SVGGraphicsElement(SVGNames::imageTag, document), |
33 SVGURIReference(this), | 33 SVGURIReference(this), |
34 m_x(SVGAnimatedLength::create(this, | 34 m_x(SVGAnimatedLength::create(this, |
35 SVGNames::xAttr, | 35 SVGNames::xAttr, |
36 SVGLength::create(SVGLengthMode::Width))), | 36 SVGLength::create(SVGLengthMode::Width), |
| 37 CSSPropertyX)), |
37 m_y(SVGAnimatedLength::create(this, | 38 m_y(SVGAnimatedLength::create(this, |
38 SVGNames::yAttr, | 39 SVGNames::yAttr, |
39 SVGLength::create(SVGLengthMode::Height))), | 40 SVGLength::create(SVGLengthMode::Height), |
40 m_width( | 41 CSSPropertyY)), |
41 SVGAnimatedLength::create(this, | 42 m_width(SVGAnimatedLength::create(this, |
42 SVGNames::widthAttr, | 43 SVGNames::widthAttr, |
43 SVGLength::create(SVGLengthMode::Width))), | 44 SVGLength::create(SVGLengthMode::Width), |
| 45 CSSPropertyWidth)), |
44 m_height( | 46 m_height( |
45 SVGAnimatedLength::create(this, | 47 SVGAnimatedLength::create(this, |
46 SVGNames::heightAttr, | 48 SVGNames::heightAttr, |
47 SVGLength::create(SVGLengthMode::Height))), | 49 SVGLength::create(SVGLengthMode::Height), |
| 50 CSSPropertyHeight)), |
48 m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create( | 51 m_preserveAspectRatio(SVGAnimatedPreserveAspectRatio::create( |
49 this, | 52 this, |
50 SVGNames::preserveAspectRatioAttr)), | 53 SVGNames::preserveAspectRatioAttr)), |
51 m_imageLoader(SVGImageLoader::create(this)), | 54 m_imageLoader(SVGImageLoader::create(this)), |
52 m_needsLoaderURIUpdate(true) { | 55 m_needsLoaderURIUpdate(true) { |
53 addToPropertyMap(m_x); | 56 addToPropertyMap(m_x); |
54 addToPropertyMap(m_y); | 57 addToPropertyMap(m_y); |
55 addToPropertyMap(m_width); | 58 addToPropertyMap(m_width); |
56 addToPropertyMap(m_height); | 59 addToPropertyMap(m_height); |
57 addToPropertyMap(m_preserveAspectRatio); | 60 addToPropertyMap(m_preserveAspectRatio); |
(...skipping 17 matching lines...) Expand all Loading... |
75 if (layoutSVGImage->imageResource()->hasImage()) { | 78 if (layoutSVGImage->imageResource()->hasImage()) { |
76 if (Image* image = | 79 if (Image* image = |
77 layoutSVGImage->imageResource()->cachedImage()->getImage()) | 80 layoutSVGImage->imageResource()->cachedImage()->getImage()) |
78 return image->currentFrameHasSingleSecurityOrigin(); | 81 return image->currentFrameHasSingleSecurityOrigin(); |
79 } | 82 } |
80 } | 83 } |
81 | 84 |
82 return true; | 85 return true; |
83 } | 86 } |
84 | 87 |
85 bool SVGImageElement::isPresentationAttribute( | |
86 const QualifiedName& attrName) const { | |
87 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || | |
88 attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) | |
89 return true; | |
90 return SVGGraphicsElement::isPresentationAttribute(attrName); | |
91 } | |
92 | |
93 bool SVGImageElement::isPresentationAttributeWithSVGDOM( | |
94 const QualifiedName& attrName) const { | |
95 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr || | |
96 attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) | |
97 return true; | |
98 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName); | |
99 } | |
100 | |
101 void SVGImageElement::collectStyleForPresentationAttribute( | 88 void SVGImageElement::collectStyleForPresentationAttribute( |
102 const QualifiedName& name, | 89 const QualifiedName& name, |
103 const AtomicString& value, | 90 const AtomicString& value, |
104 MutableStylePropertySet* style) { | 91 MutableStylePropertySet* style) { |
105 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); | 92 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); |
106 if (property == m_width) | 93 if (property == m_width) |
107 addPropertyToPresentationAttributeStyle( | 94 addPropertyToPresentationAttributeStyle( |
108 style, CSSPropertyWidth, | 95 style, CSSPropertyWidth, |
109 m_width->currentValue()->asCSSPrimitiveValue()); | 96 m_width->currentValue()->asCSSPrimitiveValue()); |
110 else if (property == m_height) | 97 else if (property == m_height) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 const AtomicString SVGImageElement::imageSourceURL() const { | 199 const AtomicString SVGImageElement::imageSourceURL() const { |
213 return AtomicString(hrefString()); | 200 return AtomicString(hrefString()); |
214 } | 201 } |
215 | 202 |
216 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) { | 203 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) { |
217 imageLoader().elementDidMoveToNewDocument(); | 204 imageLoader().elementDidMoveToNewDocument(); |
218 SVGGraphicsElement::didMoveToNewDocument(oldDocument); | 205 SVGGraphicsElement::didMoveToNewDocument(oldDocument); |
219 } | 206 } |
220 | 207 |
221 } // namespace blink | 208 } // namespace blink |
OLD | NEW |