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); |
97 } | 98 } |
98 | 99 |
99 void SVGImageElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style) | 100 void SVGImageElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style) |
100 { | 101 { |
101 if (!isSupportedAttribute(name)) | 102 RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> property = propertyFromAttribute (name); |
103 | |
104 if (property == m_width) | |
105 addPropertyToPresentationAttributeStyle(style, CSSPropertyWidth, value); | |
106 else if (property == m_height) | |
107 addPropertyToPresentationAttributeStyle(style, CSSPropertyHeight, value) ; | |
108 else if (property == m_x) | |
109 addPropertyToPresentationAttributeStyle(style, CSSPropertyX, m_x->curren tValue()->valueInSpecifiedUnits(), m_x->currentValue()->cssUnitTypeQuirk()); | |
110 else if (property == m_y) | |
111 addPropertyToPresentationAttributeStyle(style, CSSPropertyY, m_y->curren tValue()->valueInSpecifiedUnits(), m_y->currentValue()->cssUnitTypeQuirk()); | |
112 else | |
102 SVGGraphicsElement::collectStyleForPresentationAttribute(name, value, st yle); | 113 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 } | 114 } |
108 | 115 |
109 void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value) | 116 void SVGImageElement::parseAttribute(const QualifiedName& name, const AtomicStri ng& value) |
110 { | 117 { |
111 parseAttributeNew(name, value); | 118 parseAttributeNew(name, value); |
112 } | 119 } |
113 | 120 |
114 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) | 121 void SVGImageElement::svgAttributeChanged(const QualifiedName& attrName) |
115 { | 122 { |
116 if (!isSupportedAttribute(attrName)) { | 123 if (!isSupportedAttribute(attrName)) { |
117 SVGGraphicsElement::svgAttributeChanged(attrName); | 124 SVGGraphicsElement::svgAttributeChanged(attrName); |
118 return; | 125 return; |
119 } | 126 } |
120 | 127 |
121 SVGElement::InvalidationGuard invalidationGuard(this); | 128 SVGElement::InvalidationGuard invalidationGuard(this); |
122 | 129 |
130 if (attrName == SVGNames::xAttr | |
fs
2015/02/04 13:24:53
Not sure how the 'width' and 'height' values shoul
Erik Dahlström (inactive)
2015/02/05 16:09:02
Agreed, that looks like a bug. Will fix.
| |
131 || attrName == SVGNames::yAttr) { | |
132 invalidateSVGPresentationAttributeStyle(); | |
133 setNeedsStyleRecalc(LocalStyleChange, | |
134 StyleChangeReasonForTracing::fromAttribute(attrName)); | |
135 } | |
136 | |
123 bool isLengthAttribute = attrName == SVGNames::xAttr | 137 bool isLengthAttribute = attrName == SVGNames::xAttr |
124 || attrName == SVGNames::yAttr | 138 || attrName == SVGNames::yAttr |
125 || attrName == SVGNames::widthAttr | 139 || attrName == SVGNames::widthAttr |
126 || attrName == SVGNames::heightAttr; | 140 || attrName == SVGNames::heightAttr; |
127 | 141 |
128 if (isLengthAttribute) | 142 if (isLengthAttribute) |
129 updateRelativeLengthsInformation(); | 143 updateRelativeLengthsInformation(); |
130 | 144 |
131 if (SVGURIReference::isKnownAttribute(attrName)) { | 145 if (SVGURIReference::isKnownAttribute(attrName)) { |
132 if (inDocument()) | 146 if (inDocument()) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 return AtomicString(hrefString()); | 224 return AtomicString(hrefString()); |
211 } | 225 } |
212 | 226 |
213 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) | 227 void SVGImageElement::didMoveToNewDocument(Document& oldDocument) |
214 { | 228 { |
215 imageLoader().elementDidMoveToNewDocument(); | 229 imageLoader().elementDidMoveToNewDocument(); |
216 SVGGraphicsElement::didMoveToNewDocument(oldDocument); | 230 SVGGraphicsElement::didMoveToNewDocument(oldDocument); |
217 } | 231 } |
218 | 232 |
219 } // namespace blink | 233 } // namespace blink |
OLD | NEW |