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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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(); |
225 | 224 |
226 invalidateMPathDependencies(); | 225 invalidateMPathDependencies(); |
227 } | 226 } |
228 | 227 |
229 if (renderer) | 228 if (renderer) |
230 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 229 markForLayoutAndParentResourceInvalidation(renderer); |
231 } | 230 } |
232 | 231 |
233 void SVGPathElement::invalidateMPathDependencies() | 232 void SVGPathElement::invalidateMPathDependencies() |
234 { | 233 { |
235 // <mpath> can only reference <path> but this dependency is not handled in | 234 // <mpath> can only reference <path> but this dependency is not handled in |
236 // markForLayoutAndParentResourceInvalidation so we update any mpath depende
ncies manually. | 235 // markForLayoutAndParentResourceInvalidation so we update any mpath depende
ncies manually. |
237 if (SVGElementSet* dependencies = setOfIncomingReferences()) { | 236 if (SVGElementSet* dependencies = setOfIncomingReferences()) { |
238 SVGElementSet::iterator end = dependencies->end(); | 237 SVGElementSet::iterator end = dependencies->end(); |
239 for (SVGElementSet::iterator it = dependencies->begin(); it != end; ++it
) { | 238 for (SVGElementSet::iterator it = dependencies->begin(); it != end; ++it
) { |
240 if (isSVGMPathElement(**it)) | 239 if (isSVGMPathElement(**it)) |
(...skipping 19 matching lines...) Expand all Loading... |
260 { | 259 { |
261 m_pathSegList->baseValue()->clearByteStream(); | 260 m_pathSegList->baseValue()->clearByteStream(); |
262 | 261 |
263 invalidateSVGAttributes(); | 262 invalidateSVGAttributes(); |
264 | 263 |
265 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 264 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
266 if (!renderer) | 265 if (!renderer) |
267 return; | 266 return; |
268 | 267 |
269 renderer->setNeedsShapeUpdate(); | 268 renderer->setNeedsShapeUpdate(); |
270 RenderSVGResource::markForLayoutAndParentResourceInvalidation(renderer); | 269 markForLayoutAndParentResourceInvalidation(renderer); |
271 } | 270 } |
272 | 271 |
273 FloatRect SVGPathElement::getBBox() | 272 FloatRect SVGPathElement::getBBox() |
274 { | 273 { |
275 // By default, getBBox() returns objectBoundingBox but that will include | 274 // By default, getBBox() returns objectBoundingBox but that will include |
276 // markers so we override it to return just the path's bounding rect. | 275 // markers so we override it to return just the path's bounding rect. |
277 | 276 |
278 document().updateLayoutIgnorePendingStylesheets(); | 277 document().updateLayoutIgnorePendingStylesheets(); |
279 | 278 |
280 // FIXME: Eventually we should support getBBox for detached elements. | 279 // FIXME: Eventually we should support getBBox for detached elements. |
281 if (!renderer()) | 280 if (!renderer()) |
282 return FloatRect(); | 281 return FloatRect(); |
283 | 282 |
284 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); | 283 RenderSVGShape* renderer = toRenderSVGShape(this->renderer()); |
285 return renderer->path().boundingRect(); | 284 return renderer->path().boundingRect(); |
286 } | 285 } |
287 | 286 |
288 } // namespace blink | 287 } // namespace blink |
OLD | NEW |