OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 2 * Copyright (C) 2004, 2005, 2008 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) 2014 Google, Inc. | 4 * Copyright (C) 2014 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/svg/SVGGraphicsElement.h" | 24 #include "core/svg/SVGGraphicsElement.h" |
25 | 25 |
26 #include "core/SVGNames.h" | 26 #include "core/SVGNames.h" |
| 27 #include "core/css/resolver/StyleResolver.h" |
27 #include "core/rendering/svg/RenderSVGPath.h" | 28 #include "core/rendering/svg/RenderSVGPath.h" |
28 #include "core/rendering/svg/RenderSVGResource.h" | 29 #include "core/rendering/svg/RenderSVGResource.h" |
29 #include "core/rendering/svg/SVGPathData.h" | 30 #include "core/rendering/svg/SVGPathData.h" |
| 31 #include "core/svg/SVGElementRareData.h" |
30 #include "platform/transforms/AffineTransform.h" | 32 #include "platform/transforms/AffineTransform.h" |
31 | 33 |
32 namespace blink { | 34 namespace blink { |
33 | 35 |
34 SVGGraphicsElement::SVGGraphicsElement(const QualifiedName& tagName, Document& d
ocument, ConstructionType constructionType) | 36 SVGGraphicsElement::SVGGraphicsElement(const QualifiedName& tagName, Document& d
ocument, ConstructionType constructionType) |
35 : SVGElement(tagName, document, constructionType) | 37 : SVGElement(tagName, document, constructionType) |
36 , SVGTests(this) | 38 , SVGTests(this) |
37 , m_transform(SVGAnimatedTransformList::create(this, SVGNames::transformAttr
, SVGTransformList::create())) | 39 , m_transform(SVGAnimatedTransformList::create(this, SVGNames::transformAttr
, SVGTransformList::create())) |
38 { | 40 { |
39 addToPropertyMap(m_transform); | 41 addToPropertyMap(m_transform); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 } else { | 150 } else { |
149 style->applyTransform(transform, renderer()->objectBoundingBox()); | 151 style->applyTransform(transform, renderer()->objectBoundingBox()); |
150 } | 152 } |
151 | 153 |
152 // Flatten any 3D transform. | 154 // Flatten any 3D transform. |
153 matrix = transform.toAffineTransform(); | 155 matrix = transform.toAffineTransform(); |
154 } else { | 156 } else { |
155 m_transform->currentValue()->concatenate(matrix); | 157 m_transform->currentValue()->concatenate(matrix); |
156 } | 158 } |
157 | 159 |
158 if (m_supplementalTransform) | 160 if (hasSVGRareData()) |
159 return *m_supplementalTransform * matrix; | 161 return *svgRareData()->animateMotionTransform() * matrix; |
160 return matrix; | 162 return matrix; |
161 } | 163 } |
162 | 164 |
163 AffineTransform* SVGGraphicsElement::supplementalTransform() | 165 AffineTransform* SVGGraphicsElement::animateMotionTransform() |
164 { | 166 { |
165 if (!m_supplementalTransform) | 167 return ensureSVGRareData()->animateMotionTransform(); |
166 m_supplementalTransform = adoptPtr(new AffineTransform); | |
167 return m_supplementalTransform.get(); | |
168 } | 168 } |
169 | 169 |
170 bool SVGGraphicsElement::isSupportedAttribute(const QualifiedName& attrName) | 170 bool SVGGraphicsElement::isSupportedAttribute(const QualifiedName& attrName) |
171 { | 171 { |
172 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); | 172 DEFINE_STATIC_LOCAL(HashSet<QualifiedName>, supportedAttributes, ()); |
173 if (supportedAttributes.isEmpty()) { | 173 if (supportedAttributes.isEmpty()) { |
174 SVGTests::addSupportedAttributes(supportedAttributes); | 174 SVGTests::addSupportedAttributes(supportedAttributes); |
175 supportedAttributes.add(SVGNames::transformAttr); | 175 supportedAttributes.add(SVGNames::transformAttr); |
176 } | 176 } |
177 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); | 177 return supportedAttributes.contains<SVGAttributeHashTranslator>(attrName); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 } | 253 } |
254 | 254 |
255 void SVGGraphicsElement::toClipPath(Path& path) | 255 void SVGGraphicsElement::toClipPath(Path& path) |
256 { | 256 { |
257 updatePathFromGraphicsElement(this, path); | 257 updatePathFromGraphicsElement(this, path); |
258 // FIXME: How do we know the element has done a layout? | 258 // FIXME: How do we know the element has done a layout? |
259 path.transform(animatedLocalTransform()); | 259 path.transform(animatedLocalTransform()); |
260 } | 260 } |
261 | 261 |
262 } | 262 } |
OLD | NEW |