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

Side by Side Diff: third_party/WebKit/Source/core/svg/SVGAnimationElement.h

Issue 2391993006: Move handling of 'attributeType' to SVGAnimateElement (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
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) 2007 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2007 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2008 Apple Inc. All rights reserved. 5 * Copyright (C) 2008 Apple Inc. All rights reserved.
6 * Copyright (C) 2008 Cameron McCormack <cam@mcc.id.au> 6 * Copyright (C) 2008 Cameron McCormack <cam@mcc.id.au>
7 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 7 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 112
113 protected: 113 protected:
114 SVGAnimationElement(const QualifiedName&, Document&); 114 SVGAnimationElement(const QualifiedName&, Document&);
115 115
116 void parseAttribute(const QualifiedName&, 116 void parseAttribute(const QualifiedName&,
117 const AtomicString&, 117 const AtomicString&,
118 const AtomicString&) override; 118 const AtomicString&) override;
119 void svgAttributeChanged(const QualifiedName&) override; 119 void svgAttributeChanged(const QualifiedName&) override;
120 120
121 enum AttributeType { AttributeTypeCSS, AttributeTypeXML, AttributeTypeAuto };
122 AttributeType getAttributeType() const { return m_attributeType; }
123
124 String toValue() const; 121 String toValue() const;
125 String byValue() const; 122 String byValue() const;
126 String fromValue() const; 123 String fromValue() const;
127 124
128 // from SVGSMILElement 125 // from SVGSMILElement
129 void startedActiveInterval() override; 126 void startedActiveInterval() override;
130 void updateAnimation(float percent, 127 void updateAnimation(float percent,
131 unsigned repeat, 128 unsigned repeat,
132 SVGSMILElement* resultElement) override; 129 SVGSMILElement* resultElement) override;
133 130
134 void setTargetElement(SVGElement*) override;
135 void setAttributeName(const QualifiedName&) override;
136
137 bool hasInvalidCSSAttributeType() const {
138 return m_hasInvalidCSSAttributeType;
139 }
140
141 virtual void updateAnimationMode(); 131 virtual void updateAnimationMode();
142 void setAnimationMode(AnimationMode animationMode) { 132 void setAnimationMode(AnimationMode animationMode) {
143 m_animationMode = animationMode; 133 m_animationMode = animationMode;
144 } 134 }
145 void setCalcMode(CalcMode calcMode) { m_calcMode = calcMode; } 135 void setCalcMode(CalcMode calcMode) { m_calcMode = calcMode; }
146 136
147 // Parses a list of values as specified by SVG, stripping leading 137 // Parses a list of values as specified by SVG, stripping leading
148 // and trailing whitespace, and places them in result. If the 138 // and trailing whitespace, and places them in result. If the
149 // format of the string is not valid, parseValues empties result 139 // format of the string is not valid, parseValues empties result
150 // and returns false. See 140 // and returns false. See
151 // http://www.w3.org/TR/SVG/animate.html#ValuesAttribute . 141 // http://www.w3.org/TR/SVG/animate.html#ValuesAttribute .
152 static bool parseValues(const String&, Vector<String>& result); 142 static bool parseValues(const String&, Vector<String>& result);
153 143
144 void animationAttributeChanged() override;
145
154 private: 146 private:
155 bool isValid() const final { return SVGTests::isValid(); } 147 bool isValid() const final { return SVGTests::isValid(); }
156 148
157 void animationAttributeChanged() override;
158 void setAttributeType(const AtomicString&);
159
160 void checkInvalidCSSAttributeType();
161
162 virtual bool calculateToAtEndOfDurationValue( 149 virtual bool calculateToAtEndOfDurationValue(
163 const String& toAtEndOfDurationString) = 0; 150 const String& toAtEndOfDurationString) = 0;
164 virtual bool calculateFromAndToValues(const String& fromString, 151 virtual bool calculateFromAndToValues(const String& fromString,
165 const String& toString) = 0; 152 const String& toString) = 0;
166 virtual bool calculateFromAndByValues(const String& fromString, 153 virtual bool calculateFromAndByValues(const String& fromString,
167 const String& byString) = 0; 154 const String& byString) = 0;
168 virtual void calculateAnimatedValue(float percent, 155 virtual void calculateAnimatedValue(float percent,
169 unsigned repeatCount, 156 unsigned repeatCount,
170 SVGSMILElement* resultElement) = 0; 157 SVGSMILElement* resultElement) = 0;
171 virtual float calculateDistance(const String& /*fromString*/, 158 virtual float calculateDistance(const String& /*fromString*/,
(...skipping 12 matching lines...) Expand all
184 String& from, 171 String& from,
185 String& to) const; 172 String& to) const;
186 float calculatePercentForSpline(float percent, unsigned splineIndex) const; 173 float calculatePercentForSpline(float percent, unsigned splineIndex) const;
187 float calculatePercentForFromTo(float percent) const; 174 float calculatePercentForFromTo(float percent) const;
188 unsigned calculateKeyTimesIndex(float percent) const; 175 unsigned calculateKeyTimesIndex(float percent) const;
189 176
190 void setCalcMode(const AtomicString&); 177 void setCalcMode(const AtomicString&);
191 178
192 bool m_animationValid; 179 bool m_animationValid;
193 180
194 AttributeType m_attributeType;
195 Vector<String> m_values; 181 Vector<String> m_values;
196 // FIXME: We should probably use doubles for this, but there's no point 182 // FIXME: We should probably use doubles for this, but there's no point
197 // making such a change unless all SVG logic for sampling animations is 183 // making such a change unless all SVG logic for sampling animations is
198 // changed to use doubles. 184 // changed to use doubles.
199 Vector<float> m_keyTimes; 185 Vector<float> m_keyTimes;
200 Vector<float> m_keyPoints; 186 Vector<float> m_keyPoints;
201 Vector<gfx::CubicBezier> m_keySplines; 187 Vector<gfx::CubicBezier> m_keySplines;
202 String m_lastValuesAnimationFrom; 188 String m_lastValuesAnimationFrom;
203 String m_lastValuesAnimationTo; 189 String m_lastValuesAnimationTo;
204 bool m_hasInvalidCSSAttributeType;
205 CalcMode m_calcMode; 190 CalcMode m_calcMode;
206 AnimationMode m_animationMode; 191 AnimationMode m_animationMode;
207 }; 192 };
208 193
209 } // namespace blink 194 } // namespace blink
210 195
211 #endif // SVGAnimationElement_h 196 #endif // SVGAnimationElement_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/svg/SVGAnimateElement.cpp ('k') | third_party/WebKit/Source/core/svg/SVGAnimationElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698