OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005 Nikolas Zimmermann <zimmermann@kde.org> |
3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> | 3 * Copyright (C) 2004, 2005, 2006 Rob Buis <buis@kde.org> |
4 * Copyright (C) 2009 Google, Inc. | 4 * Copyright (C) 2009 Google, Inc. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 */ | 20 */ |
21 | 21 |
22 #include "config.h" | 22 #include "config.h" |
23 | 23 |
24 #include "core/rendering/svg/RenderSVGTransformableContainer.h" | 24 #include "core/rendering/svg/RenderSVGTransformableContainer.h" |
25 | 25 |
26 #include "SVGNames.h" | 26 #include "SVGNames.h" |
27 #include "core/rendering/svg/SVGRenderSupport.h" | 27 #include "core/rendering/svg/SVGRenderSupport.h" |
28 #include "core/svg/SVGStyledTransformableElement.h" | 28 #include "core/svg/SVGGraphicsElement.h" |
29 #include "core/svg/SVGUseElement.h" | 29 #include "core/svg/SVGUseElement.h" |
30 | 30 |
31 namespace WebCore { | 31 namespace WebCore { |
32 | 32 |
33 RenderSVGTransformableContainer::RenderSVGTransformableContainer(SVGStyledTransf
ormableElement* node) | 33 RenderSVGTransformableContainer::RenderSVGTransformableContainer(SVGGraphicsElem
ent* node) |
34 : RenderSVGContainer(node) | 34 : RenderSVGContainer(node) |
35 , m_needsTransformUpdate(true) | 35 , m_needsTransformUpdate(true) |
36 , m_didTransformToRootUpdate(false) | 36 , m_didTransformToRootUpdate(false) |
37 { | 37 { |
38 } | 38 } |
39 | 39 |
40 bool RenderSVGTransformableContainer::calculateLocalTransform() | 40 bool RenderSVGTransformableContainer::calculateLocalTransform() |
41 { | 41 { |
42 SVGStyledTransformableElement* element = toSVGStyledTransformableElement(nod
e()); | 42 SVGGraphicsElement* element = toSVGGraphicsElement(node()); |
43 | 43 |
44 // If we're either the renderer for a <use> element, or for any <g> element
inside the shadow | 44 // If we're either the renderer for a <use> element, or for any <g> element
inside the shadow |
45 // tree, that was created during the use/symbol/svg expansion in SVGUseEleme
nt. These containers | 45 // tree, that was created during the use/symbol/svg expansion in SVGUseEleme
nt. These containers |
46 // need to respect the translations induced by their corresponding use eleme
nts x/y attributes. | 46 // need to respect the translations induced by their corresponding use eleme
nts x/y attributes. |
47 SVGUseElement* useElement = 0; | 47 SVGUseElement* useElement = 0; |
48 if (element->hasTagName(SVGNames::useTag)) | 48 if (element->hasTagName(SVGNames::useTag)) |
49 useElement = static_cast<SVGUseElement*>(element); | 49 useElement = static_cast<SVGUseElement*>(element); |
50 else if (element->isInShadowTree() && element->hasTagName(SVGNames::gTag)) { | 50 else if (element->isInShadowTree() && element->hasTagName(SVGNames::gTag)) { |
51 SVGElement* correspondingElement = element->correspondingElement(); | 51 SVGElement* correspondingElement = element->correspondingElement(); |
52 if (correspondingElement && correspondingElement->hasTagName(SVGNames::u
seTag)) | 52 if (correspondingElement && correspondingElement->hasTagName(SVGNames::u
seTag)) |
(...skipping 12 matching lines...) Expand all Loading... |
65 if (!m_needsTransformUpdate) | 65 if (!m_needsTransformUpdate) |
66 return false; | 66 return false; |
67 | 67 |
68 m_localTransform = element->animatedLocalTransform(); | 68 m_localTransform = element->animatedLocalTransform(); |
69 m_localTransform.translate(m_lastTranslation.width(), m_lastTranslation.heig
ht()); | 69 m_localTransform.translate(m_lastTranslation.width(), m_lastTranslation.heig
ht()); |
70 m_needsTransformUpdate = false; | 70 m_needsTransformUpdate = false; |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 } | 74 } |
OLD | NEW |