| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 SVGGeometryElement::svgAttributeChanged(attrName); | 157 SVGGeometryElement::svgAttributeChanged(attrName); |
| 158 } | 158 } |
| 159 | 159 |
| 160 void SVGPathElement::collectStyleForPresentationAttribute( | 160 void SVGPathElement::collectStyleForPresentationAttribute( |
| 161 const QualifiedName& name, | 161 const QualifiedName& name, |
| 162 const AtomicString& value, | 162 const AtomicString& value, |
| 163 MutableStylePropertySet* style) { | 163 MutableStylePropertySet* style) { |
| 164 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); | 164 SVGAnimatedPropertyBase* property = propertyFromAttribute(name); |
| 165 if (property == m_path) { | 165 if (property == m_path) { |
| 166 SVGAnimatedPath* path = this->path(); | 166 SVGAnimatedPath* path = this->path(); |
| 167 // If this is a <use> instance, return the referenced path to maximize geome
try sharing. | 167 // If this is a <use> instance, return the referenced path to maximize |
| 168 // geometry sharing. |
| 168 if (const SVGElement* element = correspondingElement()) | 169 if (const SVGElement* element = correspondingElement()) |
| 169 path = toSVGPathElement(element)->path(); | 170 path = toSVGPathElement(element)->path(); |
| 170 | 171 |
| 171 CSSPathValue* pathValue = path->currentValue()->pathValue(); | 172 CSSPathValue* pathValue = path->currentValue()->pathValue(); |
| 172 if (pathValue->stylePath()->byteStream().isEmpty()) { | 173 if (pathValue->stylePath()->byteStream().isEmpty()) { |
| 173 addPropertyToPresentationAttributeStyle( | 174 addPropertyToPresentationAttributeStyle( |
| 174 style, CSSPropertyD, CSSIdentifierValue::create(CSSValueNone)); | 175 style, CSSPropertyD, CSSIdentifierValue::create(CSSValueNone)); |
| 175 return; | 176 return; |
| 176 } | 177 } |
| 177 addPropertyToPresentationAttributeStyle(style, CSSPropertyD, pathValue); | 178 addPropertyToPresentationAttributeStyle(style, CSSPropertyD, pathValue); |
| 178 return; | 179 return; |
| 179 } | 180 } |
| 180 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style); | 181 SVGGeometryElement::collectStyleForPresentationAttribute(name, value, style); |
| 181 } | 182 } |
| 182 | 183 |
| 183 void SVGPathElement::invalidateMPathDependencies() { | 184 void SVGPathElement::invalidateMPathDependencies() { |
| 184 // <mpath> can only reference <path> but this dependency is not handled in | 185 // <mpath> can only reference <path> but this dependency is not handled in |
| 185 // markForLayoutAndParentResourceInvalidation so we update any mpath dependenc
ies manually. | 186 // markForLayoutAndParentResourceInvalidation so we update any mpath |
| 187 // dependencies manually. |
| 186 if (SVGElementSet* dependencies = setOfIncomingReferences()) { | 188 if (SVGElementSet* dependencies = setOfIncomingReferences()) { |
| 187 for (SVGElement* element : *dependencies) { | 189 for (SVGElement* element : *dependencies) { |
| 188 if (isSVGMPathElement(*element)) | 190 if (isSVGMPathElement(*element)) |
| 189 toSVGMPathElement(element)->targetPathChanged(); | 191 toSVGMPathElement(element)->targetPathChanged(); |
| 190 } | 192 } |
| 191 } | 193 } |
| 192 } | 194 } |
| 193 | 195 |
| 194 Node::InsertionNotificationRequest SVGPathElement::insertedInto( | 196 Node::InsertionNotificationRequest SVGPathElement::insertedInto( |
| 195 ContainerNode* rootParent) { | 197 ContainerNode* rootParent) { |
| 196 SVGGeometryElement::insertedInto(rootParent); | 198 SVGGeometryElement::insertedInto(rootParent); |
| 197 invalidateMPathDependencies(); | 199 invalidateMPathDependencies(); |
| 198 return InsertionDone; | 200 return InsertionDone; |
| 199 } | 201 } |
| 200 | 202 |
| 201 void SVGPathElement::removedFrom(ContainerNode* rootParent) { | 203 void SVGPathElement::removedFrom(ContainerNode* rootParent) { |
| 202 SVGGeometryElement::removedFrom(rootParent); | 204 SVGGeometryElement::removedFrom(rootParent); |
| 203 invalidateMPathDependencies(); | 205 invalidateMPathDependencies(); |
| 204 } | 206 } |
| 205 | 207 |
| 206 FloatRect SVGPathElement::getBBox() { | 208 FloatRect SVGPathElement::getBBox() { |
| 207 document().updateStyleAndLayoutIgnorePendingStylesheets(); | 209 document().updateStyleAndLayoutIgnorePendingStylesheets(); |
| 208 | 210 |
| 209 // We want the exact bounds. | 211 // We want the exact bounds. |
| 210 return SVGPathElement::asPath().boundingRect(Path::BoundsType::Exact); | 212 return SVGPathElement::asPath().boundingRect(Path::BoundsType::Exact); |
| 211 } | 213 } |
| 212 | 214 |
| 213 } // namespace blink | 215 } // namespace blink |
| OLD | NEW |