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 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org> |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 markForLayoutAndParentResourceInvalidation(layoutObject()); | 145 markForLayoutAndParentResourceInvalidation(layoutObject()); |
146 return; | 146 return; |
147 } | 147 } |
148 | 148 |
149 SVGGeometryElement::svgAttributeChanged(attrName); | 149 SVGGeometryElement::svgAttributeChanged(attrName); |
150 } | 150 } |
151 | 151 |
152 void SVGPathElement::collectStyleForPresentationAttribute(const QualifiedName& n
ame, const AtomicString& value, MutableStylePropertySet* style) | 152 void SVGPathElement::collectStyleForPresentationAttribute(const QualifiedName& n
ame, const AtomicString& value, MutableStylePropertySet* style) |
153 { | 153 { |
154 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); | 154 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); |
155 if (property == m_path) | 155 if (property == m_path) { |
156 addPropertyToPresentationAttributeStyle(style, CSSPropertyD, m_path->cur
rentValue()->pathValue()); | 156 SVGAnimatedPath* path = this->path(); |
157 else | 157 // If this is a <use> instance, return the referenced path to maximize g
eometry sharing. |
158 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, st
yle); | 158 if (const SVGElement* element = correspondingElement()) |
| 159 path = toSVGPathElement(element)->path(); |
| 160 addPropertyToPresentationAttributeStyle(style, CSSPropertyD, path->curre
ntValue()->pathValue()); |
| 161 return; |
| 162 } |
| 163 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style)
; |
159 } | 164 } |
160 | 165 |
161 void SVGPathElement::invalidateMPathDependencies() | 166 void SVGPathElement::invalidateMPathDependencies() |
162 { | 167 { |
163 // <mpath> can only reference <path> but this dependency is not handled in | 168 // <mpath> can only reference <path> but this dependency is not handled in |
164 // markForLayoutAndParentResourceInvalidation so we update any mpath depende
ncies manually. | 169 // markForLayoutAndParentResourceInvalidation so we update any mpath depende
ncies manually. |
165 if (SVGElementSet* dependencies = setOfIncomingReferences()) { | 170 if (SVGElementSet* dependencies = setOfIncomingReferences()) { |
166 for (SVGElement* element : *dependencies) { | 171 for (SVGElement* element : *dependencies) { |
167 if (isSVGMPathElement(*element)) | 172 if (isSVGMPathElement(*element)) |
168 toSVGMPathElement(element)->targetPathChanged(); | 173 toSVGMPathElement(element)->targetPathChanged(); |
169 } | 174 } |
170 } | 175 } |
171 } | 176 } |
172 | 177 |
173 Node::InsertionNotificationRequest SVGPathElement::insertedInto(ContainerNode* r
ootParent) | 178 Node::InsertionNotificationRequest SVGPathElement::insertedInto(ContainerNode* r
ootParent) |
174 { | 179 { |
175 SVGGeometryElement::insertedInto(rootParent); | 180 SVGGeometryElement::insertedInto(rootParent); |
176 invalidateMPathDependencies(); | 181 invalidateMPathDependencies(); |
177 return InsertionDone; | 182 return InsertionDone; |
178 } | 183 } |
179 | 184 |
180 void SVGPathElement::removedFrom(ContainerNode* rootParent) | 185 void SVGPathElement::removedFrom(ContainerNode* rootParent) |
181 { | 186 { |
182 SVGGeometryElement::removedFrom(rootParent); | 187 SVGGeometryElement::removedFrom(rootParent); |
183 invalidateMPathDependencies(); | 188 invalidateMPathDependencies(); |
184 } | 189 } |
185 | 190 |
186 } // namespace blink | 191 } // namespace blink |
OLD | NEW |