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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 SVGURIReference::addSupportedAttributes(supportedAttributes); | 82 SVGURIReference::addSupportedAttributes(supportedAttributes); |
83 supportedAttributes.add(SVGNames::xAttr); | 83 supportedAttributes.add(SVGNames::xAttr); |
84 supportedAttributes.add(SVGNames::yAttr); | 84 supportedAttributes.add(SVGNames::yAttr); |
85 supportedAttributes.add(SVGNames::widthAttr); | 85 supportedAttributes.add(SVGNames::widthAttr); |
86 supportedAttributes.add(SVGNames::heightAttr); | 86 supportedAttributes.add(SVGNames::heightAttr); |
87 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); | 87 supportedAttributes.add(SVGNames::preserveAspectRatioAttr); |
88 } | 88 } |
89 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 89 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
90 } | 90 } |
91 | 91 |
92 bool SVGImageElement::isPresentationAttribute(const QualifiedName& name) const | 92 bool SVGImageElement::isPresentationAttribute(const QualifiedName& attrName) con
st |
93 { | 93 { |
94 if (name == SVGNames::widthAttr || name == SVGNames::heightAttr) | 94 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr |
| 95 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) |
95 return true; | 96 return true; |
96 return SVGGraphicsElement::isPresentationAttribute(name); | 97 return SVGGraphicsElement::isPresentationAttribute(attrName); |
| 98 } |
| 99 |
| 100 bool SVGImageElement::isPresentationAttributeWithSVGDOM(const QualifiedName& att
rName) const |
| 101 { |
| 102 if (attrName == SVGNames::xAttr || attrName == SVGNames::yAttr |
| 103 || attrName == SVGNames::widthAttr || attrName == SVGNames::heightAttr) |
| 104 return true; |
| 105 return SVGGraphicsElement::isPresentationAttributeWithSVGDOM(attrName); |
97 } | 106 } |
98 | 107 |
99 void SVGImageElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) | 108 void SVGImageElement::collectStyleForPresentationAttribute(const QualifiedName&
name, const AtomicString& value, MutableStylePropertySet* style) |
100 { | 109 { |
101 if (!isSupportedAttribute(name)) | 110 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute
(name); |
| 111 |
| 112 if (property == m_width) |
| 113 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, value); |
| 114 else if (property == m_height) |
| 115 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, value)
; |
| 116 else if (property == m_x) |
| 117 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyX, *m
_x->currentValue()); |
| 118 else if (property == m_y) |
| 119 addSVGLengthPropertyToPresentationAttributeStyle(style, CSSPropertyY, *m
_y->currentValue()); |
| 120 else |
102 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st
yle); | 121 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st
yle); |
103 else if (name == SVGNames::widthAttr) | |
104 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, value); | |
105 else if (name == SVGNames::heightAttr) | |
106 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, value)
; | |
107 } | 122 } |
108 | 123 |
109 void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) | 124 void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri
ng& value) |
110 { | 125 { |
111 parseAttributeNew(name, value); | 126 parseAttributeNew(name, value); |
112 } | 127 } |
113 | 128 |
114 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) | 129 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) |
115 { | 130 { |
116 if (!isSupportedAttribute(attrName)) { | 131 if (!isSupportedAttribute(attrName)) { |
117 SVGGraphicsElement::svgAttributeChanged(attrName); | 132 SVGGraphicsElement::svgAttributeChanged(attrName); |
118 return; | 133 return; |
119 } | 134 } |
120 | 135 |
121 SVGElement::InvalidationGuard invalidationGuard(this); | 136 SVGElement::InvalidationGuard invalidationGuard(this); |
122 | 137 |
123 bool isLengthAttribute = attrName == SVGNames::xAttr | 138 bool isLengthAttribute = attrName == SVGNames::xAttr |
124 || attrName == SVGNames::yAttr | 139 || attrName == SVGNames::yAttr |
125 || attrName == SVGNames::widthAttr | 140 || attrName == SVGNames::widthAttr |
126 || attrName == SVGNames::heightAttr; | 141 || attrName == SVGNames::heightAttr; |
127 | 142 |
128 if (isLengthAttribute) | 143 if (isLengthAttribute) { |
| 144 invalidateSVGPresentationAttributeStyle(); |
| 145 setNeedsStyleRecalc(LocalStyleChange, |
| 146 StyleChangeReasonForTracing::fromAttribute(attrName)); |
129 updateRelativeLengthsInformation(); | 147 updateRelativeLengthsInformation(); |
| 148 } |
130 | 149 |
131 if (SVGURIReference::isKnownAttribute(attrName)) { | 150 if (SVGURIReference::isKnownAttribute(attrName)) { |
132 if (inDocument()) | 151 if (inDocument()) |
133 imageLoader().updateFromElement(ImageLoader::UpdateIgnorePreviousErr
or); | 152 imageLoader().updateFromElement(ImageLoader::UpdateIgnorePreviousErr
or); |
134 else | 153 else |
135 m_needsLoaderURIUpdate = true; | 154 m_needsLoaderURIUpdate = true; |
136 return; | 155 return; |
137 } | 156 } |
138 | 157 |
139 LayoutObject* renderer = this->renderer(); | 158 LayoutObject* renderer = this->renderer(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 return AtomicString(hrefString()); | 229 return AtomicString(hrefString()); |
211 } | 230 } |
212 | 231 |
213 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) | 232 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) |
214 { | 233 { |
215 imageLoader().elementDidMoveToNewDocument(); | 234 imageLoader().elementDidMoveToNewDocument(); |
216 SVGGraphicsElement::didMoveToNewDocument(oldDocument); | 235 SVGGraphicsElement::didMoveToNewDocument(oldDocument); |
217 } | 236 } |
218 | 237 |
219 } // namespace blink | 238 } // namespace blink |
OLD | NEW |