Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: Source/core/svg/SVGAnimatedTypeAnimator.cpp

Issue 18707002: Reduce number of header includes in SVG (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Attempt to fix bots Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 /*
2 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved.
Stephen Chennney 2013/07/08 14:08:39 Add yourself here.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
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
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #include "config.h"
21 #include "core/svg/SVGAnimatedTypeAnimator.h"
22
23 #include "core/svg/SVGElement.h"
24 #include "core/svg/properties/SVGAttributeToPropertyMap.h"
25
26 namespace WebCore {
27
28 SVGElementAnimatedProperties::SVGElementAnimatedProperties()
29 : element(0)
30 { }
31
32 SVGElementAnimatedProperties::SVGElementAnimatedProperties(SVGElement* element, Vector<RefPtr<SVGAnimatedProperty> >& properties)
33 : element(element)
34 , properties(properties)
35 { }
36
37 SVGAnimatedTypeAnimator::SVGAnimatedTypeAnimator(AnimatedPropertyType type, SVGA nimationElement* animationElement, SVGElement* contextElement)
38 : m_type(type)
39 , m_animationElement(animationElement)
40 , m_contextElement(contextElement)
41 {
42 }
43
44 SVGAnimatedTypeAnimator::~SVGAnimatedTypeAnimator()
45 {
46 }
47
48 void SVGAnimatedTypeAnimator::calculateFromAndToValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& toStr ing)
49 {
50 from = constructFromString(fromString);
51 to = constructFromString(toString);
52 }
53
54 void SVGAnimatedTypeAnimator::calculateFromAndByValues(OwnPtr<SVGAnimatedType>& from, OwnPtr<SVGAnimatedType>& to, const String& fromString, const String& byStr ing)
55 {
56 from = constructFromString(fromString);
57 to = constructFromString(byString);
58 addAnimatedTypes(from.get(), to.get());
59 }
60
61 SVGElementAnimatedPropertyList SVGAnimatedTypeAnimator::findAnimatedPropertiesFo rAttributeName(SVGElement* targetElement, const QualifiedName& attributeName)
62 {
63 ASSERT(targetElement);
64
65 SVGElementAnimatedPropertyList propertiesByInstance;
66
67 Vector<RefPtr<SVGAnimatedProperty> > targetProperties;
68 targetElement->localAttributeToPropertyMap().animatedPropertiesForAttribute( targetElement, attributeName, targetProperties);
69
70 if (!SVGAnimatedType::supportsAnimVal(m_type))
71 return SVGElementAnimatedPropertyList();
72
73 SVGElementAnimatedProperties propertiesPair(targetElement, targetProperties) ;
74 propertiesByInstance.append(propertiesPair);
75
76 const HashSet<SVGElementInstance*>& instances = targetElement->instancesForE lement();
77 const HashSet<SVGElementInstance*>::const_iterator end = instances.end();
78 for (HashSet<SVGElementInstance*>::const_iterator it = instances.begin(); it != end; ++it) {
79 SVGElement* shadowTreeElement = (*it)->shadowTreeElement();
80 if (!shadowTreeElement)
81 continue;
82
83 Vector<RefPtr<SVGAnimatedProperty> > instanceProperties;
84 targetElement->localAttributeToPropertyMap().animatedPropertiesForAttrib ute(shadowTreeElement, attributeName, instanceProperties);
85
86 SVGElementAnimatedProperties instancePropertiesPair(shadowTreeElement, i nstanceProperties);
87 propertiesByInstance.append(instancePropertiesPair);
88 }
89
90 #if !ASSERT_DISABLED
91 SVGElementAnimatedPropertyList::const_iterator propertiesEnd = propertiesByI nstance.end();
92 for (SVGElementAnimatedPropertyList::const_iterator it = propertiesByInstanc e.begin(); it != propertiesEnd; ++it) {
93 size_t propertiesSize = it->properties.size();
94 for (size_t i = 0; i < propertiesSize; ++i) {
95 RefPtr<SVGAnimatedProperty> property = it->properties[i];
96 if (property->animatedPropertyType() != m_type) {
97 ASSERT(m_type == AnimatedAngle);
98 ASSERT(property->animatedPropertyType() == AnimatedEnumeration);
99 }
100 }
101 }
102 #endif
103
104 return propertiesByInstance;
105 }
106
107 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698