| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
| 15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
| 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
| 18 */ | 18 */ |
| 19 | 19 |
| 20 #include "config.h" | 20 #include "config.h" |
| 21 | 21 |
| 22 #include "core/rendering/svg/RenderSVGResourceContainer.h" | 22 #include "core/rendering/svg/RenderSVGResourceContainer.h" |
| 23 | 23 |
| 24 #include "core/rendering/RenderLayer.h" | 24 #include "core/rendering/RenderLayer.h" |
| 25 #include "core/rendering/RenderView.h" | 25 #include "core/rendering/RenderView.h" |
| 26 #include "core/rendering/svg/RenderSVGRoot.h" | |
| 27 #include "core/rendering/svg/SVGRenderingContext.h" | 26 #include "core/rendering/svg/SVGRenderingContext.h" |
| 28 #include "core/rendering/svg/SVGResourcesCache.h" | 27 #include "core/rendering/svg/SVGResourcesCache.h" |
| 29 #include "core/svg/SVGGraphicsElement.h" | 28 #include "core/svg/SVGGraphicsElement.h" |
| 30 | 29 |
| 30 #include "wtf/TemporaryChange.h" |
| 31 |
| 31 namespace WebCore { | 32 namespace WebCore { |
| 32 | 33 |
| 33 static inline SVGDocumentExtensions* svgExtensionsFromElement(SVGElement* elemen
t) | 34 static inline SVGDocumentExtensions* svgExtensionsFromElement(SVGElement* elemen
t) |
| 34 { | 35 { |
| 35 ASSERT(element); | 36 ASSERT(element); |
| 36 return element->document().accessSVGExtensions(); | 37 return element->document().accessSVGExtensions(); |
| 37 } | 38 } |
| 38 | 39 |
| 39 RenderSVGResourceContainer::RenderSVGResourceContainer(SVGElement* node) | 40 RenderSVGResourceContainer::RenderSVGResourceContainer(SVGElement* node) |
| 40 : RenderSVGHiddenContainer(node) | 41 : RenderSVGHiddenContainer(node) |
| 41 , m_id(node->getIdAttribute()) | 42 , m_id(node->getIdAttribute()) |
| 42 , m_registered(false) | 43 , m_registered(false) |
| 43 , m_isInvalidating(false) | 44 , m_isInvalidating(false) |
| 45 , m_isInLayout(false) |
| 44 { | 46 { |
| 45 } | 47 } |
| 46 | 48 |
| 47 RenderSVGResourceContainer::~RenderSVGResourceContainer() | 49 RenderSVGResourceContainer::~RenderSVGResourceContainer() |
| 48 { | 50 { |
| 49 if (m_registered) | 51 if (m_registered) |
| 50 svgExtensionsFromElement(element())->removeResource(m_id); | 52 svgExtensionsFromElement(element())->removeResource(m_id); |
| 51 } | 53 } |
| 52 | 54 |
| 53 void RenderSVGResourceContainer::layout() | 55 void RenderSVGResourceContainer::layout() |
| 54 { | 56 { |
| 57 ASSERT(needsLayout()); |
| 58 if (m_isInLayout) |
| 59 return; |
| 60 |
| 61 TemporaryChange<bool> inLayoutChange(m_isInLayout, true); |
| 62 |
| 55 // Invalidate all resources if our layout changed. | 63 // Invalidate all resources if our layout changed. |
| 56 if (everHadLayout() && selfNeedsLayout()) | 64 if (everHadLayout() && selfNeedsLayout()) |
| 57 RenderSVGRoot::addResourceForClientInvalidation(this); | 65 removeAllClientsFromCache(); |
| 58 | 66 |
| 59 RenderSVGHiddenContainer::layout(); | 67 RenderSVGHiddenContainer::layout(); |
| 60 } | 68 } |
| 61 | 69 |
| 62 void RenderSVGResourceContainer::willBeDestroyed() | 70 void RenderSVGResourceContainer::willBeDestroyed() |
| 63 { | 71 { |
| 64 SVGResourcesCache::resourceDestroyed(this); | 72 SVGResourcesCache::resourceDestroyed(this); |
| 65 RenderSVGHiddenContainer::willBeDestroyed(); | 73 RenderSVGHiddenContainer::willBeDestroyed(); |
| 66 } | 74 } |
| 67 | 75 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if (!object->isSVGShape()) | 232 if (!object->isSVGShape()) |
| 225 return resourceTransform; | 233 return resourceTransform; |
| 226 | 234 |
| 227 SVGGraphicsElement* element = toSVGGraphicsElement(object->node()); | 235 SVGGraphicsElement* element = toSVGGraphicsElement(object->node()); |
| 228 AffineTransform transform = element->getScreenCTM(SVGLocatable::DisallowStyl
eUpdate); | 236 AffineTransform transform = element->getScreenCTM(SVGLocatable::DisallowStyl
eUpdate); |
| 229 transform *= resourceTransform; | 237 transform *= resourceTransform; |
| 230 return transform; | 238 return transform; |
| 231 } | 239 } |
| 232 | 240 |
| 233 } | 241 } |
| OLD | NEW |