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, |
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 * Library General Public License for more details. | 13 * Library General Public License for more details. |
14 * | 14 * |
15 * You should have received a copy of the GNU Library General Public License | 15 * You should have received a copy of the GNU Library General Public License |
16 * along with this library; see the file COPYING.LIB. If not, write to | 16 * along with this library; see the file COPYING.LIB. If not, write to |
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
18 * Boston, MA 02110-1301, USA. | 18 * Boston, MA 02110-1301, USA. |
19 */ | 19 */ |
20 | 20 |
21 #include "config.h" | 21 #include "config.h" |
22 #include "core/svg/SVGPathElement.h" | 22 #include "core/svg/SVGPathElement.h" |
23 | 23 |
24 #include "core/rendering/svg/RenderSVGPath.h" | 24 #include "core/rendering/svg/RenderSVGPath.h" |
25 #include "core/rendering/svg/RenderSVGResource.h" | |
26 #include "core/svg/SVGDocumentExtensions.h" | 25 #include "core/svg/SVGDocumentExtensions.h" |
27 #include "core/svg/SVGMPathElement.h" | 26 #include "core/svg/SVGMPathElement.h" |
28 #include "core/svg/SVGPathSegArcAbs.h" | 27 #include "core/svg/SVGPathSegArcAbs.h" |
29 #include "core/svg/SVGPathSegArcRel.h" | 28 #include "core/svg/SVGPathSegArcRel.h" |
30 #include "core/svg/SVGPathSegClosePath.h" | 29 #include "core/svg/SVGPathSegClosePath.h" |
31 #include "core/svg/SVGPathSegCurvetoCubicAbs.h" | 30 #include "core/svg/SVGPathSegCurvetoCubicAbs.h" |
32 #include "core/svg/SVGPathSegCurvetoCubicRel.h" | 31 #include "core/svg/SVGPathSegCurvetoCubicRel.h" |
33 #include "core/svg/SVGPathSegCurvetoCubicSmoothAbs.h" | 32 #include "core/svg/SVGPathSegCurvetoCubicSmoothAbs.h" |
34 #include "core/svg/SVGPathSegCurvetoCubicSmoothRel.h" | 33 #include "core/svg/SVGPathSegCurvetoCubicSmoothRel.h" |
35 #include "core/svg/SVGPathSegCurvetoQuadraticAbs.h" | 34 #include "core/svg/SVGPathSegCurvetoQuadraticAbs.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 if (!isSupportedAttribute(attrName)) { | 212 if (!isSupportedAttribute(attrName)) { |
214 SVGGeometryElement::svgAttributeChanged(attrName); | 213 SVGGeometryElement::svgAttributeChanged(attrName); |
215 return; | 214 return; |
216 } | 215 } |
217 | 216 |
218 SVGElement::InvalidationGuard invalidationGuard(this); | 217 SVGElement::InvalidationGuard invalidationGuard(this); |
219 | 218 |
220 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 219 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
221 | 220 |
222 if (attrName == SVGNames::dAttr) { | 221 if (attrName == SVGNames::dAttr) { |
223 if (renderer) | 222 if (renderer) { |
224 renderer->setNeedsShapeUpdate(); | 223 renderer->setNeedsShapeUpdate(); |
| 224 boundsChanged(renderer); |
| 225 } |
225 | 226 |
226 invalidateMPathDependencies(); | 227 invalidateMPathDependencies(); |
| 228 } else { |
| 229 // 'pathLength' changed. |
| 230 if (renderer) |
| 231 markForLayoutAndParentResourceInvalidation(renderer); |
227 } | 232 } |
228 | |
229 if (renderer) | |
230 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | |
231 } | 233 } |
232 | 234 |
233 void SVGPathElement::invalidateMPathDependencies() | 235 void SVGPathElement::invalidateMPathDependencies() |
234 { | 236 { |
235 // <mpath> can only reference <path> but this dependency is not handled in | 237 // <mpath> can only reference <path> but this dependency is not handled in |
236 // markForLayoutAndParentResourceInvalidation so we update any mpath depende
ncies manually. | 238 // markForLayoutAndParentResourceInvalidation so we update any mpath depende
ncies manually. |
237 if (SVGElementSet* dependencies = setOfIncomingReferences()) { | 239 if (SVGElementSet* dependencies = setOfIncomingReferences()) { |
238 SVGElementSet::iterator end = dependencies->end(); | 240 SVGElementSet::iterator end = dependencies->end(); |
239 for (SVGElementSet::iterator it = dependencies->begin(); it != end; ++it
) { | 241 for (SVGElementSet::iterator it = dependencies->begin(); it != end; ++it
) { |
240 if (isSVGMPathElement(**it)) | 242 if (isSVGMPathElement(**it)) |
(...skipping 19 matching lines...) Expand all Loading... |
260 { | 262 { |
261 m_pathSegList->baseValue()->clearByteStream(); | 263 m_pathSegList->baseValue()->clearByteStream(); |
262 | 264 |
263 invalidateSVGAttributes(); | 265 invalidateSVGAttributes(); |
264 | 266 |
265 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 267 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
266 if (!renderer) | 268 if (!renderer) |
267 return; | 269 return; |
268 | 270 |
269 renderer->setNeedsShapeUpdate(); | 271 renderer->setNeedsShapeUpdate(); |
270 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 272 boundsChanged(renderer); |
271 } | 273 } |
272 | 274 |
273 FloatRect SVGPathElement::getBBox() | 275 FloatRect SVGPathElement::getBBox() |
274 { | 276 { |
275 // By default, getBBox() returns objectBoundingBox but that will include | 277 // By default, getBBox() returns objectBoundingBox but that will include |
276 // markers so we override it to return just the path's bounding rect. | 278 // markers so we override it to return just the path's bounding rect. |
277 | 279 |
278 document().updateLayoutIgnorePendingStylesheets(); | 280 document().updateLayoutIgnorePendingStylesheets(); |
279 | 281 |
280 // FIXME: Eventually we should support getBBox for detached elements. | 282 // FIXME: Eventually we should support getBBox for detached elements. |
281 if (!renderer()) | 283 if (!renderer()) |
282 return FloatRect(); | 284 return FloatRect(); |
283 | 285 |
284 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 286 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
285 return renderer->path().boundingRect(); | 287 return renderer->path().boundingRect(); |
286 } | 288 } |
287 | 289 |
288 } // namespace blink | 290 } // namespace blink |
OLD | NEW |