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

Side by Side Diff: Source/core/svg/animation/SVGSMILElement.h

Issue 102353003: [SVG] Refactoring the logic to handle eventBase dependency (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed assert crash Created 6 years, 11 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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 bool isContributing(SMILTime elapsed) const; 102 bool isContributing(SMILTime elapsed) const;
103 bool isFrozen() const; 103 bool isFrozen() const;
104 104
105 unsigned documentOrderIndex() const { return m_documentOrderIndex; } 105 unsigned documentOrderIndex() const { return m_documentOrderIndex; }
106 void setDocumentOrderIndex(unsigned index) { m_documentOrderIndex = index; } 106 void setDocumentOrderIndex(unsigned index) { m_documentOrderIndex = index; }
107 107
108 virtual void resetAnimatedType() = 0; 108 virtual void resetAnimatedType() = 0;
109 virtual void clearAnimatedType(SVGElement* targetElement) = 0; 109 virtual void clearAnimatedType(SVGElement* targetElement) = 0;
110 virtual void applyResultsToTarget() = 0; 110 virtual void applyResultsToTarget() = 0;
111 111
112 void connectConditions(); 112 void connectSyncBaseConditions();
113 void connectEventBaseConditions();
113 114
114 void dispatchPendingEvent(SMILEventSender*); 115 void dispatchPendingEvent(SMILEventSender*);
115 void dispatchRepeatEvents(unsigned); 116 void dispatchRepeatEvents(unsigned);
116 117
117 protected: 118 protected:
118 void addBeginTime(SMILTime eventTime, SMILTime endTime, SMILTimeWithOrigin:: Origin = SMILTimeWithOrigin::ParserOrigin); 119 void addBeginTime(SMILTime eventTime, SMILTime endTime, SMILTimeWithOrigin:: Origin = SMILTimeWithOrigin::ParserOrigin);
119 void addEndTime(SMILTime eventTime, SMILTime endTime, SMILTimeWithOrigin::Or igin = SMILTimeWithOrigin::ParserOrigin); 120 void addEndTime(SMILTime eventTime, SMILTime endTime, SMILTimeWithOrigin::Or igin = SMILTimeWithOrigin::ParserOrigin);
120 121
121 void setInactive() { m_activeState = Inactive; } 122 void setInactive() { m_activeState = Inactive; }
122 123
123 // Sub-classes may need to take action when the target is changed. 124 // Sub-classes may need to take action when the target is changed.
124 virtual void setTargetElement(SVGElement*); 125 virtual void setTargetElement(SVGElement*);
125 virtual void setAttributeName(const QualifiedName&); 126 virtual void setAttributeName(const QualifiedName&);
126 127
127 private: 128 private:
128 void buildPendingResource(); 129 void buildPendingResource();
129 void clearResourceReferences(); 130 void clearResourceAndEventBaseReferences();
130 131
131 virtual void startedActiveInterval() = 0; 132 virtual void startedActiveInterval() = 0;
132 void endedActiveInterval(); 133 void endedActiveInterval();
133 virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) = 0; 134 virtual void updateAnimation(float percent, unsigned repeat, SVGSMILElement* resultElement) = 0;
134 135
135 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; } 136 virtual bool rendererIsNeeded(const RenderStyle&) OVERRIDE { return false; }
136 137
137 enum BeginOrEnd { 138 enum BeginOrEnd {
138 Begin, 139 Begin,
139 End 140 End
(...skipping 25 matching lines...) Expand all
165 String m_name; 166 String m_name;
166 SMILTime m_offset; 167 SMILTime m_offset;
167 int m_repeat; 168 int m_repeat;
168 RefPtr<Element> m_syncbase; 169 RefPtr<Element> m_syncbase;
169 RefPtr<ConditionEventListener> m_eventListener; 170 RefPtr<ConditionEventListener> m_eventListener;
170 }; 171 };
171 bool parseCondition(const String&, BeginOrEnd beginOrEnd); 172 bool parseCondition(const String&, BeginOrEnd beginOrEnd);
172 void parseBeginOrEnd(const String&, BeginOrEnd beginOrEnd); 173 void parseBeginOrEnd(const String&, BeginOrEnd beginOrEnd);
173 Element* eventBaseFor(const Condition&); 174 Element* eventBaseFor(const Condition&);
174 175
175 void disconnectConditions(); 176 void disconnectSyncBaseConditions();
177 void disconnectEventBaseConditions();
176 178
177 // Event base timing 179 // Event base timing
178 void handleConditionEvent(Event*, Condition*); 180 void handleConditionEvent(Event*, Condition*);
179 181
180 void notifyDependentsIntervalChanged(); 182 void notifyDependentsIntervalChanged();
181 void createInstanceTimesFromSyncbase(SVGSMILElement* syncbase); 183 void createInstanceTimesFromSyncbase(SVGSMILElement* syncbase);
182 void addTimeDependent(SVGSMILElement*); 184 void addSyncBaseDependent(SVGSMILElement*);
183 void removeTimeDependent(SVGSMILElement*); 185 void removeSyncBaseDependent(SVGSMILElement*);
184 186
185 enum ActiveState { 187 enum ActiveState {
186 Inactive, 188 Inactive,
187 Active, 189 Active,
188 Frozen 190 Frozen
189 }; 191 };
190 192
191 QualifiedName m_attributeName; 193 QualifiedName m_attributeName;
192 194
193 ActiveState determineActiveState(SMILTime elapsed) const; 195 ActiveState determineActiveState(SMILTime elapsed) const;
194 float calculateAnimationPercentAndRepeat(SMILTime elapsed, unsigned& repeat) const; 196 float calculateAnimationPercentAndRepeat(SMILTime elapsed, unsigned& repeat) const;
195 SMILTime calculateNextProgressTime(SMILTime elapsed) const; 197 SMILTime calculateNextProgressTime(SMILTime elapsed) const;
196 198
197 mutable SVGElement* m_targetElement; 199 mutable SVGElement* m_targetElement;
198 200
199 Vector<Condition> m_conditions; 201 Vector<Condition> m_conditions;
200 bool m_conditionsConnected; 202 bool m_syncBaseConditionsConnected;
201 bool m_hasEndEventConditions; 203 bool m_hasEndEventConditions;
202 204
203 bool m_isWaitingForFirstInterval; 205 bool m_isWaitingForFirstInterval;
204 206
205 typedef HashSet<SVGSMILElement*> TimeDependentSet; 207 typedef HashSet<SVGSMILElement*> TimeDependentSet;
206 TimeDependentSet m_timeDependents; 208 TimeDependentSet m_syncBaseDependents;
207 209
208 // Instance time lists 210 // Instance time lists
209 Vector<SMILTimeWithOrigin> m_beginTimes; 211 Vector<SMILTimeWithOrigin> m_beginTimes;
210 Vector<SMILTimeWithOrigin> m_endTimes; 212 Vector<SMILTimeWithOrigin> m_endTimes;
211 213
212 // This is the upcoming or current interval 214 // This is the upcoming or current interval
213 SMILTime m_intervalBegin; 215 SMILTime m_intervalBegin;
214 SMILTime m_intervalEnd; 216 SMILTime m_intervalEnd;
215 217
216 SMILTime m_previousIntervalBegin; 218 SMILTime m_previousIntervalBegin;
(...skipping 22 matching lines...) Expand all
239 { 241 {
240 return node.hasTagName(SVGNames::setTag) || node.hasTagName(SVGNames::animat eTag) || node.hasTagName(SVGNames::animateMotionTag) 242 return node.hasTagName(SVGNames::setTag) || node.hasTagName(SVGNames::animat eTag) || node.hasTagName(SVGNames::animateMotionTag)
241 || node.hasTagName(SVGNames::animateTransformTag) || node.hasTagName(SVG Names::animateColorTag); 243 || node.hasTagName(SVGNames::animateTransformTag) || node.hasTagName(SVG Names::animateColorTag);
242 } 244 }
243 245
244 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSMILElement); 246 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(SVGSMILElement);
245 247
246 } 248 }
247 249
248 #endif // SVGSMILElement_h 250 #endif // SVGSMILElement_h
OLDNEW
« no previous file with comments | « LayoutTests/svg/animations/repeatn-remove-add-animation-expected.txt ('k') | Source/core/svg/animation/SVGSMILElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698